Skip to content

Instantly share code, notes, and snippets.

@devStepsize
Created April 22, 2016 19:48
Show Gist options
  • Save devStepsize/8b54a579b572ecec9c43503e6e2cc45c to your computer and use it in GitHub Desktop.
Save devStepsize/8b54a579b572ecec9c43503e6e2cc45c to your computer and use it in GitHub Desktop.
Botkit reply to Facebook with attachments (from https://github.com/howdyai/botkit#botreply)
bot.reply(message, {
attachment: {
'type':'template',
'payload':{
'template_type':'generic',
'elements':[
{
'title':'Classic White T-Shirt',
'image_url':'http://petersapparel.parseapp.com/img/item100-thumb.png',
'subtitle':'Soft white cotton t-shirt is back in style',
'buttons':[
{
'type':'web_url',
'url':'https://petersapparel.parseapp.com/view_item?item_id=100',
'title':'View Item'
},
{
'type':'web_url',
'url':'https://petersapparel.parseapp.com/buy_item?item_id=100',
'title':'Buy Item'
},
{
'type':'postback',
'title':'Bookmark Item',
'payload':'USER_DEFINED_PAYLOAD_FOR_ITEM100'
}
]
},
{
'title':'Classic Grey T-Shirt',
'image_url':'http://petersapparel.parseapp.com/img/item101-thumb.png',
'subtitle':'Soft gray cotton t-shirt is back in style',
'buttons':[
{
'type':'web_url',
'url':'https://petersapparel.parseapp.com/view_item?item_id=101',
'title':'View Item'
},
{
'type':'web_url',
'url':'https://petersapparel.parseapp.com/buy_item?item_id=101',
'title':'Buy Item'
},
{
'type':'postback',
'title':'Bookmark Item',
'payload':'USER_DEFINED_PAYLOAD_FOR_ITEM101'
}
]
}
]
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment