Postback Text Support

Allow users to add postback text to quick reply buttons in template send message API.

cURL Request

curl --location '{{api_front_base_url}}/wa/api/v1/template/msg' \
--header 'apikey: {{apiKey}}' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'channel=whatsapp' \
--data-urlencode 'source={{source phone number}}' \
--data-urlencode 'destination={{destination phone number}}' \
--data-urlencode 'src.name={{app_name}}' \
--data-urlencode 'template={{template}}' \
--data-urlencode 'message={{message}}' \
--data-urlencode 'postbackTexts={{[{"index":3,"text":"hello"}]}}'

Response

Success

{
  "status": "submitted",
  "messageId": "3867730a-bb97-4ea5-bad6-e6e34201ce89"
}

Error

When API authentication fails.

{
  "message": "Authentication Failed",
  "status": "error"
}

Expected Response On Callback

{
    "app": "<APP_NAME>",
    "phone": "<APP_PHONE_NUMBER>",
    "timestamp": 1712230664720,
    "version": 2,
    "type": "message",
    "payload": {
        "id": "<MESSAGE_ID>",
        "source": "<PHONE_NUMBER>",
        "type": "quick_reply",
        "payload": {
            "text": "<BUTTON_TEXT>",
            "type": "button",
            "postbackText": "<POSTBACK_TEXT>"
        },
        "sender": {
            "phone": "<SENDER_PHONE>",
            "name": "<SENDER_NAME>",
            "country_code": "91",
            "dial_code": "<SENDER_PHONE>"
        },
        "context": {
            "id": "<MESSAGE_ID>",
            "forwarded": false,
            "frequently_forwarded": false
        }
    }
}

Request Parameters

Header

HeaderDescriptionConstraints
apikeyApikey of the account where the app is to be created.It should be a valid gupshup.io apikey

Form Parameters

Parameter

Description

Example

source

Source Phone Number

+1234567890

destination

Destination Phone Number

+0987654321

src.name

App Name

MyApp

channel

Channel

whatsapp

template

JSON containing template details.

All parameters in the main message bubble and cards must be in the params array in order.

{
  "id": "\<template_id>",
  "params": [  
    <list_of_template_parameters>  
  ]
}

message

Message

For the carousel, message JSON and the media ID/link will also contain the postbackTexts here index is the button index (starts from 0) and text is the postback text for that button.

{
  "type": "carousel",
  "cardHeaderType": "\<IMAGE/VIDEO>",
  "cards": \[
    {
      "id/link": "\<image_id or image_link/video_id or video_link>",
      "postbackTexts":[{"index":0,"text":"hello"}]
    },
  ]
}

postbackTexts

Postback Texts for quick reply buttons

[  
  {  
    "index": 3, // button index starts from 0  
    "text": "hello" //postback text for the button  
  }  
]

Response Parameters

ParameterDescriptionExample
statusMessage statussubmitted
messageMessage-Id3867730a-bb97-4ea5-bad6-e6e34201ce89
Language
Click Try It! to start a request and see the response here!