How to Make and Receive WhatsApp Calls with the Voice API [Beta]
Before You Begin
Read the WhatsApp Business Calling conceptual guide for an explanation of the consent model and the difference between inbound and outbound calls.
Prerequisites (Account & Number Provisioning)
- A Vonage API account.
- A Vonage Long Virtual Number (LVN). Please note that the LVN would need to be validated by Meta to be able to support WhatsApp Business Calling.
- Set up your WABA in the Vonage Customer Dashboard: create a WhatsApp Business Account (WABA), associate it with Vonage via the Messages API onboarding flow, and associate a number with the WABA account. Find the instructions for:
- the direct customers: Getting Started with Vonage's WhatsApp Business API: New V4 Embedded Sign-Up flow
- the Vonage partners onboarding end customers: Getting started with Vonage's WhatsApp Business Account: Hosted Embedded Sign-Up for Partners' End Customers
Note: If you are already using WhatsApp with the Vonage Messages API, confirm if the above account association steps are already complete.
Request Meta Vetting and Voice Provisioning
To request Voice activation for your number and preferred region, either contact your Vonage Account Manager or create a Vonage support ticket.
Note: Meta vetting only applies to new numbers or new customers being onboarded to WhatsApp for the first time. If you're an existing customer already using the number with the Messages API, it has already been vetted by Meta. You only need Vonage to complete the Voice provisioning step below, no re-vetting required.
Vonage then submits a request to Meta, if needed, and provisions Voice on the number:
| Step | Action | Owner |
|---|---|---|
| 1 | Customer requests Vonage to activate Voice for their number in preferred region (Americas /EMEA/ APAC) | Customer > Vonage |
| 2 | Vonage requests Meta to vet the number, if not already vetted (new numbers/customers only) | Vonage > Meta |
| 3 | Vonage provisions Voice on the number in the system for the desired region | Vonage |
Request User Consent (Outbound Calls Only)
Note: This step is required for outbound (Business Initiated) calls only. Skip it if you only need to receive inbound calls. Inbound calls don’t require prior consent.
Meta requires that before a business can initiate an outbound WhatsApp call, the end user must explicitly grant consent. This consent is obtained via a call_permission_request message sent through the Vonage Messages API. To see the consent flow, see the WhatsApp Business Calling conceptual guide.
Messages API Request: Send Call Permission Request
POST https://api.nexmo.com/v1/messages
Authorization: Bearer <JWT>
Content-Type: application/json
{
"to": "<whatsapp_user_number_e164>",
"from": "<your_waba_number>",
"channel": "whatsapp",
"message_type": "custom",
"custom": {
"type": "call_permission_request"
}
}
Important: The call_permission_request message type requires that WhatsApp Cloud API calling is enabled on the WABA phone number. This is provisioned by Vonage in the Request Meta Vetting and Voice Provisioning step.
Attempting to send this message before voice is enabled will result in the error: Calling not enabled: WhatsApp Cloud API calling not enabled for this phone number.
Using a Template Message (Alternative)
You can also send the call permission request as a pre-approved WhatsApp template message, using the WhatsApp Template Management API and the Messages API Custom Objects. Follow these high-level steps:
- Create a WhatsApp message template for the call permission request. The template must include a component with
"type": "call_permission_request". See Meta's Call Permission Request documentation for details on this component type. - Define any additional components you want to include in the template.
- Send the template using the Messages API via the
whatsappchannel withmessage_type: "template". See a complete template message example.
Note: When using a template, do not add "type": "call_permission_request" as a separate field. The template type is already defined within the template itself.
Create a Vonage Application
Steps
-
Create a Vonage Application in the Vonage Customer Dashboard (If you haven't done that before).
-
Configure the application with:
- Answer URL - webhook endpoint to receive inbound call events (NCCO response)
- Event URL - webhook endpoint to receive call status events
-
Navigate to the application configuration > Link External Account tab (same as for WhatsApp Messaging).
-
Link the desired WABA number to the Voice API application.
Make and Receive Calls
With your application set up and consent obtained for outbound calls, you can now make and receive WhatsApp calls.
Note: The from field behaves differently depending on the context. In the REST API (POST /v1/calls), from is an object with type and number because the API needs to know the endpoint type. In an NCCO connect action, from is a plain string (E.164 number). The endpoint type is already declared inside endpoint[].type.
Make an Outbound Call
Outbound Call: REST API
Initiate an outbound WhatsApp call after completing the Request User Consent (Outbound Calls Only) step.
POST https://api.nexmo.com/v1/calls
Authorization: Bearer <JWT>
Content-Type: application/json
{
"to": [
{
"type": "whatsapp",
"number": "447700900001"
}
],
"from": {
"type": "whatsapp",
"number": "447700900000"
},
"answer_url": ["https://example.com/answer"]
}
Parameters
| Parameter | Type | Description |
|---|---|---|
to[].type |
enum | Set to "whatsapp" to route the call over WhatsApp |
to[].number |
string | The WhatsApp user's phone number in E.164 format |
from.type |
enum | Set to "whatsapp" |
from.number |
string | Your WABA phone number in E.164 format |
NCCO Connect Action: Outbound to WhatsApp
Use the connect NCCO action to connect a call leg to a WhatsApp endpoint:
{
"action": "connect",
"eventUrl": ["https://example.com/event"],
"from": "447700900000",
"endpoint": [
{
"type": "whatsapp",
"number": "447700900001"
}
]
}
Receive an Inbound Call
Answer Webhook (Inbound Call)
When a WhatsApp user calls your WABA number, Vonage sends an Answer Webhook to your configured Answer URL. The payload includes endpoint_type: "whatsapp" to identify the call channel.
{
"from": "447700900001",
"to": "447700900000",
"endpoint_type": "whatsapp",
"region_url": "https://api-eu-2.nexmo.com",
"uuid": "aaaaaaaa-bbbb-cccc-dddd-0123456789ab",
"conversation_uuid": "CON-aaaaaaaa-bbbb-cccc-dddd-0123456789ab"
}
Supported endpoint_type values: phone, sip, websocket, app, whatsapp, vbc.
Event Webhook
Event webhooks for whatsapp calls behave the same as for any other call. See the Webhook Reference for each event's payload.
Troubleshooting
| Error Message | Cause | Resolution |
|---|---|---|
| "Calling not enabled: WhatsApp Cloud API calling not enabled for this phone number." | Voice calling has not been provisioned for the WABA number | Complete Request Meta Vetting and Voice Provisioning before sending call_permission_request. |
| "Parameter name is missing or empty" | Call permission request template message sent with named parameter format but parameter name field is missing | Ensure parameter_name is included for each template parameter. |
| Outbound call fails silently | User consent not obtained or expired. | Re-send call_permission_request and confirm the user has granted consent before retrying the call. |