We are making changes to the WhatsApp Business Platform pricing model. See Pricing Updates on the WhatsApp Business Platform.
This document explains how to send multi-product message (MPM) templates in template messages.
MPM template messages must have:
Use the MPM button component to define sections and their titles that will appear when the customer taps the View items button, and to designate which products appear in each of those sections.
To send an approved MPM template in a template message, send a POST request to the WhatsApp Business Phone Number > Messages endpoint. Use the POST body to define the contents of the message and to describe any variables to inject into the template itself.
POST /<BUSINESS_PHONE_NUMBER_ID>/messages
{ "messaging_product": "whatsapp", "recipient_type": "individual", "to": "<TO>", "type": "template", "template": { "name": "<NAME>", "language": { "code": "<CODE>" }, "components": [ /* Header component required if template uses a header variable, otherwise omit */ { "type": "header", "parameters": [ { "type": "text", "text": "<HEADER_TEXT>" } ] }, /* Body component required if template uses a body variable, otherwise omit */ { "type": "body", "parameters": [ { "type": "text", "text": "<BODY_TEXT>" } ] }, /* MPM button component always required */ { "type": "button", "sub_type": "mpm", "index": 0, "parameters": [ { "type": "action", "action": { "thumbnail_product_retailer_id": "<THUMBNAIL_PRODUCT_RETAILER_ID>", "sections": [ { "title": "<TITLE>", "product_items": [ { "product_retailer_id": "<PRODUCT_RETAILER_ID>" }, ... // Additional item objects (up to 30) ] }, ... // Add section objects (up to 10) ] } } ] } ] } }
Placeholder | Description | Sample Value |
---|---|---|
| Required if template uses variables. String or array of strings. Text to replace body variable(s) defined in the template. |
|
| Template language and locale code. |
|
| Required if template uses a variable. Text to replace header variable defined in the template. |
|
| Template name. |
|
| SKU number of the item you want to appear in the section. SKU numbers are labeled as Content ID in the Commerce Manager. Supports up to 30 products total, across all sections. |
|
| Item SKU number. Labeled as Content ID in the Commerce Manager. The thumbnail of this item will be used as the template message's header image. |
|
| Section title text. You can define up to 10 sections. Maximum 24 characters. Markdown is not supported. |
|
| Customer phone number. |
|
Upon success, the API will respond with:
{ "messaging_product": "whatsapp", "contacts": [ { "input": "<INPUT>", "wa_id": "<WA_ID>" } ], "messages": [ { "id": "<ID>" } ] }
Placeholder | Description | Sample Value |
---|---|---|
| WhatsApp message ID. |
|
| Customer WhatsApp phone number. |
|
| Customer WhatsApp ID. |
|
This example sends an approved template named "abandoned_cart" and injects a variable (the customer's first name) into the template header and a discount code into the template body. It also defines two sections ("Popular Bundles" and "Premium Packages") and identifies the products (a total of 3) that should be injected into those sections.
curl 'https://graph.facebook.com/v21.0
/106540352242922/messages' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer EAAJB...' \
-d '
{
"messaging_product": "whatsapp",
"recipient_type": "individual",
"to": "16505551234",
"type": "template",
"template": {
"name": "abandoned_cart",
"language": {
"code": "en_US"
},
"components": [
{
"type": "header",
"parameters": [
{
"type": "text",
"text": "Pablo"
}
]
},
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "10OFF"
}
]
},
{
"type": "button",
"sub_type": "mpm",
"index": 0,
"parameters": [
{
"type": "action",
"action": {
"thumbnail_product_retailer_id": "2lc20305pt",
"sections": [
{
"title": "Popular Bundles",
"product_items": [
{
"product_retailer_id": "2lc20305pt"
},
{
"product_retailer_id": "nseiw1x3ch"
}
]
},
{
"title": "Premium Packages",
"product_items": [
{
"product_retailer_id": "n6k6x0y7oe"
}
]
}
]
}
}
]
}
]
}
}'
{ "messaging_product": "whatsapp", "contacts": [ { "input": "16505551234", "wa_id": "16505551234" } ], "messages": [ { "id": "wamid.HBgLMTY1MDM4Nzk0MzkVAgARGBJDOEI3ODgxNzQzMjJBQTdEQTcA" } ] }