Whatsapp icon integrated with an authentication API, showcased on a green square.

Channel | WhatsApp Business

With more than 2 billion people using WhatsApp around the world to send 60 billion messages every day, the chat app has revolutionized the way we communicate. With an enterprise-grade API, companies can now send notifications and provide customer service through WhatsApp in a secure, reliable, and customer-friendly way.

Send a Message Template

This short tutorial will show you how to send a WhatsApp message with variables.

Dynamic variables – also known as placeholders, parameters, or substitutions – allow you to pass dynamic contents to the message. While requesting message templates, you can specify the dynamic variable like {{1}}, {{2}}. By adding unique parameters, you can personalize information for your customers. 

For example, in the template below, you can replace {{1}} and {{2}] with your value when sending a message.

You purchased {{1}} using a credit card ending in {{2}}.

To input actual variables into a Message Template, you’ll need to send parameter values instead of sending the entire message.

For the following example Message Template:

Hi {{1}}! Thanks for placing an order at FabShoes. Your order {{2}}, for a total of EUR {{3}}, is confirmed. The expected delivery is {{4}}.

You’ll need to send the following example request:

curl –XPOST https://api.tyntec.com/conversations/v3/messages\
  -H 'Content-Type: application/json' \
  -H 'apikey: <API KEY>' \
-d '{
  "from": "{{whatsAppBusinessNumber}}",
  "to": "{{receiverPhoneNumber}}",
  "channel": "whatsapp",
  "content": {   
    "contentType": "template",
    "template": {
        "templateId" : "order_confirmation",
        "templateLanguage" : "en",
        "components" : {
            "body" : [
                    {
                        "type": "text",
                        "text": "Ben"
                    },
                    {
                        "type": "text",
                        "text": "2019-0000001"
                    },
                    {
                        "type": "text",
                        "text": "600.00"
                    },
                    {
                        "type": "text",
                        "text": "2019-06-01"
                    }
            ]           
        }
   }
  }
}'

If your request has been successful, the response will be similar to this:

{
  "messageId": "77185196-664a-43ec-b14a-fe97036c697f",
  "acceptedAt": "2019-05-17T09:45:00Z"
}