Actionable Button Deprecated Payload
NOTE : This is the old payload for Rich buttons. With the new payload you can combine the different type of buttons with a single message. Please click here to see new payload for rich buttons.
Buttons
You can add any number of Buttons in your conversations for faster navigation. There are two types of Buttons supported in Kommunicate.
Link Button
Link Button redirects users to a given URL in a new tab. Use the below metadata to render the Link Buttons.
{
"message": "click on the buttons",
"platform":"kommunicate",
"metadata": {
"contentType": "300",
"templateId": "3",
"payload": [{
"type": "link",
"url": "https://www.google.com",
"name": "Go To Google"
},
{
"type": "link",
"url": "https://www.facebook.com",
"name": "Go To Facebook",
"openLinkInNewTab": false
}
]
}
}
Use openLinkInNewTab: false
to open any link in the same tab. Default value is true
, which will open the links in the new tab.
Submit Button
Submit Button allows you to post given data or redirect the user to a given URL. If parameter requestType:json
is included, it will post the data with content type application/json
on the formAction
URL and the replyText
will be used as acknowledgement message.
Default value for replyText
is same as the value passed in name
parameter. If requestType
parameter is not passed, it will submit the formData
with contentType application/x-www-form-urlencoded
and redirect the user on formAction
URL. The response will be rendered in new tab.
{
"message": "click the pay button",
"platform": "kommunicate",
"metadata": {
"contentType": "300",
"templateId": "3",
"payload": [{
"name": "Pay",
"replyText":"optional, will be used as acknowledgement message to user in case of requestType JSON. Default value is same as name parameter"
}],
"formData": {
"amount": "1000",
"description": "movie ticket"
},
"formAction": "https://example.com/book",
"requestType":"json"
}
}
Suggested Replies
Suggested Replies provide a way to send messages on a click without typing them all out manually. These are essentially the same as Suggestion Chips in Dialogflow and Postback Buttons in Facebook.
You can add any number of Suggested Replies by passing values in the metadata as described below.
{
"message": "Do you want more updates?",
"platform": "kommunicate",
"metadata": {
"contentType": "300",
"templateId": "6",
"payload": [{
"title": "Yes",
"message": "Cool! send me more."
}, {
"title": "No",
"message": "Not at all",
"replyMetadata": {
"KM_CHAT_CONTEXT": {
"buttonClicked": true
}
}
}]
}
}
replyMetadata
helps you to send custom data along with every suggested reply. Pair it with KM_CHAT_CONTEXT to receive data back when user click on the suggested reply.
The appearance of the Suggested Replies and Buttons will be adjusted automatically according to the customization you have done on your chat widget.
NOTE : This is the old payload for Rich buttons. With the new payload you can combine the different type of buttons with a single message. Please click here to see new payload for rich buttons.