Skip to content

Commit

Permalink
Merge branch 'main' into omar/phone-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
OmarMelouk authored Aug 28, 2024
2 parents 1e19180 + 333fae4 commit f8b87d8
Show file tree
Hide file tree
Showing 14 changed files with 1,192 additions and 796 deletions.
3 changes: 3 additions & 0 deletions docs/api-reference/actions/delete-all-actions.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
openapi: delete /actions
---
4 changes: 4 additions & 0 deletions docs/api-reference/actions/import-from-openapi-file.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: "Import from OpenAPI file"
openapi: put /actions
---
65 changes: 1 addition & 64 deletions docs/api-reference/contacts/create.mdx
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>
41 changes: 1 addition & 40 deletions docs/api-reference/contacts/delete.mdx
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>
42 changes: 1 addition & 41 deletions docs/api-reference/contacts/list.mdx
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>
65 changes: 1 addition & 64 deletions docs/api-reference/contacts/update.mdx
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>
79 changes: 1 addition & 78 deletions docs/api-reference/email/email_api.mdx
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>
51 changes: 1 addition & 50 deletions docs/api-reference/endpoint/delete-all-actions.mdx
Original file line number Diff line number Diff line change
@@ -1,52 +1,3 @@
---
title: "Delete all actions"
api: "DELETE https://api-v2.opencopilot.so/backend/actions/bot/:id"
description: "Delete all actions from a copilot by ID"
openapi: delete /actions
---

<Warning>
This endpoint points to the (v2) version of the API. The (v2) version of the API is the latest version and is recommended for all new development. Please update your code to use the (v2) version of the API.
</Warning>


### Body

<ParamField path="id" type="string">
The uuid of the copilot
</ParamField>

### Headers

<ParamField path="header" name="Accept" type="string">
application/json
</ParamField>

<ParamField path="header" name="Authorization" type="string">
Bearer YOUR_TOKEN
</ParamField>

### Response

<ResponseField name="message" type="string">
Indicates whether the call was successful.
</ResponseField>

<RequestExample>

```bash Example Request
curl --location --request DELETE 'https://api-v2.opencopilot.so/backend/actions/bot/:id' \
--header 'Accept: application/json' \
--header 'Authorization : Bearer YOUR_TOKEN'
```

</RequestExample>

<ResponseExample>

```json Response
{
"message": "All actions deleted successfully"
}
```

</ResponseExample>
Loading

0 comments on commit f8b87d8

Please sign in to comment.