1. Text_based_template

Sends an approved template with a plain-text body and no dynamic parameters populated in this sample.

Method: POST

Endpoint: https://apis-nextgen.rmlconnect.net/wba/v1/tsp/messages/

Sample request body:

{
  "messaging_product": "whatsapp",
  "recipient_type": "individual",
  "to": "{{phone_no}}",
  "type": "template",
  "template": {
    "name": "plain_text_template2",
    "language": {
      "code": "en"
    },
    "components": [
      {
        "type": "body",
        "parameters": []
      }
    ]
  }
}

Notes:

Called against apis-nextgen.rmlconnect.net in the source collection, unlike the other endpoints which use apis.rmlconnect.net — confirm which host is current before use (see Open Questions).

2. Media_template

Approved template with a media (image) header component.

Method: POST

Endpoint: https://apis.rmlconnect.net/wba/v1/tsp/messages

Sample request body:

{
  "messaging_product": "whatsapp",
  "recipient_type": "individual",
  "to": "{{phone_no}}",
  "type": "template",
  "template": {
    "name": "headermediatest2",
    "language": {
      "code": "en"
    },
    "components": [
      {
        "type": "header",
        "parameters": [
          {
            "type": "image",
            "image": {
              "link": "https://www.gstatic.com/webp/gallery/1.jpg"
            }
          }
        ]
      },
      {
        "type": "body",
        "parameters": []
      }
    ]
  }
}

3. Location_based_template

Approved template with a location header component plus body text parameters.

Method: POST

Endpoint: {{url}}/v1/tsp/messages/

Sample request body:

{
  "messaging_product": "whatsapp",
  "recipient_type": "individual",
  "to": "{{phone_no}}",
  "type": "template",
  "template": {
    "name": "location",
    "language": {
      "code": "en"
    },
    "components": [
      {
        "type": "header",
        "parameters": [
          {
            "type": "location",
            "location": {
              "latitude": "37.483307",
              "longitude": "122.148981",
              "name": "Pablo Morales",
              "address": "1 Hacker Way, Menlo Park, CA 94025"
            }
          }
        ]
      },
      {
        "type": "body",
        "parameters": [
          {
            "type": "text",
            "text": "Pablo"
          },
          {
            "type": "text",
            "text": "566701"
          }
        ]
      }
    ]
  }
}

4. Catalog_thumbnail_template_message

Approved template with a CATALOG button component that renders a product thumbnail from the connected catalog.

Method: POST

Endpoint: {{url}}/v1/tsp/messages/

Sample request body:

{
  "messaging_product": "whatsapp",
  "recipient_type": "individual",
  "to": "{{phone_no}}",
  "type": "template",
  "template": {
    "name": "catalog_thumb",
    "language": {
      "code": "en"
    },
    "components": [
      {
        "type": "body",
        "parameters": [
          {
            "type": "text",
            "text": "100"
          }
        ]
      },
      {
        "type": "button",
        "sub_type": "CATALOG",
        "index": 0,
        "parameters": [
          {
            "type": "action",
            "action": {
              "thumbnail_product_retailer_id": " 1-1135-2742-HI"
            }
          }
        ]
      }
    ]
  }
}

Notes:

thumbnail_product_retailer_id must exist in the linked WhatsApp catalog.

5. Coupon_code

Approved template with a COPY_CODE button component; recipient can tap to copy the coupon code.

Method: POST

Endpoint: {{url}}/v1/tsp/messages/

Sample request body:

{
    "messaging_product": "whatsapp",
    "to": "{{phone_no}}",
    "type": "template",
    "template": {
        "name": "copy_code_test_500",
        "language": {
            "code": "en"
        },
        "components": [
            {
                "type": "body"
                // "parameters": [
                //     {
                //         "type": "text",
                //         "text": "25OFF"
                //     },
                //     {
                //         "type": "text",
                //         "text": "25%"
                //     }
                // ]
            },
            {
                "type": "button",
                "sub_type": "COPY_CODE",
                "index": 0,
                "parameters": [
                    {
                        "type": "coupon_code",
                        "coupon_code": "25OFF"
                    }
                ]
            }
        ]
    }
}

6. Multi_product_messages

Approved template with an mpm (multi-product message) button, referencing multiple catalog items grouped into sections.

Method: POST

Endpoint: {{url}}/v1/tsp/messages/

Sample request body:

{
    "messaging_product": "whatsapp",
    "recipient_type": "individual",
    "to": "{{phone_no}}",
    "type": "template",
    "template": {
        "name": "testing_api_nisha",
        "language": {
            "code": "en"
        },
        "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": " 1-1135-2742-HI",
                            "sections": [
                                {
                                    "title": "Popular Bundles",
                                    "product_items": [
                                        {
                                            "product_retailer_id": "IT173"
                                        },
                                        {
                                            "product_retailer_id": "IT1260"
                                        }
                                    ]
                                },
                                {
                                    "title": "Premium Packages",
                                    "product_items": [
                                        {
                                            "product_retailer_id": "1-1241-2447-HI"
                                        }
                                    ]
                                }
                            ]
                        }
                    }
                ]
            }
        ]
    }
}

7. Carousel_template_message

Approved template rendered as a swipeable carousel; each card has its own header and buttons.

Method: POST

Endpoint: {{url}}/v1/tsp/messages/

Sample request body:

{
    "messaging_product": "whatsapp",
    "recipient_type": "individual",
    "to": "{{phone_no}}",
    "type": "template",
    "template": {
        "name": "hemantcarouselnisha",
        "language": {
            "code": "en"
        },
        "components": [
            {
                "type": "body"
                // "parameters": [
                //     {
                //         "type": "text",
                //         "text": "Pablo"
                //     },
                //     {
                //         "type": "text",
                //         "text": "20%"
                //     },
                //     {
                //         "type": "text",
                //         "text": "20OFF"
                //     }
                // ]
            },
            {
                "type": "carousel",
                "cards": [
                    {
                        "card_index": 0,
                        "components": [
                            {
                                "type": "header"
                                // "parameters": [
                                //     {
                                //         "type": "image",
                                //         "image": {
                                //             "link": "https://www.gstatic.com/webp/gallery/1.jpg"
                                //         }
                                //     }
                                // ]
                            },
                            {
                                "type": "button",
                                "sub_type": "quick_reply",
                                "index": "0",
                                "parameters": [
                                    {
                                        "type": "payload",
                                        "payload": "more-aloes"
                                    }
                                ]
                            },
                            {
                                "type": "button",
                                "sub_type": "url",
                                "index": "1",
                                "parameters": [
                                    {
                                        "type": "text",
                                        "text": "blue-elf"
                                    }
                                ]
                            }
                        ]
                    },
                    {
                        "card_index": 1,
                        "components": [
                            {
                                "type": "header",
                                "parameters": [
                                    {
                                        "type": "image",
                                        "image": {
                                            "link": "https://www.gstatic.com/webp/gallery/1.jpg"
                                        }
                                    }
                                ]
                            },
                            {
                                "type": "button",
                                "sub_type": "quick_reply",
                                "index": "0",
                                "parameters": [
                                    {
                                        "type": "payload",
                                        "payload": "more-crassulas"
                                    }
                                ]
                            },
                            {
                                "type": "button",
                                "sub_type": "url",
                                "index": "1",
                                "parameters": [
                                    {
                                        "type": "text",
                                        "text": "buddhas-temple"
                                    }
                                ]
                            }
                        ]
                    },
                    {
                        "card_index": 2,
                        "components": [
                            {
                                "type": "header",
                                "parameters": [
                                    {
                                        "type": "image",
                                        "image": {
                                            "link": "https://www.gstatic.com/webp/gallery/1.jpg"
                                        }
                                    }
                                ]
                            },
                            {
                                "type": "button",
                                "sub_type": "quick_reply",
                                "index": "0",
                                "parameters": [
                                    {
                                        "type": "payload",
                                        "payload": "more-echeverias"
                                    }
                                ]
                            },
                            {
                                "type": "button",
                                "sub_type": "url",
                                "index": "1",
                                "parameters": [
                                    {
                                        "type": "text",
                                        "text": "black-prince"
                                    }
                                ]
                            }
                        ]
                    }
                ]
            }
        ]
    }
}

Notes:

card_index must be sequential starting at 0 and match the approved template's card order.

8. Sending order details template message

Approved template whose button component carries a full order_details payload (order-confirmation-as-template pattern).

Method: POST

Endpoint: {{url}}/v1/tsp/messages/

Sample request body:

\{
"messaging_product": "whatsapp",
"recipient_type": "individual",
"to": "{{phone_no}}",
"type": "template",
"template": \{
"name": "hem_orderdetails78",
"language": {
    "policy": "deterministic",
    "code": "en"
},
"components": \[ {
    "type": "header"
    // "parameters": [
    //     {
    //         "type": "text", // Uses header with image as an example
    //         "text":"hello header"
    //         // "image": {
    //         //     "link": "https://www.gstatic.com/webp/gallery/1.jpg"
    //         // }
    //     }
    // ]
},

{
    "type": "button",
    "sub_type": "order_details",
    "index": 0,
    "parameters": [
        {
            "type": "action",
            "action": {
                "order_details": {
                    "currency": "INR",
                    "order": {
                        "discount": {
                            "offset": 100,
                            "value": 250
                        },
                        "items": [
                            {
                                "amount": {
                                    "offset": 100,
                                    "value": 400
                                },
                                "name": " Coragen - 10 ML",
                                "quantity": 1,
                                "retailer_id": "1-1135-2742-HI",
                                "country_of_origin": "ORIGIN_COUNTRY",
                                "importer_name": "IMPORTER_NAME",
                                "importer_address": {
                                    "address_line1": "IMPORTER_ADDRESS",
                                    "city": "navi mumbai",
                                    "country_code": "india",
                                    "postal_code": "400706"
                                }
                            }
                        ],
                        "shipping": {
                            "offset": 100,
                            "value": 0
                        },
                        "status": "pending",
                        "subtotal": {
                            "offset": 100,
                            "value": 400
                        },
                        "tax": {
                            "offset": 100,
                            "value": 500
                        }
                    },
                    "payment_configuration": "RMLUAT11",
                    "payment_type": "upi",
                    "reference_id": "sffgh",
                    "total_amount": {
                        "offset": 100,
                        "value": 650
                    },
                    "type": "digital-goods"
                }
            }
        }
    ]
}

]
\}
\}

Notes:

Structurally identical to the order_details action block used in the interactive payment messages below, but delivered inside a template button parameter instead of a session message.


Did this page help you?