Instance state#
An incoming notification of this type contains data about the instance authorization state
Instance settings
To receive incoming notifications about a change in the instance status, you need to enable the settings in one of the ways presented:
-
Through the console, enable the
Receive notifications about changes in the account authorization statesetting -
Through the SetSettings method, enable the
stateWebhooksetting
Notification#
Notification format#
| Parameter | Type | Description |
|---|---|---|
typeWebhook | string | Incoming notification type. For notifications of this type the field takes the value stateInstanceChanged |
instanceData | object | Data about the instance |
timestamp | integer | Time the event occurred in UNIX format |
stateInstance | string | Instance state. Takes the values: |
notAuthorized - The instance is not authorized. To authorize the instance, refer to the Before you start section | ||
authorized - The instance is authorized | ||
blocked - The instance has been blocked | ||
starting - The instance is starting up (service mode). The instance or the server is rebooting, or the instance is in maintenance mode. It may take up to 5 minutes for the instance state to change to authorized | ||
pendingCode - The field is deprecated. To complete authorization, you need to send the authorization code using the SendAuthorizationCode method | ||
pendingPassword - To complete authorization, you need to send the two-factor authentication (2fa) password using the SendAuthorizationPassword method | ||
Fields of the instanceData object
| Parameter | Type | Description |
|---|---|---|
idInstance | integer | Instance identifier. A uint64 value, 10 digits |
wid | string | Account identifier |
typeInstance | string | Messenger type for the instance - telegram for Telegram- whatsapp - for WhatsApp- v3 - for MAX |
Notification body example#
{
"typeWebhook": "stateInstanceChanged",
"instanceData": {
"idInstance": 4100000000,
"wid": "79876543210@c.us",
"typeInstance": "telegram"
},
"timestamp": 1755589527,
"stateInstance": "authorized"
}