Bot
With Bot API, you can retrieve or update information related to a bot.
Requirements
- Bot API can be used after setting up a bot in Settings > Desk > Bots on your dashboard.
- When sending a custom bot’s message to the Desk server from your server, the
bot_webhook_event_id
property should be included in the request body to notify the Desk server of which message the bot is responding to. - When sending an HTTP request to the Desk server, API key should be included as a request header. You can generate an API key in Settings > Desk > Credentials on your dashboard.
Resource representation
The following table shows the list of properties in a bot resource.
Property name | Type | Description |
---|---|---|
id | int | The unique ID of the bot. |
name | string | The name of the bot. |
type | string | The type of the bot. Valid values are CUSTOM and FAQ. |
project | int | The unique ID of a Desk project where the bot belongs. Desk projects have their own corresponding Sendbird application on a one-to-one basis. |
key | string | The unique key of the bot in a project. |
status | string | Indicates whether the bot’s account is activated in Sendbird Desk. Valid values are ACTIVE and INACTIVE. |
photoUrl | string | The profile image URL of the bot. |
webhookUrl | string | The webhook URL on your server where the Desk server sends webhook events when the bot receives a message from a customer. If the |
createdAt | string | The date and time when the bot was created, in ISO 8601 format. |
updatedAt | string | The date and time when any of the bot’s properties was last updated, in ISO 8601 format. |
canReceiveTransferredTickets | boolean | Indicates whether to allow the bot to receive tickets transferred from other agents. |
isUnreadError | boolean | Indicates whether there is any unchecked error in the webhook logs. |
welcomeMessage | string | The bot’s welcome message sent to a customer when a ticket is assigned to the bot. If a new ticket is directly assigned to the bot during the ticket creation using either Platform API or assignment rules, this message is sent to the customer instead of default welcome or away messages. |
fallbackRetryLimit | int | The maximum number of total fallback messages a custom bot can send to your customer. When the sum of server and timeout fallback messages reaches the limit, the ticket is unassigned from the bot and its status changes to Pending. |
serverErrorMessage | string | The fallback message a custom bot sends to your customer when the Desk server fails to receive an HTTP 200 OK response from your server. |
timeoutMessage | string | The fallback message for timeout. A custom bot sends the message to your customer when the Desk server doesn’t receive a response from your server within a specified time limit set by the |
timeoutSeconds | int | Time limit in seconds to send a timeout fallback message. Valid value ranges from 10 to 300, and can be set in increments of 10. |
handoverMessage | string | The message sent when ticket status is changed to Pending or when a ticket is transferred to other agents. |
noResultsMessage | string | The message sent by an FAQ bot when there isn't a question and answer that corresponds to a customer's request. |
questionSelectedMessage | string | The system message showing a selected question, which is displayed only to agents when a customer selects a question. |
agent | object | An agent resource that represents the bot in Sendbird Desk. |
Actions
- API endpoints are relative to the base URL allocated to your application. In this page, the
/bots
endpoint refers tohttps://desk-api-{application_id}.sendbird.com/platform/v1/bots
.
Note: If you want to know your application ID, sign in to your dashboard, go to the Settings > Application > General, and then check the Application ID.
- It's recommended that the parameter values in API URLs be urlencoded, such as
{bot_id}
.
List of actions
Action | HTTP request |
---|---|
| |
| |
| |
| |
|
List bots
Retrieves a list of bots registered in the application.
HTTP request
Parameters
The following table lists the parameters that this action supports.
Optional
Parameter name | Type | Description |
---|---|---|
limit | int | Specifies the number of results to return per page. Acceptable values are 1 to 500, inclusive. (Default: 50) |
int | Specifies the number of results to skip when receiving a response. The value of |
Response
If successful, this action returns a list of bot resources in the response body.
List of response properties
Property name | Type | Description |
---|---|---|
count | int | The total count of agents registered in the application. |
previous | string | The URL to retrieve the previous page in the result set. |
next | string | The URL to retrieve the next page in the result set. |
results[] | list | A list of bots. |
View a bot
Updates information on a bot.
HTTP request
Parameters
The following table lists the parameters that this action supports.
Required
Parameter name | Type | Description |
---|---|---|
bot_id | int | Specifies the unique ID of the target bot. |
Response
If successful, this action returns a list of bot resources in the response body.
Update a bot
Updates information on a specific bot.
HTTP request
Parameters
The following table lists the parameters that this action supports.
Required
Parameter name | Type | Description |
---|---|---|
bot_id | int | Specifies the unique ID of the target bot. |
Request body
The following table lists the properties of an HTTP request that this action supports.
Optional
Property name | Type | Description |
---|---|---|
name | string | Specifies the name of a bot. |
photoUrl | string | Specifies the profile image URL of a bot. |
profileFile | file | Uploads the file of a bot's profile image. An acceptable image is up to 5 MB. |
webhookUrl | string | Specifies the webhook URL on your server where the Desk server sends webhook events when a custom bot receives a message from a customer. |
canReceiveTransferredTickets | boolean | Determines whether to allow a bot to receive tickets transferred from other agents. |
welcomeMessage | string | Specifies a bot’s welcome message sent to a customer when a ticket is assigned to the bot. If a new ticket is directly assigned to the bot during the ticket creation using either Platform API or assignment rules, this message is sent to the customer instead of default welcome or away messages. |
fallbackRetryLimit | int | Specifies the maximum number of total fallback messages a custom bot can send to your customer. When the sum of server and timeout fallback messages reaches the limit, the ticket is unassigned from the bot and its status changes to Pending. |
serverErrorMessage | string | Specifies the fallback message a custom bot sends to your customer when the Desk server fails to receive an HTTP 200 OK response from your server. |
timeoutMessage | string | Specifies the fallback message for timeout. A custom bot sends the message to your customer when the Desk server successfully delivered the webhook event for a customer’s message to your server but there isn’t any reply for the time limit set by the |
timeoutSeconds | int | Specifies time limit in seconds to send a timeout fallback message. Acceptable value ranges from 10 to 300, and can be set in increments of 10. |
handoverMessage | string | Specifies the message sent when ticket status is changed to Pending or when a ticket is transferred to other agents. |
Note: If you want to upload a profile picture by passing an image file instead of a URL, reference the Multipart requests section.
Response
If successful, this action returns a list of bot resources in the response body.
Send a bot's message
Sends a custom bot’s message to a customer.
HTTP request
Parameters
The following table lists the parameters that this action supports.
Required
Parameter name | Type | Description |
---|---|---|
bot_id | int | Specifies the unique ID of a custom bot. |
Request body
The following table lists the properties of an HTTP request that this action supports.
Properties
Required | Type | Description |
---|---|---|
botWebhookEventId | int | Specifies the ID of a bot’s webhook event that a bot’s message is responding to. |
message | string | Specifies a bot’s message to send. |
Optional | Type | Description |
---|---|---|
data | array of objects | Specifies a |
Response
If successful, this action returns the information about the sent message in the response body.
List of response properties
Property name | Type | Description |
---|---|---|
id | int | The webhook event ID of the customer’s message that the bot’s message responded to. |
bot | int | The unique ID of the bot that sent the message. |
createdAt | string | The date when a webhook event is created, in ISO 8601 format. |
updatedAt | string | The date when a webhook event is updated, in ISO 8601 format. |
status | string | The status of the webhook log. Valid values are limited to the following: |
webhookUrl | string | The webhook URL of when the bot’s message was sent. |
chatMessage | nested object | An object that represents a customer’s message that the bot’s message responded to. |
Get a bot's webhook logs
Retrieves a custom bot’s webhook logs.
HTTP request
Parameters
The following table lists the parameters that this action supports.
Parameters
Required | Type | Description |
---|---|---|
bot_id | int | Specifies the unique ID of the target bot. |
Optional | Type | Description |
---|---|---|
limit | int | Specifies the number of results to return per page. Acceptable values are 1 to 500, inclusive. (Default: 50) |
int | Specifies the number of results to skip before retrieving the next page in the result set. This is used to adjust the starting index of the next page. (Default: 0) | |
start_date | date | Specifies a starting date that restricts the search scope to retrieve webhook logs created between start_date and end_date, in YYYY-MM-DD format. |
end_date | date | Specifies an ending date that restricts the search scope to retrieve webhook logs created between start_date and end_date, in YYYY-MM-DD format. |
order | string | Specifies the method to sort a list of results. Acceptable values are limited to the following: |
status | string | Specifies one or more statuses of webhook logs to retrieve with a query string like |
Response
If successful, this action returns a list of webhook logs with their information in the response body.
List of response properties
Property name | Type | Description |
---|---|---|
count | int | The total count of agents registered in the application. |
previous | string | The URL to retrieve the previous page in the result set. |
next | string | The URL to retrieve the next page in the result set. |
results[] | array | An array of the bot’s webhook logs created between |
(botWebhookEvent).id | int | The unique ID of the webhook event. |
(botWebhookEvent).bot | string | The unique ID of the bot related to the webhook event. |
(botWebhookEvent).chatMessage | nested object | An object that represents a customer’s message related to the webhook event. |
(botWebhookEvent).status | string | The status of the webhook log. Valid values are limited to the following: |
(botWebhookEvent).webhookUrl | string | The webhook URL of your server to receive a webhook event from the Desk server. |
(botWebhookEvent).updatedAt | string | The date and time when the webhook event was updated, in ISO 8601 format. |
(botWebhookEvent).createdAt | string | The date and time when the webhook event was created, in ISO 8601 format. |