Skip to content

Incoming call#

Beta version

The functionality is in beta mode. Functions can be changed and may also work unstably.

A webhook of this type appears when there is an incoming call and contains information about the initiator and recipient of the call.

Configuring an instance

To receive incoming notifications about incoming calls, you need to enable the settings using one of the following options:

  1. Through console enable the settings Receive webhooks on incoming messages and files and Get notifications about calls

  2. Through the SetSettings method enable the settings incomingWebhook andincomingCallWebhook

Webhook#

Webhook parameters#

Parameter Type Description
from string Call initiator Id
typeWebhook string Incoming webhook type. For webhooks of this type the parameter takes on the value incomingCall
instanceData object Instance data
status string The status of an incoming call, it takes the following values:
offer - incoming call
pickUp - answered incoming call
hungUp - incoming call not answered, the recipient has interrupted the connection or the “Do not disturb” function has been activated on the phone
missed - the call initiator canceled the call. The status is deprecated and has been replaced by 'declined'
declined - unanswered incoming call or the call initiator canceled the call
timestamp integer Event timestamp in UNIX format
idMessage string Incoming call Id

instanceData object parameters

Parameter Type Description
idInstance integer Instance Id. The size of the integer is int64. Values ​​range include from 1 to 10 digits
wid string Account Id in WhatsApp format
typeInstance string Instance messenger type

Call statuses

When an incoming call is received, the system generates two notifications in sequence:

  • The first notification with the status offer, indicating that a new incoming call has been received.
  • Second notification with status pickUp, hungUp or declined, depending on the outcome of the call.

Scenario for receiving notifications:

  1. offer + pickUp - successful incoming call, the recipient answered the call
  2. offer + hungUp - incoming call not answered, the recipient has interrupted the connection or the “Do not disturb” function has been activated on the phone (hung up)
  3. offer + declined - missed incoming call, the initiator interrupted the connection (the caller ended the call)
  4. offer + declined - missed incoming call, the application terminated the connection due to a timeout (WhatsApp ended the call)

Webhook body example#

{
  "from": "79001234500@c.us",
  "typeWebhook": "incomingCall",
  "instanceData": {
    "idInstance": 7103000000,
    "wid": "79876543210@c.us",
    "typeInstance": "whatsapp"
  },
  "status": "pickUp",
  "timestamp": 1617691757,
  "idMessage": "104179EDB7F5328988D8834107EEBE50"
}