WhatsApp Transactional
Learn how to integrate WhatsApp Transactional into your application
WhatsApp allows you to stay connected with your customers. Reach out through the world's biggest messaging platform. WhatsApp APIs allow you to:
- Programatically define campaigns and templates.
- Broadcast marketing messages to all your contacts.
- Fetch statistics for your campaigns.
- Manage the sending of transactional messages and campaigns.
Activating WhatsApp
- You need to log in to your Brevo Account.
- At the top navigation bar, you can find all the applications enabled on your account.
- Choose
Add more apps
and you will find Apps and Integration. - Under Apps, scroll down and enable the WhatsApp feature.
- You will find WhatsApp activated in your Brevo dashboard.
After activating WhatsApp, you have to sign up for Facebook and WhatsApp business accounts. You can refer to the help articles in the Brevo resources regarding the WhatsApp onboarding at Whatsapp and SMS > Getting started with WhatsApp campaigns in Brevo.
Introduction
WhatsApp Transactional helps you send one time messages to your customers seamlessly, such as order confirmations, status updates or password reset links. You can check out the API reference for WhatsApp Transactional at API Reference > WhatsApp.
Requirements
To create and manage your WhatsApp messages you need to have access to the Brevo WhatsApp platform. If you have not already activated the WhatsApp platform on your account you can go to WhatsApp Campaigns > Activating WhatsApp Campaigns.
Send WhatsApp message
The endpoint used here is https://api.brevo.com/v3/whatsapp/sendMessage
with the method POST
. This endpoint will send a message to the recipient through WhatsApp. You have to use a templateId
for the first message that you send through the endpoint. For creating a template:
- You can go to your Brevo account in the WhatsApp campaigns dashboard.
- Then you choose
Create a campaign
in the top right corner of the page. - Once your campaign is created you can use the endpoint
https://api.brevo.com/v3/whatsappCampaigns/template-list
to fetch thetemplateId
you want to use for sending.
Note : WhatsApp Template Listing page is in progress and will be live soon.
You can find the API reference for this endpoint at WhatsApp> Send WhatsApp message.The cURL request for this endpoint is as the following.
curl --request POST \
--url https://api.brevo.com/v3/whatsapp/sendMessage \
--header 'accept: application/json' \
--header 'api-key: ' \
--header 'content-type: application/json' \
--data '
{
"contactNumbers": [
"4915778559164"
],
"templateId": 465118589032810,
"senderNumber": "917878172050"
}
You have to input your contact numbers without characters and spaces. You can get the templateId
from the Brevo account. You can navigate to Campaigns > WhatsApp in your Brevo account to find your template id in the table. The attributes for this endpoint are:
Send WhatsApp message template attributes
Attribute | Datatype | Description | Value |
---|---|---|---|
templateId | Integer | ID of the template to send | 123 |
senderNumber | String | WhatsApp Number with country code. Example, 85264318721 | 917887042050 |
contactNumbers | Array of strings | List of phone numbers of the contacts | 910987043450 |
Send WhatsApp message text attributes
Attribute | Datatype | Description | Value |
---|---|---|---|
senderNumber | String | WhatsApp Number with country code. Example, 85264318721 | WhatsApp Number with country code. Example, 85264318721 |
text | String | Text to be sent as message body (will be used if templateId not passed) | Hi! There i am a message. |
contactNumbers | Array of strings | List of phone numbers of the contacts | 910987043450 |
Responses
Response code | Message | Description |
---|---|---|
201 | Successfully created | Request succeeds with this response code and message id is displayed. |
400 | Bad request | Request has not succeeded due to errors like incorrect parameters etc. |
Get all your WhatsApp activity (Unaggregated events)
You can use the endpoint https://api.brevo.com/v3/whatsapp/statistics/events
for this API call with the GET
method. You can see the unaggregated events for the Whatsapp activity in the past 30 days by default until and unless the startDate and endDate are not passed.
Attribute | Datatype | Description |
---|---|---|
limit | Int64 | Number limitation for the result returned. |
offset | Int64 | Beginning point in the list to retrieve from. |
startDate | String | Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate. |
endDate | String | Mandatory if startDate is used. Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate |
days | Int64 | Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' |
contactNumber | String | Filter results for specific contact (WhatsApp Number with country code. Example, 85264318721) |
event | String | Filter the report for a specific event type |
sort | String | Sort the results in the ascending/descending order of record creation. Default order is descending if sort is not passed |
Responses
Response code | Message | Description |
---|---|---|
200 | Whatsapp event report informations | Request succeeds, all events are displayed that have happened in the timespan. |
400 | Bad request | Request fails due to incorrect parameters or HTTP routing errors. |
Updated 7 months ago