简体   繁体   English

在Node.js中的Facebook chatbot中分享按钮

[英]Share button in Facebook chatbot in Node.js

I want to implement share button inside my chatbot. 我想在我的聊天机器人中实现分享按钮。 On click of share button the message will get shared with selected contact list. 单击“共享”按钮,将与选定的联系人列表共享该消息。 Image FB_ChatBot.png is what I am trying to implement inside my chatbot and Share_Btn_Output 我正在尝试在chatbot和Share_Btn_Output中实现图像FB_ChatBot.png

在此输入图像描述

This png is output produced by share button clicked. 此png是单击分享按钮产生的输出。

It's an late update but will save someone usefull time. 这是一个较晚的更新,但会节省一些有用的时间。 With help of below code you can show multiple buttons on facebook chatbot. 在下面的代码的帮助下,您可以在Facebook聊天机器人上显示多个按钮。 Technology used for development is node js,botbuilder,luis. 用于开发的技术是节点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);

在此输入图像描述

I am able to show share button with below code but still struct with showing two button (1 View and 2 Share) inside cards. 我能够显示分享按钮与下面的代码,但仍然结构显示内部卡两个按钮(1视图和2共享)。 Below solution will work for showing share button in chatbot platform used Node js. 下面的解决方案将用于显示使用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);

Output image below, 输出图片如下, 在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 有没有一种方法可以通过部署在使用nodeflow.js的dialogflow开发的facebook中的聊天机器人来推送通知以实现 - Is there a way to push notification via a chatbot deployed in facebook developed with dialogflow w/ node.js for fulfillment 带有适用于NLP的node.js和python的Chatbot - Chatbot with node.js and python for NLP 如何解决使用node.js和heroku创建facebook聊天机器人的'curl -x post命令错误'参数subscribed_fields是必需的? - How to solve 'The parameter subscribed_fields is required ' curl -x post command error, for creating a facebook chatbot using node.js and heroku? 在IBM Watson node.js chatbot中运行python脚本 - Running python script in IBM Watson node.js chatbot 使用 react 和 node.js 制作聊天机器人时出错 - Having errors while making a chatbot using react and node.js 使用node.js登录Facebook - facebook login with node.js Node.js Facebook API - Node.js Facebook API 带有节点,express.js,ngrok和Dialogflow的Facebook聊天机器人 - Facebook chatbot with node, express.js, ngrok and Dialogflow 如何使用node.js和javascript模仿Facebook的“链接共享”功能 - How to mimic Facebook's “link share” functionality using node.js and javascript node.js - 共享进程之间的套接字 - node.js - share sockets between processes
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM