Twilio's WhatsApp Business API Page for Scalable Messaging

Author

Reads 1.3K

Whatsapp Application Screenshot
Credit: pexels.com, Whatsapp Application Screenshot

Twilio's WhatsApp Business API page is a game-changer for businesses looking to scale their messaging operations.

The page offers a free trial period, allowing businesses to test the API and its features without incurring any costs.

With Twilio's WhatsApp Business API, businesses can send and receive messages in bulk, making it ideal for large-scale operations.

This API also supports multiple messaging formats, including text, images, and videos, giving businesses the flexibility to convey their message in various ways.

For your interest: Twilio - Sms/mms-svr

Configuring Messaging

To configure messaging with Twilio's WhatsApp Business API, you need to set up a webhook URL in the WhatsApp Sandbox. This URL is used to send custom responses to incoming WhatsApp messages.

You can configure the webhook URL in the Twilio Console, specifically on the Sandbox page, the page for WhatsApp-enabled numbers, or under the "Integration" section of your settings for a specific Messaging Service.

To receive inbound messages, Twilio sends a webhook to your application, which you can configure using the steps mentioned above. This allows you to seamlessly use your existing SMS app with WhatsApp.

Here are the places where you can configure the inbound message webhooks:

  • Sandbox page
  • WhatsApp-enabled numbers page
  • Integration section of your settings for a specific Messaging Service

Request Parameters

Credit: youtube.com, Twilio Request Parameters - Twilio Tip #16

To send a WhatsApp message from your Twilio phone number, you'll need to provide some mandatory request parameters. These parameters are crucial for the message to be delivered successfully.

The From parameter is a string that represents the Twilio WhatsApp number you'll use to send the message. This number must be included in the request.

The Body parameter is also a string that holds the message you want to send. Make sure it's clear and concise, as it will be displayed to the recipient.

The To parameter is a string that represents the WhatsApp number you want to send the message to. It must be in the format "%2B [country code] [phone number]". Don't forget to include the "%2B" sign, which represents the plus (+) sign.

Here are the mandatory request parameters in a table:

Configuring Inbound Message Webhooks

To configure inbound message webhooks, you can specify a URL in the Twilio Console. This URL is where Twilio sends a webhook when it receives an inbound message. You can find this URL under the "Integration" section of your settings for a specific Messaging Service.

Credit: youtube.com, How to Add Webhook in Twilio [2025 Guide]

The webhook URL is used to send custom responses to incoming WhatsApp messages. To configure this URL, you'll need to paste it against the "WHEN A MESSAGE COMES IN" field in the WhatsApp Sandbox. This field is also known as the inbound URL.

Twilio sends a webhook to your application when customers send you a WhatsApp message. You can configure the URL to which Twilio sends this webhook in the Twilio Console. This can be done on the Sandbox page, on the page for WhatsApp-enabled numbers, or under the "Integration" section of your settings for a specific Messaging Service.

To get started, press the "Run" button in the widget to start the server. This will allow you to see an output similar to 'Express server listening on port 3000' in the terminal, indicating that the server has started.

Consider reading: Api Whatsapp Com Send Phone

Configuring Fallback URLs for Senders

Configuring Fallback URLs for Senders can be a lifesaver in case of a fatal error. You can configure a Fallback URL in the same place that you set your default webhook URL.

Credit: youtube.com, Whatsapp bulk action - failure messages automatic fallback to SMS

Twilio will "fall back" to this secondary fallback URL if a fatal error occurs while making a request to your primary webhook URL. This ensures that you don't miss any important messages.

The request to your fallback URL will include the ErrorCode and ErrorUrl parameters, indicating the error code of the failure and the URL for which the failure occurred.

Expand your knowledge: Twilio 30003

Responding to Incoming Messages with TwiML

TwiML (Twilio Markup Language) allows you to seamlessly use your existing SMS app with WhatsApp. For more information, check out Documentation on How to Use TwiML.

You can use TwiML to respond to incoming WhatsApp messages by specifying actions in the Endpoint configuration section of your WhatsApp Sender's Configuration page. This includes setting what action Twilio should take when it receives a WhatsApp message at this number.

To configure TwiML for your WhatsApp-enabled Senders, you need to specify the URL to which Twilio sends a webhook when it receives inbound messages. This can be done on the Sandbox page, the page for WhatsApp-enabled numbers, or under the "Integration" section of your settings for a specific Messaging Service.

TwiML is fully supported by WhatsApp incoming messages, making it easy to integrate with your existing SMS app.

Sending a Freeform Message

Woman typing on a laptop using a messaging app in a home setting, close-up of hands.
Credit: pexels.com, Woman typing on a laptop using a messaging app in a home setting, close-up of hands.

With Twilio's WhatsApp Business API, you can send freeform messages to customers within a WhatsApp session.

Freeform messages can include text, media, and certain rich messages created with Content Templates.

To send a freeform message, you'll need to use the Programmable Messaging API.

This API allows you to create custom messages that can be tailored to your business needs.

You can include various types of media, such as images, videos, or audio files, in your freeform messages.

Rich messages created with Content Templates can also be sent using the Programmable Messaging API.

Managing Messages

You can configure a WhatsApp Sender as part of a Messaging Service or with an individual webhook URL.

The Endpoint configuration section allows you to specify what action Twilio should take when it receives a WhatsApp message at this number.

You can use a WhatsApp-enabled Twilio number as a WhatsApp Sender once it has been enabled for WhatsApp.

These numbers can be registered directly in the Twilio Console or requested through Twilio's Operations team for ISVs following the WhatsApp Tech Provider Program.

As of January 2023, WhatsApp has imposed new limitations on phone numbers and WABAs, including phone number limits applied across all WABAs per single Meta Business Manager and WABA limits.

Most businesses that onboarded prior to January 2023, and those with higher limits previously, are exempt from these limitations.

Additional reading: Twilio Test Numbers

Phone Numbers and Integration

Credit: youtube.com, Getting Started with the Twilio API for WhatsApp

Managing phone numbers for Twilio's WhatsApp Business API is a crucial step in setting up your account. You can register new numbers for WhatsApp directly in the Twilio Console by following the Self-Signup Guide for WhatsApp.

As of January 2023, WhatsApp has imposed new limitations on phone numbers and WhatsApp Business Accounts (WABAs). Phone number limits are applied across all WABAs per single Meta Business Manager, and WABA limits have also been introduced.

Most businesses that onboarded prior to January 2023 are exempt from these limitations. WhatsApp reserves the right to restrict numbers and WABAs for any reason, including evidence of scams or severe spam on an account.

To use a phone number with Twilio's WhatsApp Business API, you'll need to create a free account on Twilio and purchase a new phone number. Twilio will advise you on a phone number based on your geographical location.

You can select a number from any country, as long as it's enabled for sending and receiving text messages. If you have no special preferences, you can confirm the number suggested by Twilio by clicking on "Choose this number."

Credit: youtube.com, How to Buy a Twilio Number for WhatsApp API Verification (Step-by-Step Tutorial)

To request a WhatsApp Business API access, you'll need to fill out Twilio's request form, which includes information such as the purpose of use and your Twilio SID. You'll also need to provide your account ID on Facebook Business Manager.

Once you've submitted the form, the Twilio team will contact you within 10 working days with the outcome of your request. If approved, you can proceed with setting up your WhatsApp number and configuring your sender.

Here's a summary of the steps to request a WhatsApp Business API access:

  • Create a free account on Twilio and purchase a new phone number
  • Fill out Twilio's request form with required information
  • Wait for the Twilio team to contact you with the outcome of your request
  • Set up your WhatsApp number and configure your sender if approved

Engagement and Expansion

You can expand your global reach by integrating a WhatsApp Business API, which allows you to engage customers on WhatsApp, the world's most popular messaging app.

With the WhatsApp Business Platform and Twilio Messaging APIs, you can build for any use case across the customer journey, including support, notifications, verifications, and personalized promotions.

You can start connecting with customers on WhatsApp with pay-as-you-go, conversation-based pricing through Twilio.

This pricing model is flexible and allows you to scale your WhatsApp engagement solution as your business grows.

Enabling and Monitoring

Credit: youtube.com, How to Use Twilio WhatsApp Sandbox to Send and Receive Messages Using Twilio WhatsApp Number?

To enable WhatsApp on your Twilio number, you must follow the Self-Signup Guide for WhatsApp. This guide will walk you through the process step by step.

You can also enable WhatsApp on behalf of a third party, such as one of your clients, if you're an Independent Software Vendor (ISV). In this case, you should follow the WhatsApp Tech Provider Program guide.

To monitor the status of your WhatsApp outbound message, you can set a Status Callback URL. This will allow you to receive real-time status updates for your messages.

You can set the Status Callback URL in the Console, or when you send an individual outbound message, by including the StatusCallback parameter.

Here are the different parts of the Twilio Console where you can set the Status Callback URL:

  • For the WhatsApp Sandbox or an individual WhatsApp Sender - read WhatsApp and other messaging channels for additional properties that Twilio sends to your callback URL
  • For a Messaging Service (under the Integration settings for a specific Messaging Service) - read the status callback with a Messaging service guide for configuration options

Enabling

To enable WhatsApp messaging in your production apps, you must first enable WhatsApp on your Twilio number. This process is simplified through Twilio, one of WhatsApp's main partners for the supply of WhatsApp Business API.

Group of professionals discussing business strategies around a table with documents and laptops.
Credit: pexels.com, Group of professionals discussing business strategies around a table with documents and laptops.

You can create a free account on Twilio to get started, which also gives you a $15 bonus credit to purchase a new phone number and test the platform. To do this, simply click on the link to create an account.

Once you've created an account, you'll need to purchase a new phone number by clicking on "Get a trial number" in the Twilio Dashboard. Twilio will suggest a number based on your geographical location, but you can also search for a different number if needed.

To request access to the WhatsApp Business API via Twilio, you'll need to fill out a request form, which includes information such as the purpose of use for which the request is being made (customer support or notifications). You'll also need to provide your Twilio SID and Facebook Business Manager account ID.

Here's a step-by-step guide to requesting access to the WhatsApp Business API via Twilio:

1. Create a free account on Twilio and purchase a new phone number.

2. Fill out the request form to access the WhatsApp Business API.

3. Provide your Twilio SID and Facebook Business Manager account ID.

4. Submit the form and wait for the Twilio team to contact you within 10 working days with the outcome of your request.

Once you've received approval, you can proceed with the setup of your WhatsApp number by selecting a "Sender" number for sending and receiving messages.

Consider reading: Whatsapp Business Manager

Using API

Credit: youtube.com, API Monitoring | The Exploratory

Using the API to enable and monitor WhatsApp Business is a crucial step in getting started. To gain access to WhatsApp's API, you'll need to create a free account on Twilio, which will also give you a $15 bonus credit to test the platform.

You can then purchase a new phone number from Twilio, which will be used to send and receive text messages. This phone number must be enabled for sending and receiving text messages, and you can select a number from any country that meets this requirement.

To request access to WhatsApp Business API, you'll need to fill out Twilio's request form, which will ask for information such as the purpose of use and your account ID on Facebook Business Manager. You'll also need to provide your Twilio SID, which can be found in your account dashboard.

Once your request is submitted, the Twilio team will contact you within 10 working days to let you know the outcome. If your request is approved, you can then proceed with the setup of your WhatsApp number.

See what others are reading: Do We Need to Pay for Whatsapp Business

Credit: youtube.com, Mastering API Endpoint Monitoring!

To send custom responses to incoming WhatsApp messages, you'll need to configure a webhook URL in the WhatsApp Sandbox. This URL will be used to send TwiML instructions that define how to respond to incoming messages.

Here's a step-by-step guide to setting up a webhook URL:

  1. Press the “Run” button in the following widget to start the server.
  2. When we see an output similar to 'Express server listening on port 3000' in the terminal, it means that the server has started.
  3. Send a WhatsApp message to our Twilio phone number.
  4. After a while, we’ll receive a customized reply from our Twilio number containing the text we set up in the following widget in lines 12–20.

With your WhatsApp Business API set up, you can start sending freeform messages using the Programmable Messaging API. This allows you to send messages that include text, media, and certain rich messages created with Content Templates.

Monitor Outbound Message Status

Monitoring outbound message status is a crucial aspect of ensuring seamless communication with your customers. You can set a Status Callback URL to receive real-time status updates for outbound messages.

Twilio sends a request to this URL each time your message status changes, and you can set it in the Console or when sending an individual outbound message. For WhatsApp, you can set the status callback URL in the WhatsApp Sandbox or an individual WhatsApp Sender.

Crop faceless male manager in formal wear sitting on marble bench and messaging on mobile phone during coffee break
Credit: pexels.com, Crop faceless male manager in formal wear sitting on marble bench and messaging on mobile phone during coffee break

To set the status callback URL, you can include the StatusCallback parameter when sending an individual outbound message. Alternatively, you can set it in the Integration settings for a specific Messaging Service under the Messaging Service guide.

Twilio sends a POST request to the callback URL, including the message sid and other standard request parameters. You can refer to the API Reference for the Message Resource for a list of parameters that Twilio sends to your callback URL.

Here are the different parts of the Twilio Console where you can set the status callback URL:

  • WhatsApp Sandbox
  • Individual WhatsApp Sender
  • Messaging Service (under Integration settings)

Frequently Asked Questions

How to access the WhatsApp business API?

To access the WhatsApp Business API, you need to apply through a WhatsApp Business Solution Provider (BSP) and follow a verification process. This involves setting up a WhatsApp Business Account and linking it to a phone number.

Is Twilio WhatsApp free?

Twilio charges a per-message fee for WhatsApp, so it's not entirely free. The fee is $0.005 for both incoming and outgoing messages.

Is the WhatsApp business API free?

No, the WhatsApp Business API is not entirely free, as it involves various costs beyond the API itself. While WhatsApp doesn't charge for the API, other fees apply.

Claire Beier

Senior Writer

Claire Beier is a seasoned writer with a passion for creating informative and engaging content. With a keen eye for detail and a talent for simplifying complex concepts, Claire has established herself as a go-to expert in the field of web development. Her articles on HTML elements have been widely praised for their clarity and accessibility.

Love What You Read? Stay Updated!

Join our community for insights, tips, and more.