The layout is a JSON with the necessary information to send the messages.
The variables should be enclosed in double curly braces (ex: {{variable}}).
Important: Variable names can only contain letters, numbers, dots (.) and underscores (_). Spaces or special characters are not allowed inside variable placeholders (e.g. {{contact code}} is invalid, use {{contact_code}} or {{contactCode}} instead).
An examples of layouts:
A simple text message:
{
"contactCode": "{{contactCode}}",
"channelType": "{{channelType}}",
"content": {
"body": "Hi there {{name}}!"
}
}
A message with a template:
{
"contactCode": "{{contactCode}}",
"channelType": "cloud_api",
"content": {
"template": {
"name": "{{templateName}}",
"language": {
"policy": "deterministic",
"code": "es"
},
"components": [
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "{{name}}"
}
]
},
{
"index": "0",
"type": "button",
"subType": "quickReply",
"parameters": [
{
"type": "payload",
"payload": "{{ticketId}}"
}
]
}
]
}
}
}
Optionally, you can include a context object to update the contact's context. Map context keys to CSV column variable placeholders:
"context": {
"preferred_store": "{{store_column}}",
"loyalty_level": "{{level_column}}"
}
Context updates are not allowed for scheduled or delayed sendings.
You can also use externalCode instead of contactCode to identify contacts by their external code.
When using externalCode, channelType is not required. If multiple contacts share the same externalCode, a message will be sent to each of them.
{
"externalCode": "{{externalCode}}",
"content": {
"body": "Hello {{name}}!"
}
}
You can also use bsuid instead of contactCode to identify contacts by their bsuid. channelType is not required:
bsuid only applies to CLOUD_API (WhatsApp) contacts, so channelType is always treated as cloud_api.
Unlike externalCode, bsuid is treated as a direct sending identifier (like contactCode).
{
"bsuid": "{{bsuid}}",
"content": {
"body": "Hello {{name}}!"
}
}