-
Notifications
You must be signed in to change notification settings - Fork 399
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update API reference from "consumers" to "contacts"
- Loading branch information
Showing
9 changed files
with
129 additions
and
118 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
title: "Delete a contact" | ||
api: "DELETE https://api-v2.opencopilot.so/backend/contact/:organization_id/:contact_id" | ||
description: "Delete a contact for a specific Organization ID." | ||
--- | ||
|
||
<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> | ||
|
||
|
||
You can delete a contact in your organization at Open by calling this endpoint, a contact is a user that can interact with the chatbot, phone AI or email AI, a single contact might have multiple conversations across different channels. | ||
|
||
<Warning> | ||
**Important**: Deleting a contact will **not** delete any conversations that the contact has had with the copilot. You will need to manually delete any conversations that you want to delete. | ||
</Warning> | ||
|
||
|
||
<ParamField path="organization_id" type="string" required> | ||
The unique identifier for the copilot (organization) you want to create a contact for. This is a required parameter. | ||
</ParamField> | ||
|
||
<ParamField path="contact_id" type="string" required> | ||
The unique identifier for the contact you want to delete. This is a required parameter. | ||
</ParamField> | ||
|
||
|
||
<RequestExample> | ||
```bash Example Request | ||
curl --location 'https://api-v2.opencopilot.so/backend/contact/:organization_id/:contact_id' \ | ||
--header 'Authorization: Bearer TOKEN' \ | ||
--header 'Content-Type: application/json' | ||
``` | ||
</RequestExample> | ||
|
||
<ResponseExample> | ||
```json Response | ||
{ | ||
"message": "contact deleted successfully" | ||
} | ||
``` | ||
</ResponseExample> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- | ||
title: "Introduction to contact APIs" | ||
description: "Some of the APIs in the contact APIs section allow you to create, list, and delete contacts." | ||
icon: "user" | ||
--- | ||
|
||
|
||
## What is a contact? | ||
|
||
A contact is a user that can interact with the chatbot, phone AI or email AI, a single contact might have multiple conversations across different channels. | ||
|
||
|
||
## How do I create a contact? | ||
|
||
You can create a contact in your organization in two ways: | ||
|
||
#### 1. Using the API | ||
We have a simple public API that allows you to manage contacts in your organization, you can use the API to create, list, and delete contacts. | ||
|
||
#### 2. Using the widget | ||
Whenever you embed the copilot widget in your application, you can use the widget options to create a contact, read more about this option in the [widget documentation](/widget/embed#identifying-chat-users-consumers). | ||
|
||
|
||
### Adding custom data to a contact | ||
|
||
We support attaching a phone, email or a name to a contact, however, you can also add any custom data you want to associate with the contact. This data will be returned in the response and can be used for any purpose you want, just make sure it's a valid JSON string object. | ||
The custom data is just a simple JSON object, you can add any key-value pairs you want to it, for example: | ||
|
||
```jsx | ||
const widgetOptions = { | ||
initialMessage: "Hello! How can I help you?", | ||
token: "your_copilot_token_goes_here", | ||
user: { | ||
name: "your_user_name", | ||
email: "your_user_email", | ||
avatar: "your_user_avatar_url", | ||
phone: "your_user_phone", | ||
customData: { | ||
// any custom data you want to send to the copilot backend | ||
"key1": "value1", | ||
"balance": 100, | ||
"age": 25, | ||
} | ||
}, | ||
``` | ||
You can use the API or the widget to add custom data to a contact. |
12 changes: 6 additions & 6 deletions
12
docs/api-reference/consumers/list.mdx → docs/api-reference/contacts/list.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 13 additions & 13 deletions
26
docs/api-reference/consumers/update.mdx → docs/api-reference/contacts/update.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters