From efa4916f5037b520b15484103d560d26994ae7ec Mon Sep 17 00:00:00 2001 From: Omar Melouk Date: Mon, 26 Aug 2024 00:05:00 +0300 Subject: [PATCH] add CRUD operations for phone --- docs/api-reference/phone/buy.mdx | 40 +++++++++++++++ docs/api-reference/phone/delete.mdx | 51 +++++++++++++++++++ docs/api-reference/phone/get-all-phones.mdx | 52 ++++++++++++++++++++ docs/api-reference/phone/update.mdx | 54 +++++++++++++++++++++ docs/introduction.mdx | 2 +- docs/mint.json | 14 ++++-- docs/phone/ai-phone-agent.mdx | 5 ++ docs/phone/human-phone-agent.mdx | 5 ++ docs/phone/{new.mdx => phone-support.mdx} | 0 9 files changed, 219 insertions(+), 4 deletions(-) create mode 100644 docs/api-reference/phone/buy.mdx create mode 100644 docs/api-reference/phone/delete.mdx create mode 100644 docs/api-reference/phone/get-all-phones.mdx create mode 100644 docs/api-reference/phone/update.mdx create mode 100644 docs/phone/ai-phone-agent.mdx create mode 100644 docs/phone/human-phone-agent.mdx rename docs/phone/{new.mdx => phone-support.mdx} (100%) diff --git a/docs/api-reference/phone/buy.mdx b/docs/api-reference/phone/buy.mdx new file mode 100644 index 000000000..1ca517aec --- /dev/null +++ b/docs/api-reference/phone/buy.mdx @@ -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.' +--- + + + 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. + + + + The unique identifier for the copilot (organization) you want to create an AI + phone for. This is a required parameter. + + + + The area code for the phone number you want to buy. This is a required + parameter. + + + + The name to associate with the purchased phone number. If not provided, a + default name will be used. + + + +```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" + }' +``` + + diff --git a/docs/api-reference/phone/delete.mdx b/docs/api-reference/phone/delete.mdx new file mode 100644 index 000000000..ea65dd81a --- /dev/null +++ b/docs/api-reference/phone/delete.mdx @@ -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' +--- + + + 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. + + + + The unique identifier for the phone number you would like to delete from your organization + + + + + +```bash +curl --location --request DELETE 'https://api-v2.opencopilot.so/backend/phone-number/:phone_number_id' \ + --header 'Authorization: Bearer TOKEN' \ +``` + + + +```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"} +] +``` + diff --git a/docs/api-reference/phone/get-all-phones.mdx b/docs/api-reference/phone/get-all-phones.mdx new file mode 100644 index 000000000..4c9c2c381 --- /dev/null +++ b/docs/api-reference/phone/get-all-phones.mdx @@ -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.' +--- + + + 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. + + + + The unique identifier for the copilot (organization) you want to create an AI + phone for. This is a required parameter. + + + + + +```bash +curl --location 'https://api-v2.opencopilot.so/backend/phone-number/buy' \ + --header 'Authorization: Bearer TOKEN' \ +``` + + + +```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"} +] +``` + diff --git a/docs/api-reference/phone/update.mdx b/docs/api-reference/phone/update.mdx new file mode 100644 index 000000000..ff397eb9c --- /dev/null +++ b/docs/api-reference/phone/update.mdx @@ -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' +--- + + + 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. + + + + The unique identifier for the phone number you would like to update from your + organization + +{/* body */} + + The name that identifies your AI phone + + + + 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. + + + + 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 + + + + The initial message is the first thing that the AI phone agent says when + answering the phone call. + + + +```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?" + }' +``` + diff --git a/docs/introduction.mdx b/docs/introduction.mdx index d6b304a76..de3e6ca43 100644 --- a/docs/introduction.mdx +++ b/docs/introduction.mdx @@ -26,7 +26,7 @@ icon: "book" Use our phone support AI agent to handle customer support on the phone. diff --git a/docs/mint.json b/docs/mint.json index c78b76f8f..1ee2240cc 100644 --- a/docs/mint.json +++ b/docs/mint.json @@ -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", @@ -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", diff --git a/docs/phone/ai-phone-agent.mdx b/docs/phone/ai-phone-agent.mdx new file mode 100644 index 000000000..143c78735 --- /dev/null +++ b/docs/phone/ai-phone-agent.mdx @@ -0,0 +1,5 @@ +--- +title: "AI Phone Agent" +icon: "headset" +--- + diff --git a/docs/phone/human-phone-agent.mdx b/docs/phone/human-phone-agent.mdx new file mode 100644 index 000000000..62c35e5b7 --- /dev/null +++ b/docs/phone/human-phone-agent.mdx @@ -0,0 +1,5 @@ +--- +title: "Human Agent" +icon: "user-headset" +--- + diff --git a/docs/phone/new.mdx b/docs/phone/phone-support.mdx similarity index 100% rename from docs/phone/new.mdx rename to docs/phone/phone-support.mdx