Skip to content

Commit

Permalink
add CRUD operations for phone
Browse files Browse the repository at this point in the history
  • Loading branch information
OmarMelouk committed Aug 25, 2024
1 parent 576895a commit efa4916
Show file tree
Hide file tree
Showing 9 changed files with 219 additions and 4 deletions.
40 changes: 40 additions & 0 deletions docs/api-reference/phone/buy.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
title: 'Buy AI phone number'
api: 'POST https://api-v2.opencopilot.so/backend/voice-channel/phone-number/buy'
description: 'This endpoint allows you to buy a new phone number for a specific organization. The phone number can be used for various telecommunication purposes within the organization.'
---

<Warning>
This endpoint is protected by the same JWT that the user uses to call other
APIs. The response will include data for the specified chatbot, along with
other metadata information.
</Warning>

<ParamField body="organization_id" type="string" required>
The unique identifier for the copilot (organization) you want to create an AI
phone for. This is a required parameter.
</ParamField>

<ParamField body="area_code" type="string" required>
The area code for the phone number you want to buy. This is a required
parameter.
</ParamField>

<ParamField body="name" type="string">
The name to associate with the purchased phone number. If not provided, a
default name will be used.
</ParamField>

<RequestExample>
```bash
curl --location --request POST 'https://api-v2.opencopilot.so/backend/phone-number/buy' \
--header 'Authorization: Bearer TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
"area_code": "123",
"organization_id": "org_456",
"name": "My AI phone agent that compliments customers"
}'
```
</RequestExample>

51 changes: 51 additions & 0 deletions docs/api-reference/phone/delete.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
title: 'Delete phone number'
api: 'DELETE https://api-v2.opencopilot.so/backend/voice-channel/phone-number/:phone_number_id'
description: 'This endpoint allows you to delete a phone number from your organization'
---

<Warning>
This endpoint is protected by the same JWT that the user uses to call other
APIs. The response will include data for the specified chatbot, along with
other metadata information.
</Warning>

<ParamField path="phone_number_id" type="string" required>
The unique identifier for the phone number you would like to delete from your organization
</ParamField>



<RequestExample>
```bash
curl --location --request DELETE 'https://api-v2.opencopilot.so/backend/phone-number/:phone_number_id' \
--header 'Authorization: Bearer TOKEN' \
```
</RequestExample>

<ResponseExample>
```json Response
[
{
"id": "1112234",
"organization_id": "999888123",
"provider_id": "091274",
"phone_number": "+14155690123",
"name": "My AI phone agent that calms down customers",
"base_prompt": "You are phone voice assistant. Always provice a short, to the point, and clear response. Do not engage in conversation with the user. Always ask the user to configure their account on Open CoPilot.",
"initial_message": "Hello, this phone is being managed by Open, how can I help you today?",
"handoff_phone_number": "+15103435446",
"created_at": "2024-08-24T12:01:59.000Z"
},
{ "id": "123987",
"organization_id": "999888123",
"provider_id": "091274",
"phone_number": "+14155690907",
"name": "My AI phone agent that compliments customers",
"base_prompt": "You are phone voice assistant. Always provice a short, to the point, and clear response. Do not engage in conversation with the user. Always ask the user to configure their account on Open CoPilot.",
"initial_message": "Hello, this phone is being managed by Open, how can I help you today?",
"handoff_phone_number": "+15103435446",
"created_at": "2024-08-24T12:01:59.000Z"}
]
```
</ResponseExample>
52 changes: 52 additions & 0 deletions docs/api-reference/phone/get-all-phones.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
title: 'Get all phone numbers'
api: 'GET https://api-v2.opencopilot.so/backend/voice-channel/phone-numbers/:organization_id'
description: 'This endpoint allows you to list all the phone number of your organization.'
---

<Warning>
This endpoint is protected by the same JWT that the user uses to call other
APIs. The response will include data for the specified chatbot, along with
other metadata information.
</Warning>

<ParamField path="organization_id" type="string" required>
The unique identifier for the copilot (organization) you want to create an AI
phone for. This is a required parameter.
</ParamField>



<RequestExample>
```bash
curl --location 'https://api-v2.opencopilot.so/backend/phone-number/buy' \
--header 'Authorization: Bearer TOKEN' \
```
</RequestExample>

<ResponseExample>
```json Response
[
{
"id": "1112234",
"organization_id": "999888123",
"provider_id": "091274",
"phone_number": "+14155690123",
"name": "My AI phone agent that calms down customers",
"base_prompt": "You are phone voice assistant. Always provice a short, to the point, and clear response. Do not engage in conversation with the user. Always ask the user to configure their account on Open CoPilot.",
"initial_message": "Hello, this phone is being managed by Open, how can I help you today?",
"handoff_phone_number": "+15103435446",
"created_at": "2024-08-24T12:01:59.000Z"
},
{ "id": "123987",
"organization_id": "999888123",
"provider_id": "091274",
"phone_number": "+14155690907",
"name": "My AI phone agent that compliments customers",
"base_prompt": "You are phone voice assistant. Always provice a short, to the point, and clear response. Do not engage in conversation with the user. Always ask the user to configure their account on Open CoPilot.",
"initial_message": "Hello, this phone is being managed by Open, how can I help you today?",
"handoff_phone_number": "+15103435446",
"created_at": "2024-08-24T12:01:59.000Z"}
]
```
</ResponseExample>
54 changes: 54 additions & 0 deletions docs/api-reference/phone/update.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
title: 'Update phone number'
api: 'PUT https://api-v2.opencopilot.so/backend/voice-channel/phone-number/:phone_number_id'
description: 'This endpoint allows you to update a phone number from your organization'
---

<Warning>
This endpoint is protected by the same JWT that the user uses to call other
APIs. The response will include data for the specified chatbot, along with
other metadata information.
</Warning>

<ParamField path="phone_number_id" type="string" required>
The unique identifier for the phone number you would like to update from your
organization
</ParamField>
{/* body */}
<ParamField body="name" type="string">
The name that identifies your AI phone
</ParamField>

<ParamField body="base_prompt" type="string">
The base prompt guides the AI's responses when interacting with customers. It
serves as the foundational instruction set for the AI phone, defining how it
should initiate conversations, handle customer inquiries, and respond to
various scenarios. This prompt helps ensure that the AI provides consistent
and relevant responses tailored to the specific needs of the organization and
its customers.
</ParamField>

<ParamField body="handoff_phone_number" type="string">
The handoff phone number is the phone number that the AI agent uses to handoff
the conversation with the customer if the customer asks to talk to a human, or
the AI phone agent cannot answer on of the customer's questions
</ParamField>

<ParamField body="initial_message" type="string">
The initial message is the first thing that the AI phone agent says when
answering the phone call.
</ParamField>

<RequestExample>
```bash
curl --location --request PUT 'https://api-v2.opencopilot.so/backend/phone-number/:phone_number_id' \
--header 'Authorization: Bearer TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "My cool phone",
"base_prompt": "You are an AI phone agent that compliments customers whenever you find a chance",
"handoff_phone_number": "+1XXXXXXXXX",
"initial_message": "Hello! How can I help you today?"
}'
```
</RequestExample>
2 changes: 1 addition & 1 deletion docs/introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ icon: "book"
<Card
title="Phone Support"
icon="phone"
href="phone/new"
href="phone/phone-support"
>
Use our phone support AI agent to handle customer support on the phone.
</Card>
Expand Down
14 changes: 11 additions & 3 deletions docs/mint.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@
{
"group": "Phone Support",
"icon": "phone",
"pages": [
"phone/new"
]
"pages": ["phone/phone-support", "phone/ai-phone-agent", "phone/human-phone-agent"]
},
{
"group": "Actions",
Expand Down Expand Up @@ -120,6 +118,16 @@
"api-reference/contacts/update"
]
},
{
"group": "Phone",
"icon": "phone",
"pages": [
"api-reference/phone/buy",
"api-reference/phone/get-all-phones",
"api-reference/phone/delete",
"api-reference/phone/update"
]
},
{
"group": "Sending Emails",
"icon": "envelope",
Expand Down
5 changes: 5 additions & 0 deletions docs/phone/ai-phone-agent.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: "AI Phone Agent"
icon: "headset"
---

5 changes: 5 additions & 0 deletions docs/phone/human-phone-agent.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: "Human Agent"
icon: "user-headset"
---

File renamed without changes.

0 comments on commit efa4916

Please sign in to comment.