Skip to main content

Sending Messages by Template ID

Last updated: 25 February 2026

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.
tip

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

ParameterData typeCharacterDescription
messageIdstringOptionalThe internal ID of the message.
senderstringRequiredSignature name.
To find out the name of the signature, use the API method to get a list of channels — the subject parameter. File IconReceiving List of Channels
phonestringRequiredRecipient's address — phone number.
To find out the recipient's address, use the API method for requesting recipient data — the addresses.address parameter. File IconRequesting Client Data
templateIdintegerRequiredTemplate ID.
To find out the template ID, use the API method to get a list of templates — the id parameter. File IconRetrieving List of Templates
textVariablesarray of stringsRequired if the template contains variablesVariable values in the template message.
buttonVariablesarray of stringsRequired if the template has buttons with dynamic linksVariable values for buttons with dynamic links in the template message. A WhatsApp message template can contain up to two link buttons.
headerVariablesarray of stringsRequired if there is a variable in the template headerThe value of the variable in the template message header. The header can contain only one variable.
attachmentobjectOptionalInformation about the attachment.
attachment.urlstringRequired if the attachment parameter is not emptyThe link to the attachment is an image, file, video, or audio.
attachment.namestringRequired if the attachment parameter is not emptyThe name of the image, file, video, or audio. The maximum length is 70 characters.
optionsobjectOptionalUsed for additional message sending settings.
options.commentstringOptionalText comment to the message. The parameter value is displayed in the message report.
options.sendDelaystringOptionalTime 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.prioritystringOptionalUsed to indicate the priority of messages.
Possible values:
- LOW — low priority;
- NORMAL — medium priority, default value;
- HIGH — high priority;
- REALTIME — real-time delivery.
useMarketingMessagesApibooleanOptionalThis parameter determines how marketing messages are delivered: Marketing Messages API or Cloud API.
Possible values:
- true — via Marketing Messages API;
- false — via Cloud API. File IconHow to Activate Marketing Messages API for WhatsApp
messageActivitySharingbooleanOptionalThis 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. File IconHow 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

ParameterData typeDescription
messageIdstringThe internal ID of the message.
phonestringRecipient’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

ParameterData TypeCharacterDescription
messageIdstringOptionalThe internal ID of the message.
senderstringRequiredSignature name.
To find out the name of the signature, use the API method to get a list of channels — the subject parameter. File IconReceiving List of Channels
phonestringRequiredRecipient's address — phone number.
To find out the recipient's address, use the API method for requesting recipient data — the addresses.address parameter. File IconRequesting Client Data
templateIdintegerRequiredTemplate ID.
To find out the template ID, use the API method to get a list of templates — the id parameter. File IconRetrieving List of Templates
textVariablesarray of stringsRequired if the template contains variablesVariable values in the template message.
optionsobjectOptionalUsed for additional message sending settings.
options.commentstringOptionalText comment to the message. The parameter value is displayed in the message report.
options.sendDelaystringOptionalTime 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.prioritystringOptionalUsed 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

ParameterData typeDescription
messageIdstringThe internal ID of the message.
phonestringRecipient’s address (a phone number).

Errors

CodeErrorDescriptionPossible comments
400mm-api-options-invalid-combinationThe 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.