Business-initiated calls
Overview
The Calling API supports making calls to WhatsApp users from your business. The user dictates when calls can be received by granting call permissions to the business phone number.Call sequence diagram
ACCEPTED call status webhook will typically always arrive after the call has been established. It is primarily sent for call event auditing.
Prerequisites
Before you get started with business-initiated calling, ensure that:- Subscribe to the “calls” webhook field
- Calling APIs are enabled on your business phone number
Business-initiated calling flow
Part 1: Obtain permission to call the WhatsApp user
Obtaining call permissions from the WhatsApp user can be done in one of the following ways:Send a call permission request message
You can request call permissions by sending the WhatsApp user a permission request, either as a free form message during an open customer service window, or by using a template message that contains the request.- Learn how to send a free form call permission request
- Learn how to send a template call permission request
Enable callback_permission_status in call settings
When callback_permission_status is enabled, the user automatically provides call permission to your business when they place a call to you.
Learn how to enable callback_permission_status
WhatsApp user grants permanent permissions
The user can also grant permanent permissions to the business at any time through their business profile.Part 2: Your business initiates a new call to the WhatsApp user
Now that you have user permission, you can initiate a new call to the WhatsApp user in question. You can now call thePOST <PHONE_NUMBER_ID>/calls endpoint with the following request body to initiate a new call:
138006 indicates a lack of a call request permission for this business number from the WhatsApp user.
Part 3: You establish the call connection using webhook signaling
After successful initiation of a new call, you will receive a Call Connect webhook response that contains anSDP Answer from Cloud API. Your business will then apply the SDP Answer from this webhook to your WebRTC stack in order to initiate the media connection.
RINGING, ACCEPTED, or REJECTED:
Part 4: Your business or the WhatsApp user terminates the call
Both you or the WhatsApp user can terminate the call at any time. You call thePOST <PHONE_NUMBER_ID>/calls endpoint with the following request body to terminate the call:
Endpoints for business-initiated calling
Initiate call
Use this endpoint to initiate a call to a WhatsApp user by providing a phone number and a WebRTC call offer.Request Syntax
| Placeholder | Description | Sample Value |
|---|---|---|
<PHONE_NUMBER_ID>Integer | Required The business phone number from which you are initiating a new call from. Learn more about formatting phone numbers in Cloud API | +12784358810 |
Request body
Body parameters
| Parameter | Description | Sample Value |
|---|---|---|
toInteger | Required The number being called (callee) | “17863476655” |
actionString | Required The action being taken on the given call ID. Values can be connect | pre_accept | accept | reject | terminate | “connect” |
sessionJSON object | Optional Contains the session description protocol (SDP) type and description language. Requires two values: sdp_type — ( String) Required”offer”, to indicate SDP offer sdp — ( String) RequiredThe SDP info of the device on the other end of the call. The SDP must be compliant with RFC 8866. Learn more about Session Description Protocol (SDP) View example SDP structures | https<br />"session" :<br />{<br />"sdp_type" : "offer",<br />"sdp" : "<<RFC 8866 SDP>>"<br />} <br /> |
biz_opaque_callback_dataString | Optional An arbitrary string you can pass in that is useful for tracking and logging purposes. Any app subscribed to the “calls” webhook field on your WhatsApp Business Account can receive this string, as it is included in the calls object within the subsequent Call Terminate Webhook payload.Cloud API does not process this field. Maximum 512 characters | “0fS5cePMok” |
Success response
Error response
Possible errors that can occur:- Invalid
phone-number-id - Permissions/Authorization errors
- Request format validation errors, e.g. connection info, sdp, ice
- SDP validation errors
- Calling restriction errors
Terminate call
Use this endpoint to terminate an active call. This must be done even if there is anRTCP BYE packet in the media path. Ending the call this way also ensures pricing is more accurate.
When the WhatsApp user terminates the call, you do not have to call this endpoint. Once the call is successfully terminated, a Call Terminate Webhook will be sent to you.
Request syntax
| Parameter | Description | Sample Value |
|---|---|---|
<PHONE_NUMBER_ID>Integer | Required The business phone number which you are terminating a call from. Learn more about formatting phone numbers in Cloud API | 18274459827 |
Request body
Body parameters
| Parameter | Description | Sample Value |
|---|---|---|
call_idString | Required The ID of the phone call. For inbound calls, you receive a call ID from the Call Connect webhook when a WhatsApp user initiates the call. | “wacid.ABGGFjFVU2AfAgo6V-Hc5eCgK5Gh” |
actionString | Required The action being taken on the given call ID. Values can be connect | pre_accept | accept | reject | terminate | “terminate” |
Success response
Error response
Possible errors that can occur:- Invalid
call id - Invalid
phone-number-id - The WhatsApp user has already terminated the call
- Reject call is already in progress
- Permissions/Authorization errors
Webhooks for business-initiated calling
With all Calling API webhooks, there is a”calls” object inside the ”value” object of the webhook response. The ”calls” object contains metadata about the call that is used to action on each call placed or received by your business.
To receive Calling API webhooks, subscribe to the “calls” webhook field.
Learn more about Cloud API webhooks here
Call connect webhook
A webhook notification is sent in near real-time when a call initiated by your business is ready to be connected to the whatsapp user (anSDP Answer).
Critically, the webhook contains information required to establish a call connection via WebRTC.
Once you receive the Call Connect webhook, you can apply the SDP Answer received in the webhook to your WebRTC stack in order to initiate the media connection.
Webhook values for "calls"
| Placeholder | Description |
|---|---|
idString | A unique ID for the call |
toInteger | The number being called (callee) |
fromInteger | The number of the caller |
eventInteger | The calling event that this webhook is notifying the subscriber of |
timestampInteger | The UNIX timestamp of the webhook event |
directionString | The direction of the call being made. Can contain either: BUSINESS_INITIATED, for calls initiated by your business.USER_INITIATED, for calls initiated by a WhatsApp user. |
sessionJSON object | Optional Contains the session description protocol (SDP) type and description language. Requires two values: sdp_type — ( String) Required”offer”, to indicate SDP offer sdp — ( String) RequiredThe SDP info of the device on the other end of the call. The SDP must be compliant with RFC 8866. Learn more about Session Description Protocol (SDP) View example SDP structures |
contactsJSON object | Profile information of the callee. Contains two values: name — The WhatsApp profile name of the callee.wa_id — The WhatsApp ID of the callee. |
Call status webhook
This webhook is sent during the following calling events:- Ringing: When the WhatsApp user’s client device begins ringing
- Accepted: When the WhatsApp user accepts the call
- Rejected: When the call is rejected by the WhatsApp user. You’ll also receive the call terminate webhook in this case
Webhook values for "statuses"
| Placeholder | Description |
|---|---|
idString | A unique ID for the call |
timestampInteger | The UNIX timestamp of the webhook event |
recipient_idInteger | The phone number of the WhatsApp user receiving the call |
statusInteger | The current call status. Possible values: RINGING: Business initiated call is ringing the userACCEPTED: Business initiated call is accepted by the userREJECTED: Business initiated call is rejected by the user |
biz_opaque_callback_dateString | Arbitrary string your business passes into the call for tracking and logging purposes. Will only be returned if provided through Initiate New Call API requests |
Call terminate webhook
A webhook notification is sent whenever the call has been terminated for any reason, such as when the WhatsApp user hangs up, or when the business calls thePOST /<PHONE_NUMBER_ID>/calls endpoint with an action of terminate or reject.
Webhook values for "calls"
| Placeholder | Description |
|---|---|
idString | A unique ID for the call |
toInteger | The number being called (callee) |
fromInteger | The number of the caller |
eventInteger | The calling event that this webhook is notifying the subscriber of |
timestampInteger | The UNIX timestamp of the webhook event |
directionString | The direction of the call being made. Can contain either: BUSINESS_INITIATED, for calls initiated by your business.USER_INITIATED, for calls initiated by a WhatsApp user. |
start_timeInteger | The UNIX timestamp of when the call started. Only present when the call was picked up by the other party. |
end_timeInteger | The UNIX timestamp of when the call ended. Only present when the call was picked up by the other party. |
durationInteger | Duration of the call in seconds. Only present when the call was picked up by the other party. |
biz_opaque_callback_dateString | Arbitrary string your business passes into the call for tracking and logging purposes. Will only be returned if provided through an Initiate Call API request or Accept Call request |
errors.codeInteger | The errors object is present only for failed calls when there is error information available. Code is one of the calling error codes |

