-
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.
Merge pull request #812 from openchatai/tabaza/public-api-docs
Auto-generated OpenAPI Docs
- Loading branch information
Showing
10 changed files
with
1,184 additions
and
676 deletions.
There are no files selected for viewing
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,3 @@ | ||
--- | ||
openapi: delete /actions | ||
--- |
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,4 @@ | ||
--- | ||
title: "Import from OpenAPI file" | ||
openapi: put /actions | ||
--- |
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 |
---|---|---|
@@ -1,66 +1,3 @@ | ||
--- | ||
title: "Create contact" | ||
api: "POST https://api-v2.opencopilot.so/backend/contact/:organization_id" | ||
description: "Create a new contact for a specific Organization ID." | ||
openapi: post /contacts | ||
--- | ||
|
||
<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 create a new 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. | ||
|
||
|
||
|
||
<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 body="copilot_id" type="string" default="uuid" required> | ||
The unique identifier for the copilot_id (organization_id) you want to create a contact for. This is a required parameter. | ||
</ParamField> | ||
|
||
<ParamField body="email" type="string" default="string"> | ||
The email address of the contact. | ||
</ParamField> | ||
|
||
<ParamField body="name" type="string" default="string"> | ||
The name of the contact. | ||
</ParamField> | ||
|
||
<ParamField body="phone_number" type="string" default="string"> | ||
The phone number of the contact. | ||
</ParamField> | ||
|
||
<ParamField body="custom_data" type="object" default="{}"> | ||
An object containing any custom data you want to associate with the contact. | ||
</ParamField> | ||
|
||
|
||
<RequestExample> | ||
```bash Example Request | ||
curl --location 'https://api-v2.opencopilot.so/backend/contact/:organization_id' \ | ||
--header 'Authorization: Bearer TOKEN' \ | ||
--header 'Content-Type: application/json' | ||
``` | ||
</RequestExample> | ||
|
||
<ResponseExample> | ||
```json Response | ||
{ | ||
"copilot_id": "6486fa96-80ac-4654-bf71-f793893e8fef", | ||
"email": "[email protected]", | ||
"name": "string", | ||
"phone_number": "string", | ||
"custom_data": "{}", | ||
"created_at": null, | ||
"updated_at": null, | ||
"id": "82e95723-245b-47c0-9cf2-2dd3d3914a40" | ||
} | ||
``` | ||
</ResponseExample> | ||
|
||
<Info> | ||
You can pass 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. | ||
</Info> |
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 |
---|---|---|
@@ -1,42 +1,3 @@ | ||
--- | ||
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." | ||
openapi: delete /contacts/{contact_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 |
---|---|---|
@@ -1,43 +1,3 @@ | ||
--- | ||
title: "List contacts" | ||
api: "GET https://api-v2.opencopilot.so/backend/contact/:organization_id" | ||
description: "List all contacts for a specific Organization ID." | ||
openapi: post /contacts/query | ||
--- | ||
|
||
<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 list all contacts 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. | ||
|
||
|
||
<ParamField path="organization_id" type="string" required> | ||
The unique identifier for the copilot (organization) you want to list contacts for. This is a required parameter. | ||
</ParamField> | ||
|
||
|
||
<RequestExample> | ||
```bash Example Request | ||
curl --location 'https://api-v2.opencopilot.so/backend/contact/:organization_id' \ | ||
--header 'Authorization: Bearer TOKEN' \ | ||
--header 'Content-Type: application/json' | ||
``` | ||
</RequestExample> | ||
|
||
<ResponseExample> | ||
```json Response | ||
[ | ||
{ | ||
"copilot_id": "6486fa96-80ac-4654-bf71-f793893e8fef", | ||
"email": "[email protected]", | ||
"name": "string", | ||
"phone_number": "string", | ||
"custom_data": "{}", | ||
"created_at": null, | ||
"updated_at": null, | ||
"id": "82e95723-245b-47c0-9cf2-2dd3d3914a40" | ||
} | ||
] | ||
``` | ||
</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 |
---|---|---|
@@ -1,66 +1,3 @@ | ||
--- | ||
title: "Update a contact" | ||
api: "PUT https://api-v2.opencopilot.so/backend/contact/:organization_id/:contact_id" | ||
description: "Update a contact for a specific Organization ID." | ||
openapi: put /contacts/{contact_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 update 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. | ||
|
||
<ParamField path="organization_id" type="string" required> | ||
The unique identifier for the copilot (organization) you want to list contacts for. This is a required parameter. | ||
</ParamField> | ||
|
||
<ParamField path="contact_id" type="string" required> | ||
The unique identifier for the contact you want to update. This is a required parameter. | ||
</ParamField> | ||
|
||
|
||
<ParamField body="copilot_id" type="string" default="uuid" required> | ||
The unique identifier for the copilot_id (organization_id) you want to create a contact for. This is a required parameter. | ||
</ParamField> | ||
|
||
<ParamField body="email" type="string" default="string"> | ||
The email address of the contact. | ||
</ParamField> | ||
|
||
<ParamField body="name" type="string" default="string"> | ||
The name of the contact. | ||
</ParamField> | ||
|
||
<ParamField body="phone_number" type="string" default="string"> | ||
The phone number of the contact. | ||
</ParamField> | ||
|
||
<ParamField body="custom_data" type="object" default="{}"> | ||
An object containing any custom data you want to associate with the contact. | ||
</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 | ||
{ | ||
"copilot_id": "6486fa96-80ac-4654-bf71-f793893e8fef", | ||
"email": "[email protected]", | ||
"name": "string", | ||
"phone_number": "string", | ||
"custom_data": "{}", | ||
"created_at": null, | ||
"updated_at": null, | ||
"id": "82e95723-245b-47c0-9cf2-2dd3d3914a40" | ||
} | ||
``` | ||
</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 |
---|---|---|
@@ -1,80 +1,3 @@ | ||
--- | ||
title: "Sending emails" | ||
api: "POST https://api-v2.opencopilot.so/backend/email/{org_id}/send" | ||
description: "Send emails to your contacts, possibly after a specified time delay." | ||
openapi: post /email | ||
--- | ||
|
||
<Note> | ||
To send emails using the API, you must first verify the domain you want to | ||
send emails from. You can add and verify custom domains in the settings. | ||
</Note> | ||
|
||
## Path Parameters | ||
|
||
<ParamField path="orgId" type="string" required> | ||
Your copilot/organization ID. | ||
</ParamField> | ||
|
||
## Body | ||
|
||
<ParamField body="from_email" type="string" required> | ||
The email to send from. This email's domain name must be added and verified. | ||
Otherwise, the request will fail with a 400 status code. | ||
</ParamField> | ||
|
||
<ParamField body="recipients" type="array" required> | ||
|
||
Array of contacts to receive emails. The only required field is `to_email`, with the rest of the fields having fallback values that can be specified on the top level. | ||
|
||
It's possible to repeat the same contact email in the array with different `delay_in_minutes` values to create a sequence of scheduled emails for that contact (e.g. for onboarding). | ||
|
||
<Expandable title="recipients"> | ||
<ParamField body="to_email" type="string" required> | ||
The email to send to. | ||
</ParamField> | ||
|
||
{" "} | ||
|
||
<ParamField body="email_subject" type="string"> | ||
Subject of the email. | ||
</ParamField> | ||
|
||
{" "} | ||
|
||
<ParamField body="email_body" type="string"> | ||
Body of the email in HTML format. | ||
</ParamField> | ||
|
||
{" "} | ||
|
||
<ParamField body="email_sender_name" type="string"> | ||
Display name of the email sender. | ||
</ParamField> | ||
|
||
<ParamField body="email_is_transactional" type="boolean"> | ||
Whether the email is transactional. If set to `false`, Open will check if the | ||
contact has [unsubscribed/opted out](./unsubscribe_api) of receiving marketing | ||
emails before sending the email. Defaults to `true`. | ||
</ParamField> | ||
|
||
</Expandable> | ||
</ParamField> | ||
|
||
<ParamField body="fallback_email_subject" type="string"> | ||
Subject of the email in case none is provided for the contact within the | ||
`recipients` array. | ||
</ParamField> | ||
|
||
<ParamField body="fallback_email_body" type="string"> | ||
Body of the email in HTML format in case none is provided for the contact | ||
within the `recipients` array. | ||
</ParamField> | ||
|
||
<ParamField body="fallback_email_sender_name" type="string"> | ||
Display name of the email sender in case none is provided for the contact | ||
within the `recipients` array. | ||
</ParamField> | ||
|
||
<ParamField body="delay_in_minutes" type="number"> | ||
How much time (in minutes) to wait before sending the emails. | ||
</ParamField> |
Oops, something went wrong.