logo
enes

Business operations during a call

Last update: 6 hours ago by Irais Aguirre

The Business operations during a call service lets a business manage the lifecycle of a WhatsApp call: start, pre-accept, accept, reject and end it.

Integration summary

  • Base URL: https://{{url}}/whatsapp-bsp-api-endpoint-ws/services
  • Token: messaging token, in the Authorization: Bearer {{wa-msg-api-token}} header (how to generate it)
  • Endpoints on this page:
    • POST /v1/call: Business operations during a call

Business operations during a call

A business can perform the following operations on a call:

  • Start a call
  • Pre-accept a call
  • Accept a call
  • Reject a call
  • End a call

Request

Business operations during a call request:

URLhttps://{{url}}/whatsapp-bsp-api-endpoint-ws/services/v1/call
MethodPOST
Typeapplication/json

Headers

Business operations during a call headers:

NameDescriptionTypeRequirements
AuthorizationMessaging token. See Generate authentication token.StringRequired
Content-Typeapplication/jsonStringRequired

Body

Business operations during a call body fields:

NameDescriptionTypeRequirements
fromPhone number (including country code) the call is made fromStringRequired
toPhone number (including country code) of the customer. Plus signs (+), hyphens (-), parentheses ((,)), and spaces are allowedStringRequired
actionThe action to take on the call. Possible values: "connect", "pre_accept", "accept", "reject", "terminate"StringRequired
call_idCall IDStringRequired if the action is "pre_accept", "accept", "reject" or "terminate"
sdpFull SDP (Session Description Protocol) string. It contains codec parameters, IP addresses, RTP ports, encryption, and so on. It is the "technical negotiation" between both sides to establish the callStringRequired if the action is "connect", "pre_accept" or "accept"
biz_opaque_callback_dataAn arbitrary string you can include for tracking and logging purposes. This text is included in the calls object of the call-terminate webhook payloadStringOptional. Only applies to "connect" and "accept". Maximum 512 characters

Example

Complete Business operations during a call example for each action (HTTP request and JSON body):

Start a call

HTTP request

curl -X POST 'https://{{url}}/whatsapp-bsp-api-endpoint-ws/services/v1/call' \
-H 'Authorization: Bearer {{wa-msg-api-token}}' \
-H 'Content-Type: application/json' \
-d '{
"from": "5215500000001",
"to": "5215500000002",
"action":"connect",
"sdp" : "<<RFC 8866 SDP>>",
"biz_opaque_callback_data": "0fS5cePMok"
}'

Body

{
"from": "5215500000001",
"to": "5215500000002",
"action":"connect",
"sdp" : "<<RFC 8866 SDP>>",
"biz_opaque_callback_data": "0fS5cePMok"
}

Pre-accept a call

HTTP request

curl -X POST 'https://{{url}}/whatsapp-bsp-api-endpoint-ws/services/v1/call' \
-H 'Authorization: Bearer {{wa-msg-api-token}}' \
-H 'Content-Type: application/json' \
-d '{
"from": "5215500000001",
"to": "5215500000002",
"action":"pre_accept",
"call_id": "wacid.ABGGFjFVU2AfAgo6V-Hc5eCgK5Gh",
"sdp" : "<<RFC 8866 SDP>>"
}'

Body

{
"from": "5215500000001",
"to": "5215500000002",
"action":"pre_accept",
"call_id": "wacid.ABGGFjFVU2AfAgo6V-Hc5eCgK5Gh",
"sdp" : "<<RFC 8866 SDP>>"
}

Accept a call

HTTP request

curl -X POST 'https://{{url}}/whatsapp-bsp-api-endpoint-ws/services/v1/call' \
-H 'Authorization: Bearer {{wa-msg-api-token}}' \
-H 'Content-Type: application/json' \
-d '{
"from": "5215500000001",
"to": "5215500000002",
"action":"accept",
"call_id": "wacid.ABGGFjFVU2AfAgo6V-Hc5eCgK5Gh",
"sdp" : "<<RFC 8866 SDP>>"
}'

Body

{
"from": "5215500000001",
"to": "5215500000002",
"action":"accept",
"call_id": "wacid.ABGGFjFVU2AfAgo6V-Hc5eCgK5Gh",
"sdp" : "<<RFC 8866 SDP>>"
}

Reject a call

HTTP request

curl -X POST 'https://{{url}}/whatsapp-bsp-api-endpoint-ws/services/v1/call' \
-H 'Authorization: Bearer {{wa-msg-api-token}}' \
-H 'Content-Type: application/json' \
-d '{
"from": "5215500000001",
"to": "5215500000002",
"action":"reject",
"call_id": "wacid.ABGGFjFVU2AfAgo6V-Hc5eCgK5Gh"
}'

Body

{
"from": "5215500000001",
"to": "5215500000002",
"action":"reject",
"call_id": "wacid.ABGGFjFVU2AfAgo6V-Hc5eCgK5Gh"
}

End a call

HTTP request

curl -X POST 'https://{{url}}/whatsapp-bsp-api-endpoint-ws/services/v1/call' \
-H 'Authorization: Bearer {{wa-msg-api-token}}' \
-H 'Content-Type: application/json' \
-d '{
"from": "5215500000001",
"to": "5215500000002",
"action":"terminate",
"call_id": "wacid.ABGGFjFVU2AfAgo6V-Hc5eCgK5Gh"
}'

Body

{
"from": "5215500000001",
"to": "5215500000002",
"action":"terminate",
"call_id": "wacid.ABGGFjFVU2AfAgo6V-Hc5eCgK5Gh"
}

Response

Business operations during a call response:

NameDescriptionType
idInternal call ID. Returned only when "action" is "connect". Pass this value as "call_id" when you terminate the call.Array of String
successIndicates whether the operation succeeded. Returned for "pre_accept", "accept", "reject" and "terminate".Boolean

Example response for connect:

{
"id": ["b1f2c7d8-1234-4abc-9def-0123456789ab"]
}

Example response for pre_accept, accept, reject and terminate:

{
"success": true
}


WhatsApp โ€” Previous
Call settings
Next โ€” WhatsApp
WABA Administration