Skip to main content

Chat status

Concept#

This is the chat status return webhook

Attention

Z-API does not accept webhooks that aren’t HTTPS


Updating the webhook#

To update the webhook route, you can do it through the API or through the admin panel.

API#

/update-webhook-chat-presence#

PUT https://api.z-api.io/instances/YOUR_INSTANCE/token/YOUR_TOKEN/update-webhook-chat-presence

Header#

KeyValue
Client-TokenACCOUNT SECURITY TOKEN

Request Body#

{
"value": "https://endereco-do-seu-sistema.com.br/instancia/SUA_INSTANCIA/presence"
}

Administrative panel#

img


Webhook’s returns#

The possible returns of the on-chat-presence webhook are registered below:

Response#

AttributesTypeDescription
typestringInstance event type, in this case it will be "PresenceChatCallback".
phonestringMessage destination phone number.
statusstringChat status identifier eg (typing...) status can contain ( UNAVAILABLE, AVAILABLE, COMPOSING, RECORDING)
lastSeentimestampUser's last present time identifier.

200#

Outside of the chat#

{
"type": "PresenceChatCallback",
"phone": "5544999999999",
"status": "UNAVAILABLE",
"lastSeen": null,
"instanceId": "instance.id"
}

Inside the chat#

{
"type": "PresenceChatCallback",
"phone": "5544999999999",
"status": "AVAILABLE",
"lastSeen": null,
"instanceId": "instance.id"
}

Typing in chat#

{
"type": "PresenceChatCallback",
"phone": "5544999999999",
"status": "COMPOSING",
"lastSeen": null,
"instanceId": "instance.id"
}

Stopped typing or deleted what you were typing#

{
"type": "PresenceChatCallback",
"phone": "5544999999999",
"status": "PAUSED",
"lastSeen": null,
"instanceId": "instance.id"
}
Notice

Observation:

After receiving a composing or recording, a PAUSED will be returned when the event stops

status PAUSED is only returned if using beta multi-devices

Recording audio in chat#

{
"type": "PresenceChatCallback",
"phone": "5544999999999",
"status": "RECORDING",
"lastSeen": null,
"instanceId": "instance.id"
}
Notice

The status RECORDING is only returned if using beta multi-devices

405#

In this case certify that you are sending the correct specification of the method. This means, verify if you sent a POST or PUT as specified at the beginning of this topic.

415#

In case you receive 415 error, make sure to add the “Content-Type” of the object you are sending in the request headers, mostly “application/json”