Send template message

API to send a WhatsApp templated message to recipient
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 WhatsApps app and privacy updates
post
/v1/businesses/{businessId}/send/whatsapp_templated_messages

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.
{
"sender": "+14151111234",
"number": "+1(604) 585 2331",
"templateName": "tempalte",
"language": "en",
"parameters": []
}

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.
{
"sender": "+14151111234",
"number": "+1(604) 585 2331",
"templateName": "tempalte",
"language": "en",
"parameters": []
}

Template languages

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.

How to use template parameters

The template parameters is a list of objects in the following format:
"parameters": [
{
"name": "body_1",
"value": "YOUR_VALUE"
}, {
"name": "body_2",
"value": "YOUR_VALUE"
}, {
"name": "body_3",
"value": "YOUR_VALUE"
]

Available options for name keys

Header
  1. 1.
    header_text - indicates text in the header. Works only if the header has any variables in it. Substitutes the variables with the specified text.
  2. 2.
    header_image - indicates image in the header. The value must be a valid URL with an image.
  3. 3.
    (Not available on WhatsApp Cloud API yet) header_video - indicates video in the header. The value must be a valid URL with a video.
Body
  1. 1.
    body_1 - indicates text in the body
  2. 2.
    body_2 - indicates text in the body
  3. 3.
    body_3 - indicates text in the body
  4. 4.
    body_4 - indicates text in the body
  5. 5.
    body_5 - indicates text in the body
  6. 6.
    body_6 - indicates text in the body
  7. 7.
    body_7 - indicates text in the body
  8. 8.
    body_8 - indicates text in the body
  9. 9.
    body_9 - indicates text in the body
  10. 10.
    body_10 - indicates text in the body
  11. 11.
    body_11 - indicates text in the body
  12. 12.
    body_12 - indicates text in the body
  13. 13.
    body_13 - indicates text in the body
  14. 14.
    body_14 - indicates text in the body
  15. 15.
    body_15 - indicates text in the body
Buttons
  1. 1.
    button_1_url_suffix - indicates URL link in the button. The value must be a valid URL
  2. 2.
    button_2_url_suffix - indicates URL link in the button. The value must be a valid URL
  3. 3.
    button_3_url_suffix - indicates URL link in the button. The value must be a valid URL
  4. 4.
    button_1_payload - indicates Payload in the button
  5. 5.
    button_2_payload - indicates Payload in the button
  6. 6.
    button_3_payload - indicates Payload in the button

Examples

You have a template with one header variable and several body variables

{
"number": "16044441234",
"templateName": "my_template_name",
"language": "en",
"parameters": [
{
"name": "header_text",
"value": "Hello"
},
{
"name": "body_1",
"value": "John"
},
{
"name": "body_2",
"value": "red"
}
]
}

You have a template with a header image and multiple body variables

{
"number": "16044441234",
"templateName": "external_header_test2",
"language": "en",
"parameters": [
{
"name": "header_image",
"value": "https://i.picsum.photos/id/695/200/300"
},
{
"name": "body_1",
"value": "Connectly.ai"
},
{
"name": "body_2",
"value": "John"
}
{
"name": "body_3",
"value": "a new party"
},
{
"name": "body_4",
"value": "McDonald's"
},
{
"name": "body_5",
"value": "celebrate lol"
}
]
}

You have a template with two quick reply buttons

The value in the quick reply parameter DOES NOT change the button text. The button text is specified at the template creation time only. The value is used to indicate which button the customer pressed.
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.
{
"number": "16044441234",
"templateName": "my_template_name",
"language": "en",
"parameters": [
{
"name": "button_1_payload",
"value": "yes_pressed"
},
{
"name": "button_2_payload",
"value": "no_pressed"
}
]
}

WhatsApp Message template

Please see the instructions here for instructions on how to create a WhatsApp message template.