在Node.js的Facebook chatbot中共享button

我想实现我的chatbot中的分享button。 点击分享button后,该消息将与选定的联系人列表共享。 Image FB_ChatBot.png就是我在chatbot和Share_Btn_Output

在这里输入图像说明

这个png是通过点击分享button产生的输出。

这是一个较晚的更新,但会节省一些有用的时间。 在下面的代码的帮助下,你可以在facebook chatbot上显示多个button。 用于开发的技术是node js,botbuilder,luis。

var msg = new builder.Message(session); msg.sourceEvent({ "facebook": { "attachment": { "type": "template", "payload": { "template_type": "button", "text": "You can either hit 'FAQ' to get the help, or head to the Mannual Help for getting help.", "buttons": [ { "type": "web_url", "url": 'https://stackoverflow.com/', "title": "Mannual Help" }, { "type": "postback", "title": "FAQ", "payload": "FAQ_SELECTED_BY_USER" }] } } } }); session.send(msg); 

在这里输入图像说明

我能够显示共享button,下面的代码,但仍然显示内部卡两个button(1视图和2共享)结构。 下面的解决scheme将用于显示聊天机器人平台使用节点js中的共享button。

 var msg = new builder.Message(session); msg.sourceEvent({ facebook: { attachment: { type: "template", payload: { template_type: "generic", elements: [{ title: "title", subtitle: "subtitle", image_url: "https://external.xx.fbcdn.net/safe_image.php?d=AQBIbeQ2vl8bb5tl&url=http%3A%2F%2Fimagizer.imageshack.us%2F196x92f%2F924%2FySQ7a9.png&_nc_hash=AQAv9cZ-0jAr9REX", item_url: "url", buttons: [{ type: "element_share" }] }] } } } }); session.send(msg); 

下面输出图片, 在这里输入图像说明