Skip to navigation

send template with parameteres

View as Markdown

Sends a WhatsApp template message through the MessengerMate Business API. Use this endpoint to deliver approved template messages to a single recipient, including support for standard template parameters, media headers, interactive buttons, and carousel cards.

Endpoint

POST https://business.me-mate.net/whatsappbusiness/send-templated-message

Required header

Content-Type: application/json

How it works

Submit a JSON payload describing the recipient, sender, and template configuration. The API sends the specified approved WhatsApp template using the provided template name, language, and component data. The template.components array controls how dynamic content is injected into headers, body text, buttons, and carousel cards.

Request body fields

  • api_key: Your API key used to authorize the request.

  • sender: The configured WhatsApp-enabled sender number or identifier used to send the template.

  • campaign_id: Optional campaign identifier for tracking or internal grouping.

  • messaging_product: Messaging product value. Typically set to whatsapp.

  • recipient_type: Recipient category. Commonly individual for one-to-one delivery.

  • to: Recipient phone number in the required format.

  • type: Message type. For template messages, use template.

  • template.name: The approved template name to send.

  • template.language.code: Language code for the approved template variation, such as en.

  • template.components: Array of template components used to populate dynamic values and interactive content.

Supported template component patterns

template.components supports the following common structures:

1. Header component

Use a HEADER component when the template includes a header variable. NOTE A header supports a single parameter.

Text header:

{
"type": "HEADER",
"parameters": [
{
"type": "text",
"text": "variable value"
}
]
}

Media header:

{
"type": "HEADER",
"parameters": [
{
"type": "IMAGE",
"image": {
"link": "https://example.com/image.jpg"
}
}
]
}

The media parameter type can be IMAGE, VIDEO, or DOCUMENT, depending on the approved template format.

2. Body component

Use a BODY component to pass dynamic text values for body variables.

{
"type": "BODY",
"parameters": [
{
"type": "text",
"text": "variable value"
},
{
"type": "text",
"text": "variable value"
}
]
}

Add parameters in the same order as the variables defined in the approved template.

3. Button components

Use button components when the template includes interactive buttons. The index should increase according to the button order in the approved template, starting from the first button (count all button like QUICK_REPLY, URL,COPY_CODE etc ).

URL button example:

{
"type": "BUTTON",
"sub_type": "URL",
"index": "0",
"parameters": [
{
"type": "text",
"text": "variable value"
}
]
}

Copy code button example:

{
"type": "BUTTON",
"sub_type": "COPY_CODE",
"index": "2",
"parameters": [
{
"type": "coupon_code",
"coupon_code": "SAVE20"
}
]
}

Depending on the approved template, button components may also support quick reply or call-oriented button patterns. Always match the sub_type, parameter type, and index to the template definition configured in WhatsApp.

4. Carousel templates

For carousel templates, use a CAROUSEL component and provide cards. Each card should include its card_index and the components required for that card, such as a header image and body or button parameters.

{
"type": "CAROUSEL",
"cards": [
{
"card_index": 0,
"components": [
{
"type": "HEADER",
"parameters": [
{
"type": "IMAGE",
"image": {
"link": "https://example.com/card-1.jpg"
}
}
]
},
{
"type": "BODY",
"parameters": [
{
"type": "text",
"text": "Card one title"
}
]
}
]
},
{
"card_index": 1,
"components": [
{
"type": "HEADER",
"parameters": [
{
"type": "IMAGE",
"image": {
"link": "https://example.com/card-2.jpg"
}
}
]
}
]
}
]
}

Example request payload

{
"api_key": "{{api_key}}",
"sender": "{{sender_phone}}",
"campaign_id": "campaign_001",
"messaging_product": "whatsapp",
"recipient_type": "individual",
"to": "{{recipient_phone}}",
"type": "template",
"template": {
"name": "order_update",
"language": {
"code": "en"
},
"components": [
{
"type": "HEADER",
"parameters": [
{
"type": "text",
"text": "variable value"
}
]
},
{
"type": "BODY",
"parameters": [
{
"type": "text",
"text": "variable value"
},
{
"type": "text",
"text": "variable value"
}
]
},
{
"type": "BUTTON",
"sub_type": "URL",
"index": "0",
"parameters": [
{
"type": "text",
"text": "variable value"
}
]
}
]
}
}

Implementation notes

Make sure the template name, language, component types, button definitions, and parameter ordering exactly match the approved WhatsApp template. Header components accept only one parameter. For button and carousel payloads, preserve the expected sequence and indexes so the API can map the data correctly.

Request

This endpoint expects an object.
tostringRequired
typestringRequired
senderstringRequired
api_keystringRequired
templateobjectRequired
campaign_idstringRequired
recipient_typestringRequired
messaging_productstringRequired

Response

OK