@akeland
I just figured out, after some inspecting and comparison with quick_replies
Answer is check below… If any have issue like this problems…
Facebook’s example demo for generic template :
curl -X POST -H "Content-Type: application/json" -d '{
"recipient":{
"id":"<PSID>"
},
"message":{
"attachment":{
"type":"template",
"payload":{
"template_type":"generic",
"elements":[
{
"title":"Welcome!",
"image_url":"https://petersfancybrownhats.com/company_image.png",
"subtitle":"We have the right hat for everyone.",
"default_action": {
"type": "web_url",
"url": "https://petersfancybrownhats.com/view?item=103",
"webview_height_ratio": "tall",
},
"buttons":[
{
"type":"web_url",
"url":"https://petersfancybrownhats.com",
"title":"View Website"
},{
"type":"postback",
"title":"Start Chatting",
"payload":"DEVELOPER_DEFINED_PAYLOAD"
}
]
}
]
}
}
}
}' "https://graph.facebook.com/v2.6/me/messages?access_token=<PAGE_ACCESS_TOKEN>"
And this way, You can use above example in our custom action file :
gt = {
"attachment": {
"type": "template",
"payload": {
"template_type": "generic",
"elements": [
{
"title": "Welcome! 1",
"image_url": "https://picsum.photos/200",
"subtitle": "We have the right hat for everyone.",
"default_action": {
"type": "web_url",
"url": "https://tithal.life",
"webview_height_ratio": "tall",
},
"buttons": [
{
"type": "web_url",
"url": "https://tithal.life",
"title": "View Website"
},
{
"type": "postback",
"title": "Start Chatting",
"payload": "DEVELOPER_DEFINED_PAYLOAD"
}
]
},
{
"title": "Welcome! 2",
"image_url": "https://picsum.photos/200",
"subtitle": "We have the right hat for everyone.",
"default_action": {
"type": "web_url",
"url": "https://tithal.life",
"webview_height_ratio": "tall",
},
"buttons": [
{
"type": "web_url",
"url": "https://tithal.life",
"title": "View Website"
},
{
"type": "postback",
"title": "Start Chatting",
"payload": "DEVELOPER_DEFINED_PAYLOAD"
}
]
}
]
}
}
}
dispatcher.utter_custom_json(gt)
Compare both code and anyone can figure it out.
Thanks