I am having trouble to get exact look and feel like this,
https://developers.facebook.com/docs/messenger-platform/send-api-reference/list-template
You'll need to send a raw FB message via ChannelData/SourceEvent to display a List Template.
@craigjensen:
I have attempted to use the sourceEvent workaround but with no avail.
Every time I try to send this, I get a log out of the following:
_Error: Request to 'https://facebook.botframework.com/v3/conversations/1314733455250332-1257481210956934/activities/mid.1484799216105%3Acfddfe3b84' failed: [400] Bad Request_
This is my code for trying to do so:
var card = {
facebook: {
attachment: {
type: "template",
payload: {
template_type: "list",
elements: [
{
title: 'title',
image_url: null,
subtitle: 'subtitle subtitle subtitle',
buttons: [
{
title: 'title',
type: 'web_url',
url: 'http://www.google.com.au',
messenger_extensions: false,
webview_height_ratio: 'compact',
fallback_url: 'http://google.com.au'
}
]
},
{
title: 'title',
image_url: null,
subtitle: 'subtitle subtitle subtitle',
buttons: [
{
title: 'title',
type: 'web_url',
url: 'http://www.google.com.au',
messenger_extensions: false,
webview_height_ratio: 'compact',
fallback_url: 'http://google.com.au'
}
]
}
]
}
}
}
}
var msg = new builder.Message(session).sourceEvent(card);
session.send(msg);
Any help would be highly appreciated.
Thanks,
Scott
Try this:
var card = {
facebook: {
attachment: {
type: "template",
payload: {
template_type: "list",
top_element_style: "compact",
elements: [
{
title: 'title',
image_url: null,
subtitle: 'subtitle subtitle subtitle',
buttons: [
{
title: 'title',
type: 'web_url',
url: 'http://www.google.com.au',
webview_height_ratio: 'compact'
}
]
},
{
title: 'title',
image_url: null,
subtitle: 'subtitle subtitle subtitle',
buttons: [
{
title: 'title',
type: 'web_url',
url: 'http://www.google.com.au',
webview_height_ratio: 'compact'
}
]
}
]
}
}
}
}
@craigjensen; Wow. I don't know how I could have missed that. I was using the example on the FB dev page - I guess that's out of date.
Thanks a ton for that.
Glad to hear its working now. I'll go ahead and close this issue. Feel free to reopen if needed
Most helpful comment
Try this: