Skip to main content

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.

File IconSending WhatsApp messages by template ID (deprecated)

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​

ParameterData typeRequirementDescription
outMessageIdstringOptionalThe 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.
fromstringRequiredChannel name.
To find the channel name, use the API method that retrieves the list of channels — the subject parameter. File IconReceiving list of channels
toobjectRequiredAn object that contains information about the recipient identifier.
to.valuestringRequiredRecipient identifier.
To find the recipient identifier, use the API method that requests recipient data — the addresses.address parameter. File IconRequesting client data
to.typestringRequiredRecipient identifier type.
Possible values:
- PHONE — phone number;
- WHATSAPP_BSUID — Business-Scoped User ID (BSUID);
- WHATSAPP_PARENT_BSUID — Parent Business-Scoped User ID (Parent BSUID).
templateIdnumberRequiredTemplate identifier.
To find the template identifier, use the API method that retrieves the list of templates — the id parameter. File IconRetrieving list of templates
textVariablesarray of stringsRequired if the template includes variablesValues of variables in a message based on the template.
buttonVariablesarray of stringsRequired if the template includes buttons with dynamic linksValues 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.
headerVariablesarray of stringsRequired if the template header includes a variableValue of a variable in the header of a message based on the template. The header can include only one variable.
attachmentobjectOptionalAn object that contains attachment information.
attachment.urlstringRequired if the attachment parameter isn't emptyLink to an attachment: an image, file, video, or audio.
attachment.namestringRequired if the attachment parameter isn't emptyName of an image, file, video, or audio. The maximum length is 70 characters.
optionsobjectOptionalAn object with additional message sending settings.
options.commentstringOptionalText comment on the message. The parameter value appears in the message report.
options.sendDelaystringOptionalThe time period in ISO 8601 format (for example, PT10H15M48S) before which the message isn't sent. Use it for scheduled sending.
options.prioritystringOptionalIndicates message priority.
Possible values:
- LOW — low priority;
- NORMAL — medium priority, the default value;
- HIGH — high priority;
- REALTIME — real-time delivery.
options.useMarketingMessagesApibooleanOptionalDefines how to send a marketing message — through Marketing Messages API or Cloud API.
Possible values:
- true — through Marketing Messages API;
- false — through Cloud API. File IconHow to activate Marketing Messages API for WhatsApp
options.messageActivitySharingbooleanOptionalEnables 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. File IconHow to activate Marketing Messages API for WhatsApp

Response format​

{
"outMessageId": "string"
}

Response example​

{
"outMessageId": "01987f4a-070e-730e-bf59-cedc1e63350"
}

Response parameters​

ParameterData typeDescription
outMessageIdstringThe customer's external system or edna Pulse generates the internal identifier of an outgoing message when sending a message.

Errors​

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