Interactive message templates expand the content you can send recipients beyond the standard message
template and media messages template types to include interactive buttons using the components object.There are two types of predefined buttons:
- Call-to-Action - Allows your customer to call a phone number and visit a website.
- Quick Reply - Allows your customer to return a simple text message.
These buttons can be attached to text messages or media messages. Once your interactive message templates
have been created and approved, you can use them in notification messages as well as customer service/care
messages.
Request Parameters
Key | Value | Description | Data type | Required/Optional | Constraints |
---|---|---|---|---|---|
Authorization |
{{PARTNER_APP_TOKEN}} |
Access Token for the application |
String |
Required |
Should be a valid |
appId |
{{APP_ID}} |
App ID to fetch the |
String |
Required |
The ID should be a valid app Id of Gupshup. |
messaging_product |
Messaging product |
String |
Required |
||
recipient_type |
individual |
Recipient type |
String |
Required |
|
to |
91785876xxxx |
Destination phone number where the message needs to be sent |
String |
Required |
Must be a valid phone number |
type |
template |
Messaging type |
String |
Required |
The type should be |
template |
|
Template message inside body |
Object |
Required |
Sample Request
curl --location 'https://partner.gupshup.io/partner/app/{{APP_ID}}/v3/message' \
--header 'accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: {{PARTNER_APP_TOKEN}}' \
--data '{
"messaging_product": "whatsapp",
"recipient_type": "individual",
"to": "PHONE_NUMBER",
"type": "template",
"template": {
"name": "TEMPLATE_NAME",
"language": {
"code": "LANGUAGE_AND_LOCALE_CODE"
},
"components": [
{
"type": "header",
"parameters": [
{
"type": "image",
"image": {
"link": "http(s)://URL"
}
}
]
},
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "TEXT_STRING"
},
{
"type": "currency",
"currency": {
"fallback_value": "VALUE",
"code": "USD",
"amount_1000": NUMBER
}
},
{
"type": "date_time",
"date_time": {
"fallback_value": "MONTH DAY, YEAR"
}
}
]
},
{
"type": "button",
"sub_type": "quick_reply",
"index": "0",
"parameters": [
{
"type": "payload",
"payload": "PAYLOAD"
}
]
},
{
"type": "button",
"sub_type": "quick_reply",
"index": "1",
"parameters": [
{
"type": "payload",
"payload": "PAYLOAD"
}
]
}
]
}
}'
Sample Response
{
"messages": [
{
"id": "GUPSHUP_MESSAGE_ID"
}
],
"messaging_product": "whatsapp",
"contacts": [
{
"input": "DESTINATION_PHONE_NO",
"wa_id": "DESTINATION_PHONE_NO"
}
]
}
Status Codes
Status Code | Response | Comments |
---|---|---|
Success | ||
200 | { "messages": [ { "id": "GUPSHUP_MESSAGE_ID" } ], "messaging_product": "whatsapp", "contacts": [ { "input": "DESTINATION_PHONE_NO", "wa_id": "DESTINATION_PHONE_NO" } ] } | |
Error | ||
400 | { "message": "Callback Billing must be enabled for this API", "status": "error" } | if Callback billing is not enabled for the app |
400 | { "message": "Invalid App Details", "status": "error" } | if app details are not found |
401 | { "status": "error", "message": "Authentication Failed" } | When API key authentication fails |