Send template message
API to send a WhatsApp templated message to recipient.
Last updated
API to send a WhatsApp templated message to recipient.
Last updated
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
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.
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.
Your template can have different language translations which is why you need to provide the language in the API call.
To see a list of available languages go to Meta's official documentation.
Your template must have a language translation approved before you can use it for that specific language.
In most cases, the default template language is `en`.
Please see Meta Business Manager for the available templates and language translations.
The language is specified in language
field. To see a list of available languages go to Meta's official documentation.
The template parameters is a list of objects in the following format:
name
keysHeader
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.
For supported media types please reference Meta's official documentation.
Body
body_1
- indicates text in the body
body_2
- indicates text in the body
body_3
- indicates text in the body
body_4
- indicates text in the body
body_5
- indicates text in the body
body_6
- indicates text in the body
body_7
- indicates text in the body
body_8
- indicates text in the body
body_9
- indicates text in the body
body_10
- indicates text in the body
body_11
- indicates text in the body
body_12
- indicates text in the body
body_13
- indicates text in the body
body_14
- indicates text in the body
body_15
- indicates text in the body
Buttons
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
The above payload will send a template where "Our Facebook" button will take the customer to www.facebook.com/connectlyai
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.
Note that to detect carousel button clicks and replies, you need to subscribe to our Webhook API.
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.
Please see the instructions here for instructions on how to create a WhatsApp message template.
To send a Carousel message, first you need to create the template using .
Assuming you want to send the same template created in , you can use the below payload structure:
API to send a WhatsApp templated message to recipient
/v1/businesses/{businessId}/send/whatsapp_templated_messages
Optional config to ensure event dispatching order.
Optional. Sender WhatsApp number, not required when only 1 WA number is present.
WhatsApp number for recipient.
WhatsApp template name, managed through WhatsApp Cloud API.
Optional. WhatsApp template language, managed through WhatsApp Cloud API.
Optional. Campaign name.