Multi-Product Message Templates

MPM templates can be used to open marketing conversations. They allow you to showcase up to 30 products from your e-commerce catalog, organized in up to 10 sections, in a single message.

Customers can browse products and sections within the message, view details for each product, add and remove products from their cart, and submit their cart to place an order. Orders are then sent to you via a webhook.

Limitations

  • Customers must be using WhatsApp v2.22.24 or greater.
  • MPM templates cannot be forwarded to other customers.

Refer here for detailed information on how to create and use MPM templates.

Create MPM Templates

📘

  • Supported on both CAPI and On-Premise
  • Template Type should always be “PRODUCT"
  • Category Type should always be “MARKETING"
  • Catalog connection is not required for template creation (but will be required while sending the template)

Meta Payloads Example

{
  "name": "abandoned_cart",
  "language": "en_US",
  "category": "MARKETING",
  "components": [
    {
      "type": "HEADER",
      "format": "TEXT",
      "text": "Forget something, {{1}}?",
      "example": {
        "header_text": [
          "Pablo"
        ]
      }
    },
    {
      "type": "BODY",
      "text": "Looks like you left these items in your cart, still interested? Use code {{1}} to get 10% off!",
      "example": {
        "body_text": [
          [
            "10OFF"
          ]
        ]
      }
    },
    {
      "type":"BUTTONS",
      "buttons": [
        {
          "type": "MPM",
          "text": "View items"
        }
      ]
    }
  ]
}

Request

curl --location 'https://api.gupshup.io/wa/app/:appId/template' \ 
--header 'apikey: {{api_key}}' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'languageCode={{language_code}}' \
--data-urlencode 'content={{template body}}' \
--data-urlencode 'footer={{template footer}}' \
--data-urlencode 'category=MARKETING' \
--data-urlencode 'example={{template body example}}' \
--data-urlencode 'vertical={{template vertical}}' \
--data-urlencode 'elementName={{template name}}' \
--data-urlencode 'templateType=PRODUCT' \
--data-urlencode 'header=Hi {{1}}' \
--data-urlencode 'exampleHeader=Hi Aditya'

Response

{
    "status": "success",
    "template": {
        "appId": "ceb2b861-24f6-406c-901f-3f788e02f5ea",
        "category": "MARKETING",
        "containerMeta": "{\"appId\":\"ceb2b861-24f6-406c-901f-3f788e02f5ea\",\"data\":\"Dear {{1}}, here are our products.\",\"buttons\":[{\"type\":\"MPM\",\"text\":\"View items\"}],\"header\":\"Hi {{1}}\",\"footer\":\"Thank you for shopping with us\",\"sampleText\":\"Dear Aditya, here are our products.\",\"sampleHeader\":\"Hi Aditya\",\"enableSample\":true,\"editTemplate\":false,\"allowTemplateCategoryChange\":false,\"addSecurityRecommendation\":false}",
        "createdOn": 1689576457337,
        "data": "Hi {{1}}\nDear {{1}}, here are our products.\nThank you for shopping with us | [View items]",
        "elementName": "mpm_self_catalog_ex1",
        "id": "be3a1398-a209-4c51-b47b-8595e144e90a",
        "languageCode": "en",
        "languagePolicy": "deterministic",
        "meta": "{\"example\":\"Dear Aditya, here are our products.\"}",
        "modifiedOn": 1689576457337,
        "namespace": "6a54628a_7f29_45a7_80b1_46549f39062d",
        "priority": 1,
        "retry": 0,
        "stage": "NONE",
        "status": "PENDING",
        "templateType": "PRODUCT",
        "vertical": "Testing",
        "wabaId": "103775135696983"
    }
}

Request Parameters

KeyDescriptionConstraints
apikeyApikey of the account where the app is to be createdShould be a valid gupshup.io apikey
languageCodeSource Phone Number
contentSource App Name
footerDestination numberOptional
categoryCatalog message payloadMust always be MARKETING for catalog template
exampleChannel to send messages toIf params are used in body
verticalTemplate Vertical
elementNameTemplate Name
templatetTypeTemplate TypeMust be PRODUCT for MPM template
headerTemplate header
exampleHeaderTemplate header exampleif params are used in header
appIdValid App Id

Response Parameters

KeyDescription
statusCreation status
templateTemplate get created

Send MPM Templates

📘

  • Supported on both CAPI and On-Premise (Currently there is error in MPM on-premise messaging from Meta side)
  • Template params should contain valid values (Example displayed below)
  • Sending these templates not supported through Gupshup UI

Request

curl --location 'https://api.gupshup.io/wa/app/:appId/template' \ 
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'apikey: {{apiKey}}' \
--data-urlencode 'channel=whatsapp' \
--data-urlencode 'source={{sender_phone_number}}' \
--data-urlencode 'destination={{destination_phone_number}}' \
--data-urlencode 'src.name={{app_name}}' \
--data-urlencode 'template={"id":"{{template_id}}","params":{{template_params_list}},"mpm":{"sections":[{"title":"{{section_title}}","products":{{section_product_list}} }]}}'

Meta Payload Example

{
  "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"
                    }
                  ]
                }
              ]
            }
          }
        ]
      }
    ]
  }
}

Response

Status CodeResponseComment
Success 200 {
"status": "submitted",
"messageId": "4bed9a90-9f7a-4584-be5b-8ee1cba61a01"
}
Error 401{
"message": {
"message": "Authentication Failed"
},
"status": "error"
}
When APIKey authentication fails or apikey is not sent

Request Parameters

KeyDescriptionConstraints
apikeyApikey of the account where the app is to be createdShould be a valid gupshup.io apikey
sourceSource Phone Number
src.nameSource App Name
destinationDestination phone number
TemplateJSON containing template details- Must include valid template id
- Params must include all params including a product ID (which is to be used as a thumbnail (last in the list))
- Sections param must be provided with valid ids

{"params":["{{product_id}}"],"mpm":{"sections":[{"title":"Products","products":["{{product_id}}"]}]}}

Response Parameters

KeyDescription
statusMessage status
MessageMessage ID