Bot activity

TrueConfAbout 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"
    }
}
ParameterTypeMandatoryDescription
typeuint32YesMessage type (default is 1). Corresponds to MESSAGE_TYPE.REQUEST
iduint32YesUnique request identifier. An incremental value assigned by the sender, required in each request for subsequent association with the response. Read more here.
methodstringYesCommand sendChatActivity
chatIdstringYesChat ID where the bot's activity will be displayed
activityTypestringYesType of transmitted activity. Possible values are described in the enumeration ChatActivity.

Response:

{
    "type": 2,
    "id": 10,
    "payload": {
        "chatId": "8be515432414d2e1385abec747ed4fb10cdb12f2",
        "activityType": "typing",
        "retryAfter": 5
    }
}
ParameterTypeMandatoryDescription
typeuint32YesMessage type (default is 2). Corresponds to MESSAGE_TYPE.RESPONSE
iduint32YesAn identifier matching the number sent in the original request, used to link the request and response.
chatIdstringYesChat ID to which activity is transferred
activityTypestringYesType of transmitted activity. Possible values are described in the enumeration ChatActivity.
retryAfteruint32YesThe 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.