post https://api.gupshup.io/wa/api/v1/template/msg
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
| Header | Description | Constraints |
|---|---|---|
| apikey | Apikey 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 |
|
destination | Destination Phone Number |
|
src.name | App Name |
|
channel | Channel |
|
template | JSON containing template details. | All parameters in the main message bubble and cards must be in the params array in order. |
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. |
postbackTexts | Postback Texts for quick reply buttons | |
Response Parameters
| Parameter | Description | Example |
|---|---|---|
| status | Message status | submitted |
| message | Message-Id | 3867730a-bb97-4ea5-bad6-e6e34201ce89 |
