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

  1. You need to log in to your Brevo Account.
  2. At the top navigation bar, you can find all the applications enabled on your account.
  3. Choose Add more apps and you will find Apps and Integration.
  4. Under Apps, scroll down and enable the WhatsApp feature.
  5. 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 the templateId 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

AttributeDatatypeDescriptionValue
templateIdIntegerID of the template to send123
senderNumberStringWhatsApp Number with country code. Example, 85264318721917887042050
contactNumbersArray of stringsList of phone numbers of the contacts910987043450

Send WhatsApp message text attributes

AttributeDatatypeDescriptionValue
senderNumberStringWhatsApp Number with country code. Example, 85264318721WhatsApp Number with country code. Example, 85264318721
textStringText to be sent as message body (will be used if templateId not passed)Hi! There i am a message.
contactNumbersArray of stringsList of phone numbers of the contacts910987043450

Responses

Response codeMessageDescription
201Successfully createdRequest succeeds with this response code and message id is displayed.
400Bad requestRequest 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.

AttributeDatatypeDescription
limitInt64Number limitation for the result returned.
offsetInt64Beginning point in the list to retrieve from.
startDateStringMandatory if endDate is used. Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate.
endDateStringMandatory if startDate is used. Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate
daysInt64Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate'
contactNumberStringFilter results for specific contact (WhatsApp Number with country code. Example, 85264318721)
eventStringFilter the report for a specific event type
sortStringSort the results in the ascending/descending order of record creation. Default order is descending if sort is not passed

Responses

Response codeMessageDescription
200Whatsapp event report informationsRequest succeeds, all events are displayed that have happened in the timespan.
400Bad requestRequest fails due to incorrect parameters or HTTP routing errors.