Skip to contentSkip to navigationSkip to topbar
On this pageProducts used

Registering WhatsApp Senders via API


This guide explains how to use the Twilio Senders API to register a phone number on the WhatsApp Business Platform (Twilio calls this a WhatsApp Sender) to begin sending and receiving messages on WhatsApp using the Twilio APIs.

(information)

Info

If your use case does not require registering several WhatsApp Senders, then Twilio highly recommends using WhatsApp Self Sign-up in the Twilio Console to register your WhatsApp Senders rather than via the Senders API.

(warning)

Public Beta

The Twilio Senders API is currently available as a Public Beta product. This means that some features (including Twilio SDK support) for configuring your WhatsApp Sender via the REST API are not yet implemented, and others may be changed without notice before the product is declared Generally Available. Managing your WhatsApp Senders through the Twilio Console(link takes you to an external page) is Generally Available.

Public Beta products are not covered by a Twilio SLA(link takes you to an external page).

The resources for sending and receiving Messages with a WhatsApp Sender are Generally Available.

Meta requires all phone numbers registered on WhatsApp to have their ownership verified as a part of the registration process before they can send and receive messages. This is done by sending a verification code via either SMS or an automated voice call. If using a Twilio Phone Number with SMS capability, then Twilio will do this automatically as a part of the registration process outline below.


Before you get started

before-you-get-started page anchor
  1. Note that Meta limits the number of WhatsApp Senders you may have in a single WhatsApp Business Account (WABA), and as a result, Twilio account or subaccount. (Twilio only supports a single WABA per unique ASID.) As a result, onboard numbers one by one, waiting until each one successfully returns an ONLINE status before moving to the next one.
  2. If you are not using the WhatsApp Tech Provider Program to onboard customers as an ISV, you must first register a number using WhatsApp Self Sign-up in the Twilio Console.
  3. Delete any numbers already registered on WhatsApp though either the business app or consumer app. Learn how to delete your WhatsApp account(link takes you to an external page).
  4. If using a Twilio Voice or non-Twilio phone number (BYON), make sure it is not associated with an IVR system (interactive voice response) or any computer-operated phone system that prohibits receiving an verification code via SMS or voice call.
  5. Choose a display name carefully, as it must strictly follow Meta's display name guidelines(link takes you to an external page).
(warning)

Display name changes are manual

There is no API to change the display name (i.e. profile.name property in the Senders API). Meta reviews display name asynchronously after the WhatsApp Sender is registered. Before registering WhatsApp Senders in bulk, verify the display name is not rejected by Meta with a single WhatsApp Sender before continuing. If the display name is rejected by WhatsApp, the phone number's messaging limit will drop to 250 business-initiated messages per 24-hour period and may risk disconnection by WhatsApp. Resolving this requires submitting a support ticket to Twilio.


Quick start guide using cURL

quick-start-guide-using-curl page anchor

1. Choose a phone number

1-choose-a-phone-number page anchor

You may purchase a Twilio number using our Phone Number APIs, or bring your own non-Twilio phone number (BYON). We recommend using a Twilio Phone Number that has SMS capabilities, as then Twilio will do the verification step automatically for you.

If using a Twilio Voice-only phone number, you will need to configure it to make sure you can receive the verification code, before moving on to the next step.

See our support article Which Twilio Phone Numbers are Compatible with WhatsApp?(link takes you to an external page) for more information.

2. Create the WhatsApp Sender and trigger the verification code

2-create-the-whatsapp-sender-and-trigger-the-verification-code page anchor

Run the following cURL command, substituting the following required information:

  • your phone number (in e.164 format) within the sender_id field
    • For AR (+54) and MX (+52) numbers, WhatsApp requires the format "+549" and "+521", respectively.
  • your WhatsApp Sender's display name (profile.name)
  • Twilio Account SID
  • Twilio Auth Token

You may optionally include the following additional information:

  • additional profile details that will be displayed publicly to end-users
  • webhooks that Twilio will use to send inbound messages (webhooks.callbackUrl and webhooks.fallbackUrl) and outbound message status updates (webhooks.statusCallbackUrl)

This will create your WhatsApp sender in Twilio's system, add it to the WABA connected to your Twilio account, and trigger the verification code from Meta.

Make a note of the WhatsApp Sender's SID (starting with an XE), as you will need it in the next step.

Verification via SMSVerification via Voice
1
## Create Sender
2
curl -X "POST" "https://messaging.twilio.com/v2/Channels/Senders" \
3
-H "Content-Type: application/json; charset=utf-8" \
4
-u "$TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN" \
5
-d $'{
6
"sender_id": "whatsapp:+15017122661",
7
"profile": {
8
"address": "101 Spear Street, San Francisco, CA",
9
"emails": [
10
"support@twilio.com"
11
],
12
"vertical": "Other",
13
"logo_url": "https://www.twilio.com/logo.png",
14
"description": "We\'re excited to see what you build!",
15
"about": "Hello! We are Twilio.",
16
"name": "Twilio",
17
"websites": [
18
"https://twilio.com",
19
"https://help.twilio.com"
20
]
21
},
22
"webhook": {
23
"callback_method": "POST",
24
"callback_url": "https://demo.twilio.com/welcome/sms/reply/"
25
}
26
}'

Output

1
{
2
"status": "CREATING",
3
"sender_id": "whatsapp:+15017122661",
4
"sid": "XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
5
"configuration": {
6
"waba_id": "12345678912345"
7
},
8
"profile": {
9
"about": "Hello! This is Twilio's official account.",
10
"name": "Twilio",
11
"vertical": "Other",
12
"websites": [
13
{
14
"website": "https://twilio.com",
15
"label": "Website"
16
},
17
{
18
"website": "https://help.twilio.com",
19
"label": "Website"
20
}
21
],
22
"address": "101 Spear Street, San Francisco, CA",
23
"logo_url": "https://www.twilio.com/logo.png",
24
"emails": [
25
{
26
"email": "support@twilio.com",
27
"label": "Email"
28
}
29
],
30
"description": "We're excited to see what you build!"
31
},
32
"webhook": {
33
"callback_method": "POST",
34
"callback_url": "https://demo.twilio.com/welcome/sms/reply/"
35
},
36
"url": "https://messaging.twilio.com/v2/Channels/Senders/XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
37
"properties": null
38
}

3. Verify the WhatsApp Sender

3-verify-the-whatsapp-sender page anchor
(information)

This step is not required for Twilio SMS-capable phone numbers. You may skip it.

Once you receive the verification code, you must update your WhatsApp Sender with it by making the following cURL command substituing the code you received.

1
## Verify Sender
2
curl -X "POST" "https://messaging.twilio.com/v2/Channels/Senders/XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \
3
-H 'Content-Type: text/plain; charset=utf-8' \
4
-u "$TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN" \
5
-d '{
6
"configuration": {
7
"verification_code": "123456"
8
}
9
}'

Output

1
{
2
"sid": "XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
3
"sender_id": "whatsapp:+15558675310",
4
"status": "VERIFYING",
5
"profile": {
6
"about": "Hello! This is Twilio's official account.",
7
"name": "Twilio",
8
"vertical": "Other",
9
"websites": [
10
{
11
"website": "https://twilio.com",
12
"label": "Website"
13
},
14
{
15
"website": "https://help.twilio.com",
16
"label": "Website"
17
}
18
],
19
"address": "101 Spear Street, San Francisco, CA",
20
"logo_url": "https://www.twilio.com/logo.png",
21
"emails": [
22
{
23
"email": "support@twilio.com",
24
"label": "Email"
25
}
26
],
27
"description": "We're excited to see what you build!"
28
},
29
"webhook": {
30
"callback_method": "POST",
31
"callback_url": "https://demo.twilio.com/welcome/sms/reply/",
32
"fallback_method": "POST",
33
"fallback_url": "",
34
"status_callback_url": "",
35
"status_callback_method": "POST"
36
},
37
"url": "https://messaging.twilio.com/v2/Channels/Senders/XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
38
"configuration": {
39
"waba_id": "123456789"
40
},
41
"properties": {
42
"messaging_limit": "1K Customers/24hr",
43
"quality_rating": "HIGH"
44
}
45
}

4. Confirm the WhatsApp Sender is registered

4-confirm-the-whatsapp-sender-is-registered page anchor

In order to verify that the WhatsApp Sender was successfully registered, you will need to make the following request to fetch the WhatsApp Sender. In the response, check the status to make sure that it shows as ONLINE. If it still notes that it is PENDING_VERIFICATION then you will need to return to Step 2 in order to request another verification code.

(information)

Info

Note that a WhatsApp Sender may briefly show as OFFLINE when registering. If that happens, please wait a few minutes and fetch the WhatsApp Sender again. If it is still showing as OFFLINE then open a support ticket.

Once the WhatsApp Sender shows as ONLINE you may begin sending and receiving messages on WhatsApp using the Twilio APIs. Congrats!

What's Next?

Now that you have a WhatsApp Sender registered, here are some other must reads when building your WhatsApp integration using Twilio.

Last updated July 2024

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.