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 an approved single-product message (SPM) template to a WhatsApp user.
Use the POST /<BUSINESS_PHONE_NUMBER_ID>/messages endpoint to send an SPM template message.
POST /<WHATSAPP_BUSINESS_PHONE_NUMBER_ID>/messages
{ "messaging_product": "whatsapp", "recipient_type": "individual", "to": "<WHATSAPP_USER_PHONE_NUMBER>", "type": "template", "template": { "name": "<TEMPLATE_NAME>", "language": { "policy": "deterministic", "code": "<TEMPLATE_LANGUAGE>" }, "components": [ { "type": "header", "parameters": [ { "type": "product", "product": { "product_retailer_id": "<PRODUCT_ID>", "catalog_id": "<CATALOG_ID>" } } ] }, { "type": "body", "parameters": [ <CARD_BODY_VARIABLE>, <CARD_BODY_VARIABLE> ] } ] } }
Placeholder | Description | Example Value |
---|---|---|
Object | Required if the template card body text uses variables, otherwise omit. Object describing a card body variable. If the template uses multiple variables, you must define an object for each variable. Supports There is no maximum character limit on this value, but does count against the card body text limit of 160 characters. |
|
String | Required. ID of connected ecommerce catalog containing the product. |
|
String | Required. Product ID. |
|
String | Required. Template language and locale code. |
|
String | Required. Template name. Maximum 512 characters. |
|
String | Required. WhatsApp user phone number. |
|
This example sends an approved template named "abandoned_cart_offer" which injects two text variables (an offer code and the percentage discounted) into the template body, and which includes a footer. The product image is pulled from the catalog and displayed in the message header.
curl 'https://graph.facebook.com/v21.0
/179776755229976/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_offer",
"language": {
"policy": "deterministic",
"code": "en_US"
},
"components": [
{
"type": "header",
"parameters": [
{
"type": "product",
"product": {
"product_retailer_id": "nqryix03ez",
"catalog_id": "194836987003835"
}
}
]
},
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "25OFF"
},
{
"type": "text",
"text": "25%"
}
]
}
]
}
}'