Sending WhatsApp messages by template ID
Last updated: 16 October 2026
To send messages to a WhatsApp channel by template ID templateId, use the /api/v2/out-messages/whatsapp/template method.
tip
We recommend using the /api/v2/out-messages/whatsapp/template method to support BSUID.
info
The /api/v1/out-messages/whatsapp/template method is deprecated but remains available for use.
Calling the method
To send a message to a WhatsApp channel using the /api/v2/out-messages/whatsapp/template method, send a POST request to https://app.edna.io/api/v2/out-messages/whatsapp/template.
Request format
{
"outMessageId": "string",
"from": "string",
"to": {
"value": "string",
"type": "string"
},
"templateId": number,
"textVariables": [
"string",
"string",
"string"
],
"buttonVariables": [
"string",
"string"
],
"headerVariables": [
"string"
],
"attachment": {
"url": "string",
"name": "string"
},
"options": {
"comment": "string",
"sendDelay": "string",
"priority": "string",
"useMarketingMessagesApi": boolean,
"messageActivitySharing": boolean
}
}
Request examples
Text message
{
"from": "RETAIL_WA",
"to": {
"value": "DE.1234567890123456789",
"type": "WHATSAPP_BSUID"
},
"templateId": 81,
"options": {
"comment": "2025-08-04T13:00:48.567Z"
}
}
Text message delivered via Marketing Messages API with optimization enabled
{
"sender": "RETAIL_WA",
"phone": "35700000000",
"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"
}
}
Message with scheduled sending that includes a document, variables, text, and dynamic buttons
{
"outMessageId": "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 | Requirement | Description |
|---|---|---|---|
outMessageId | string | Optional | The internal identifier of an outgoing message. The customer's external system or edna Pulse generates it when sending a message. The maximum string length is 256 characters. |
from | string | Required | Channel name.
To find the channel name, use the API method that retrieves the list of channels — the subject parameter.
Receiving list of channels |
to | object | Required | An object that contains information about the recipient identifier. |
to.value | string | Required | Recipient identifier.
To find the recipient identifier, use the API method that requests recipient data — the addresses.address parameter.
Requesting client data |
to.type | string | Required | Recipient identifier type.
Possible values: - PHONE — phone number;
- WHATSAPP_BSUID — Business-Scoped User ID (BSUID);
- WHATSAPP_PARENT_BSUID — Parent Business-Scoped User ID (Parent BSUID). |
templateId | number | Required | Template identifier.
To find the template identifier, use the API method that retrieves the list of templates — the id parameter.
Retrieving list of templates |
textVariables | array of strings | Required if the template includes variables | Values of variables in a message based on the template. |
buttonVariables | array of strings | Required if the template includes buttons with dynamic links | Values of variables for buttons with dynamic links in a message based on the template. A WhatsApp message template can include up to two link buttons. |
headerVariables | array of strings | Required if the template header includes a variable | Value of a variable in the header of a message based on the template. The header can include only one variable. |
attachment | object | Optional | An object that contains attachment information. |
attachment.url | string | Required if the attachment parameter isn't empty | Link to an attachment: an image, file, video, or audio. |
attachment.name | string | Required if the attachment parameter isn't empty | Name of an image, file, video, or audio. The maximum length is 70 characters. |
options | object | Optional | An object with additional message sending settings. |
options.comment | string | Optional | Text comment on the message. The parameter value appears in the message report. |
options.sendDelay | string | Optional | The time period in ISO 8601 format (for example, PT10H15M48S) before which the message isn't sent. Use it for scheduled sending. |
options.priority | string | Optional | Indicates message priority.
Possible values: - LOW — low priority;
- NORMAL — medium priority, the default value;
- HIGH — high priority;
- REALTIME — real-time delivery. |
options.useMarketingMessagesApi | boolean | Optional | Defines how to send a marketing message — through Marketing Messages API or Cloud API.
Possible values: - true — through Marketing Messages API;
- false — through Cloud API.
How to activate Marketing Messages API for WhatsApp |
options.messageActivitySharing | boolean | Optional | Enables optimization for sending a marketing message through Marketing Messages API and defines whether Meta* can analyze message data.
Possible values: - true — optimization is enabled: Meta* can read the message and decide whether to deliver it to the recipient.
- false — optimization is disabled: Meta* doesn't have access to the message content and doesn't decide whether to deliver it.
How to activate Marketing Messages API for WhatsApp |
Response format
{
"outMessageId": "string"
}
Response example
{
"outMessageId": "01987f4a-070e-730e-bf59-cedc1e63350"
}
Response parameters
| Parameter | Data type | Description |
|---|---|---|
outMessageId | string | The customer's external system or edna Pulse generates the internal identifier of an outgoing message when sending a message. |
Errors
| Code | Error | Description | Possible comments |
|---|---|---|---|
400 | mm-api-options-invalid-combination | Incompatible combination of settings when sending a WhatsApp message through Marketing Messages API. | Cannot use messageActivitySharing=true when useMarketingMessagesApi=false — message delivery optimization is available only when sending a message through Marketing Messages API. |