API to send a WhatsApp templated message to recipient.
This API requires an approved template. You can create a template using Create a template, which will then be automatically reviewed by Meta. Once approved, you can use it here to send messages.
WhatsApp template messages can be sent only to personal WhatsApp accounts not WhatsApp API accounts. If you are testing WhatsApp templated message API please use your personal WhatsApp phone number instead of your business phone number on Connectly.
Make sure your personal WhatsApp account you are using for testing has accepted all of WhatsApp app and privacy updates
post
API to send a WhatsApp templated message to recipient
Authorizations
X-API-KeystringRequired
API key for authorization
Path parameters
businessIdstringRequired
Body
senderstringOptional
Optional. Sender WhatsApp number, not required when only 1 WA number is present.
Example: +16501113333
numberstringOptional
WhatsApp number for recipient.
Example: +16502223333
templateNamestringOptional
WhatsApp template name, managed through WhatsApp Cloud API.
Example: bogo_marketing_campaign
languagestringOptional
Optional. WhatsApp template language, managed through WhatsApp Cloud API.
Example: en
campaignNamestringOptional
Optional. Campaign name.
Example: test_campaign_2022-03-12
Responses
200
A successful response.
application/json
201
Successful response containing id of created message.
If the recipient has not initiated the conversation first within the last 24 hours you MUST use templated message API /v1/businesses/{businessId}/send/whatsapp_templated_messages.
Generally, you use /v1/businesses/{businessId}/send/messages to reply to the customers who already messaged you first.
You use /v1/businesses/{businessId}/send/whatsapp_templated_messages to initiate with the customer first.
Select the WhatsApp number you want to send from
The endpoint supports an optional sender field in the body. If you have multiple WhatsApp phone numbers with Connectly you can choose which one you want to send the message from. The payload needs to contain the optional sender key specifying the phone number.
Template languages
Your template can have different language translations which is why you need to provide the language in the API call.
The template parameters is a list of objects in the following format:
Available options for name keys
Header
header_text - indicates text in the header. Works only if the header has any variables in it. Substitutes the variables with the specified text.
header_document - indicates document in the header. The value must be a valid URL with valid document. You can also specify how to name the file using filename parameter. See examples below.
button_1_url_suffix - indicates URL link in the button. The value must be a valid URL
button_2_url_suffix - indicates URL link in the button. The value must be a valid URL
button_3_url_suffix - indicates URL link in the button. The value must be a valid URL
Examples
You have a template with one header variable and several body variables
You have a template with a header image and multiple body variables
You have a template with a header document
You have a template with the link button and button has a suffix
The above payload will send a template where "Our Facebook" button will take the customer to www.facebook.com/connectlyai
You have a template with two quick reply buttons
If you have subscribed to Connectly Messaging Webhooks, whenever the customer presses a button the value (payload) that you specify will be sent through the webhook to indicate which button was pressed.
Sending a Carousel template message
To send a Carousel message, first you need to create the template using Carousel template.
Assuming you want to send the same template created in Carousel template, you can use the below payload structure:
Note that to detect carousel button clicks and replies, you need to subscribe to our Webhook API.
Rate Limiting
To ensure fair usage and maintain service stability, we have implemented rate limiting for above APIs. This endpoint is limited to 200 requests per second. If the limit is exceeded, the API will return a 429 Too Many Requests response.
WhatsApp Message template
Please see the instructions here for instructions on how to create a WhatsApp message template.