![](/img/trans.png)
[英]Is there a way to push notification via a chatbot deployed in facebook developed with dialogflow w/ node.js for fulfillment
[英]Share button in Facebook chatbot in Node.js
这是一个较晚的更新,但会节省一些有用的时间。 在下面的代码的帮助下,您可以在Facebook聊天机器人上显示多个按钮。 用于开发的技术是节点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);
我能够显示分享按钮与下面的代码,但仍然结构显示内部卡两个按钮(1视图和2共享)。 下面的解决方案将用于显示使用Node js的chatbot平台中的共享按钮。
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);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.