Skip to content

WhatsApp templates

WhatsApp templates are used if your company needs to reach customers first or if you need to reply after the 24-hour window .

The templates are the only way how to send a message to your customers after the 24-hour window is exceeded.

You will need a customer’s phone number and a registered WhatsApp template.

The WhatsApp template contains placeholders that are enclosed in double curly braces - {{, }}. The placeholders in the following template are name and date:

Hello {{name}}! You can expect the delivery {{date}}.

The response will contain interpolated content that was created by replacing placeholders with substitutions. Since templates are localized, you will always receive only the content of the default language.

The registered template in the example is:

Welcome to Amio, {{name}}! We are ready to help you succeed with messaging. 🚀

wa-templates-text-min.png

POST https://api.amio.io/v1/messages

The registered template in the example is:

Welcome to Amio, {{name}}! We are ready to help you succeed with messaging. 🚀

Request body

Parameter Type Required Description
channel object
channel.id string yes Id of the channel you wish to send the message to.
contact object
contact.phone_number string yes Phone number of the contact.
message_template object
message_template.id string yes ID of a template that will be used. At the moment, ask us for the ID at support@amio.io .
message_template.substitution object
message_template.substitution.localizations object
message_template.substitution.localizations. {{locale_or_default}} object yes Keys are placeholders from the template with their values that will be replaced in the template.
message_template.localizations object yes Keys are locales and default. Currently we support only default which must always be provided.

Example request

{
"channel": {
"id": "6456078759331238786"
},
"contact": {
"phone_number": "+1-555-857-6309"
},
"message_template": {
"id": "4726078759445238153",
"substitution": {
"localizations": {
"default": {
"name": "Albert"
}
}
}
}
}

Response 201

{
"id": "6456078996108088196",
"channel": {
"id": "6456078759331238786",
"type": "whatsapp"
},
"contact": {
"id": "6456078781510718339",
"phone_number": "15558576309",
"platform_id": "15558576309"
},
"content": {
"type": "text",
"payload": "Welcome to Amio, Albert! We are ready to help you succeed with messaging. 🚀"
}
}