CallsDial#
Beta version
The functionality is in beta mode. Features are subject to change and may also work unstably. There may be additional charges for functionality in the future.
You can request access to the functionality via GREEN-API support
The method is used to start an outgoing call.
A 200 OK response only means that the agent has accepted the command. You can track the call state using the callsRtc notification statuses.
Request#
To start an outgoing call, you have to execute a request at:
POST
{{apiUrl}}/waInstance{{idInstance}}/callsDial/{{apiTokenInstance}}
For apiUrl, idInstance and apiTokenInstance request parameters, refer to Before you start section.
Request body parameters#
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
chatId | string | Yes | Chat ID of the other party, for example 79001234567@c.us or 120650379300963@lid |
Request body example#
{
"chatId": "79001234567@c.us"
}
{
"chatId": "120650379300963@lid"
}
Response#
If successful, the method returns 200 OK and the call ID in the response body.
Response parameters#
| Parameter | Type | Description |
|---|---|---|
callId | string | Call ID |
Response body example#
{
"callId": "89EBA9EA7847F8044CE47B6FADB7002F"
}
Errors#
For a list of errors common to all methods, refer to Common errors section
| HTTP code | Error body | Description |
|---|---|---|
| 400 | {"message": "chatId must look like 79001234567@c.us or 123456789012345@lid"} | chatId does not match the required format |
| 404 | Instance not found | |
| 500 | {"message": "Dial error: ..."} | Call error on the WhatsApp side |
| 503 | {"message": "call refused: call_failed"} | WhatsApp refused the call, the call did not start |
Request examples#
import requests
url = "{{apiUrl}}/waInstance{{idInstance}}/callsDial/{{apiTokenInstance}}"
payload = {
"chatId": "79001234567@c.us"
}
headers = {
'Content-Type': 'application/json'
}
response = requests.post(url, json=payload, headers=headers)
print(response.text.encode('utf8'))
curl --location '{{apiUrl}}/waInstance{{idInstance}}/callsDial/{{apiTokenInstance}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"chatId": "79001234567@c.us"
}'