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:
| URL | https://{{url}}/whatsapp-bsp-api-endpoint-ws/services/v1/call |
| Method | POST |
| Type | application/json |
Headers
Business operations during a call headers:
| Name | Description | Type | Requirements |
|---|---|---|---|
| Authorization | Messaging token. See Generate authentication token. | String | Required |
| Content-Type | application/json | String | Required |
Body
Business operations during a call body fields:
| Name | Description | Type | Requirements |
|---|---|---|---|
| from | Phone number (including country code) the call is made from | String | Required |
| to | Phone number (including country code) of the customer. Plus signs (+), hyphens (-), parentheses ((,)), and spaces are allowed | String | Required |
| action | The action to take on the call. Possible values: "connect", "pre_accept", "accept", "reject", "terminate" | String | Required |
| call_id | Call ID | String | Required if the action is "pre_accept", "accept", "reject" or "terminate" |
| sdp | Full 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 call | String | Required if the action is "connect", "pre_accept" or "accept" |
| biz_opaque_callback_data | An arbitrary string you can include for tracking and logging purposes. This text is included in the calls object of the call-terminate webhook payload | String | Optional. 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:
| Name | Description | Type |
|---|---|---|
| id | Internal call ID. Returned only when "action" is "connect". Pass this value as "call_id" when you terminate the call. | Array of String |
| success | Indicates 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}
