Skip to main content

When connecting

Concept#

This is the mobile connection return webhook with Z-api

This webhook is triggered when the Z-API is connected to WhatsApp, this can happen when reading the qr-code, when restarting the instance, etc.

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-connected#

PUT https://api.z-api.io/instances/{id}/token/{token}/update-webhook-connected

Header#

KeyValue
Client-TokenACCOUNT SECURITY TOKEN

Request Body#

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


Webhook’s returns#

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

Response#

AttributesTypeDescription
connectedbooleanInstance status
phonestringNumber connected
mommentstringTime when the instance was disconnected from the number.
typestringInstance event type, in this case it will be "ConnectedCallback".

200#

{
"type": 'ConnectedCallback',
"connected": true,
"momment": 26151515154,
"instanceId": instance.id,
"phone": "número",,
"instanceId": "instance.id"
}

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”