Sending Messages by Template ID
To send messages by the template ID templateId, the following methods are used::
api/v1/out-messages/whatsapp/template— for sending messages to the WhatsApp channel;api/v1/out-messages/viber/template— for sending messages to the Viber channel.
The methods api/v1/out-messages/whatsapp/template and api/v1/out-messages/viber/template refer to the new API version.
WhatsApp Channel
To send a message to the WhatsApp channel using the api/v1/out-messages/whatsapp/template method, send a POST request to the URL https://app.edna.io/api/v1/out-messages/whatsapp/template
Request Format
{
"messageId": "string",
"sender": "string",
"phone": "string",
"templateId": integer,
"textVariables": [
"string",
"string",
"string"
],
"buttonVariables": [
"string",
"string"
],
"headerVariables": [
"string"
],
"attachment": {
"url": "string",
"name": "string"
},
"options": {
"comment": "string",
"sendDelay": "string",
"priority": "string",
"useMarketingMessagesApi": boolean
}
}
Request Example
Text message:
{
"sender": "RETAIL_WA",
"phone": "35700000000",
"templateId": 81,
"options": {
"comment": "2025-08-04T13:00:48.567Z"
}
}
Text message delivered via Marketing Messages API with optimization enabled:
{
"sender": "RETAIL_WA",
"phone": "77771234567",
"templateId": 81,
"options": {
"comment": "2025-08-04T13:00:48.567Z",
"useMarketingMessagesApi": true,
"messageActivitySharing": true
}
}
The message with the document in the attachment:
{
"sender": "RETAIL_WA",
"phone": "35700000000",
"templateId": 96,
"attachment": {
"url": "https://tourism.gov.in/sites.pdf",
"name": "example"
},
"options": {
"comment": "promotion"
}
}
A delayed message containing a document in an attachment, variables in the header, message text, and dynamic link buttons:
{
"messageId": "01987f4a-069e-730e-bf59-cedc1e63349",
"sender": "RETAIL_WA",
"phone": "35700000000",
"templateId": 98,
"textVariables": [
"Alex",
"10.05",
"Happy Birthday"
],
"buttonVariables": [
"3FgSD",
"KNsr6"
],
"headerVariables": [
"Good Morning"
],
"attachment": {
"url": "https://tourism.gov.in/sites.pdf",
"name": "offer"
},
"options": {
"comment": "2025-08-15T12:12:16.984Z",
"sendDelay": "PT10H15M47S",
"priority": "NORMAL"
}
}
Request Parameters
| Parameter | Data type | Character | Description |
|---|---|---|---|
messageId | string | Optional | The internal ID of the message. |
sender | string | Required | Signature name.
To find out the name of the signature, use the API method to get a list of channels — the subject parameter.
Receiving List of Channels |
phone | string | Required | Recipient's address — phone number.
To find out the recipient's address, use the API method for requesting recipient data — the addresses.address parameter.
Requesting Client Data |
templateId | integer | Required | Template ID.
To find out the template ID, use the API method to get a list of templates — the id parameter.
Retrieving List of Templates |
textVariables | array of strings | Required if the template contains variables | Variable values in the template message. |
buttonVariables | array of strings | Required if the template has buttons with dynamic links | Variable values for buttons with dynamic links in the template message. A WhatsApp message template can contain up to two link buttons. |
headerVariables | array of strings | Required if there is a variable in the template header | The value of the variable in the template message header. The header can contain only one variable. |
attachment | object | Optional | Information about the attachment. |
attachment.url | string | Required if the attachment parameter is not empty | The link to the attachment is an image, file, video, or audio. |
attachment.name | string | Required if the attachment parameter is not empty | The name of the image, file, video, or audio. The maximum length is 70 characters. |
options | object | Optional | Used for additional message sending settings. |
options.comment | string | Optional | Text comment to the message. The parameter value is displayed in the message report. |
options.sendDelay | string | Optional | Time interval in the ISO 8601 durations date format (for example, `PT10H15M48S'), before which the message will not be sent. Used for delayed shipping. sentenz.github.io |
options.priority | string | Optional | Used to indicate the priority of messages.
Possible values: - LOW — low priority;
- NORMAL — medium priority, default value;
- HIGH — high priority;
- REALTIME — real-time delivery. |
useMarketingMessagesApi | boolean | Optional | This parameter determines how marketing messages are delivered: Marketing Messages API or Cloud API.
Possible values: - true — via Marketing Messages API;
- false — via Cloud API.
How to Activate Marketing Messages API for WhatsApp |
messageActivitySharing | boolean | Optional | This parameter enables optimization of marketing message delivery via the Marketing Messages API and determines whether Meta can analyze message data.
Possible values: - true — optimization enabled: Meta can read the message and decide whether to deliver it to the recipient.
- false — optimization disabled: Meta doesn't have access to the message content and doesn't participate in the delivery decision.
How to Activate Marketing Messages API for WhatsApp |
Response Format
{
"messageId": "string",
"phone": "string"
}
Response Example
{
"messageId": "01987f4a-070e-730e-bf59-cedc1e63350",
"phone": "35700000000"
}
Response Parameters
| Parameter | Data type | Description |
|---|---|---|
messageId | string | The internal ID of the message. |
phone | string | Recipient’s address (a phone number). |
Viber Channel
To send a message to the Viber channel using the api/v1/out-messages/viber/template method, send a POST request to the URL https://app.edna.io/api/v1/out-messages/viber/template
Request Format
{
"messageId": "string",
"sender": "string",
"phone": "string",
"templateId": integer,
"textVariables": [
"string",
"string",
"string"
],
"options": {
"comment": "string",
"sendDelay": "string",
"priority": "string"
}
}
Request Example
Text message:
{
"sender": "RETAIL_VIBER",
"phone": "35700000000",
"templateId": 32,
"options": {
"comment": "promotion"
}
}
A delayed message containing variables in the text:
{
"messageId": "01987f4a-070e-730e-bf59-cedc1e63350",
"sender": "RETAIL_VIBER",
"phone": "35700000000",
"templateId": 34,
"textVariables": [
"Alex",
"10.05",
"Happy Birthday"
],
"options": {
"comment": "2025-08-12T12:17:20.981Z",
"sendDelay": "PT1H3M4S",
"priority": "NORMAL"
}
}
Request Parameters
| Parameter | Data Type | Character | Description |
|---|---|---|---|
messageId | string | Optional | The internal ID of the message. |
sender | string | Required | Signature name.
To find out the name of the signature, use the API method to get a list of channels — the subject parameter.
Receiving List of Channels |
phone | string | Required | Recipient's address — phone number.
To find out the recipient's address, use the API method for requesting recipient data — the addresses.address parameter.
Requesting Client Data |
templateId | integer | Required | Template ID.
To find out the template ID, use the API method to get a list of templates — the id parameter.
Retrieving List of Templates |
textVariables | array of strings | Required if the template contains variables | Variable values in the template message. |
options | object | Optional | Used for additional message sending settings. |
options.comment | string | Optional | Text comment to the message. The parameter value is displayed in the message report. |
options.sendDelay | string | Optional | Time interval in the ISO 8601 durations date format (for example, `PT10H15M48S'), before which the message will not be sent. Used for delayed shipping. sentenz.github.io |
options.priority | string | Optional | Used to indicate the priority of messages.
Possible values: - LOW — low priority;
- NORMAL — medium priority, default value;
- HIGH — high priority;
- REALTIME — real-time delivery. |
Response Format
{
"messageId": "string",
"phone": "string"
}
Response Example
{
"messageId": "01987f4a-070e-730e-bf59-cedc1e63350",
"phone": "35700000000"
}
Response Parameters
| Parameter | Data type | Description |
|---|---|---|
messageId | string | The internal ID of the message. |
phone | string | Recipient’s address (a phone number). |
Errors
| Code | Error | Description | Possible comments |
|---|---|---|---|
400 | mm-api-options-invalid-combination | The incompatible combination of settings when sending a WhatsApp message via the Marketing Messages API. | Cannot use messageActivitySharing=true when useMarketingMessagesApi=false — message delivery optimization is only available when sending messages via the Marketing Messages API. |