Bot activity
About 2 min
Bot activity
A chatbot can transmit its activity status to the server to display it to users in TrueConf client applications: for example, the "Typing..." indicator or "Recording a voice message." The type of activity transmitted is specified by the ChatActivity enumeration.
Client requests
Submit activity
Sends the server a pseudo-activity indicator of the chatbot in the specified chat.
Request:
{
"method": "sendChatActivity",
"type": 1,
"id": 10,
"payload": {
"chatId": "8be515432414d2e1385abec747ed4fb10cdb12f2",
"activityType": "typing"
}
}| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| type | uint32 | Yes | Message type (default is 1). Corresponds to MESSAGE_TYPE.REQUEST |
| id | uint32 | Yes | Unique request identifier. An incremental value assigned by the sender, required in each request for subsequent association with the response. Read more here. |
| method | string | Yes | Command sendChatActivity |
| chatId | string | Yes | Chat ID where the bot's activity will be displayed |
| activityType | string | Yes | Type of transmitted activity. Possible values are described in the enumeration ChatActivity. |
Response:
{
"type": 2,
"id": 10,
"payload": {
"chatId": "8be515432414d2e1385abec747ed4fb10cdb12f2",
"activityType": "typing",
"retryAfter": 5
}
}| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| type | uint32 | Yes | Message type (default is 2). Corresponds to MESSAGE_TYPE.RESPONSE |
| id | uint32 | Yes | An identifier matching the number sent in the original request, used to link the request and response. |
| chatId | string | Yes | Chat ID to which activity is transferred |
| activityType | string | Yes | Type of transmitted activity. Possible values are described in the enumeration ChatActivity. |
| retryAfter | uint32 | Yes | The number of seconds the bot should wait before sending the next activity. A value of 0 means there are no restrictions. |
In the event of an error, a message containing the errorCode parameter is returned. A list of possible values is available in the corresponding section of the documentation.