简体   繁体   English

如何从 MS Chatbot 中的 m.me 链接捕获推荐参数?

[英]How to capture Referral parameters from m.me links inside MS Chatbot?

I have integrated a survey chatbot with my Facebook page.我在我的 Facebook 页面上集成了一个调查聊天机器人。 I want to send personalised m.me links to my users via email.我想通过电子邮件向我的用户发送个性化的 m.me链接。 These links contain a unique referral parameter that can identify a user's transaction.这些链接包含一个唯一的推荐参数,可以识别用户的交易。 So when a user clicks the m.me link I want my chatbot to capture this parameter from the link and send a proactive personalised welcome message to the user.因此,当用户单击 m.me 链接时,我希望我的聊天机器人从链接中捕获此参数并向用户发送主动的个性化欢迎消息。 So far I've unsuccessfully tried using a middleware to capture payloads from incoming requests.到目前为止,我已经尝试使用中间件从传入请求中捕获有效负载,但没有成功。

const restify = require('restify');
let server = restify.createServer();
server.listen(process.env.port || process.env.PORT || 80, function () {
console.log(`\n${server.name} listening to ${server.url}`);
console.log(`\nGet Bot Framework Emulator: https://aka.ms/botframework-emulator`);
console.log(`\nTo talk to your bot, open simplePrompts.bot file in the Emulator`);});
server.use(restify.plugins.bodyParser());
// Listen for incoming requests.
server.post('/api/messages', (req, res) => {
console.log(req.body);
adapter.processActivity(req, res, async (context) => {
    // Route to main dialog.
    await myBot.onTurn(context);
    });
});

You have to subscribe for messaging_referrals in your webhook.您必须在 webhook 中订阅 messaging_referrals。 Then you would get the referral parameter as well.然后你也会得到推荐参数。 You can read how to set it up and how the event will be provided from the documentation here: https://developers.facebook.com/docs/messenger-platform/reference/webhook-events/messaging_referrals/您可以阅读如何设置它以及如何从此处的文档中提供事件: https ://developers.facebook.com/docs/messenger-platform/reference/webhook-events/messaging_referrals/

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

相关问题 如何从 MS Teams 聊天机器人部分打开动态自定义选项卡 - How to open Dynamic custom tab from MS Teams chatbot section 如何以编程方式从网络选项卡捕获查询字符串参数 - How to capture query string parameters from network tab programmatically 如何用一个单词获取Chatbot(API.ai)的参数 - How to get parameters in a word for Chatbot(API.ai) 如何从 aws 聊天机器人对话创建 pdf - how to create pdf from aws chatbot conversation 将 html 链接添加到聊天机器人的响应中 - Adding html links to response of chatbot 如何在nodejs中创建推荐链接 - How to create a referral link in nodejs 如何在Express Route中捕获不确定数量的参数? - How to capture indefinite number of parameters in Express Route? 如何从msteams中的ChatBot获取群聊添加的成员列表 - How to get the Group chat added member list from ChatBot in msteams 如何使用 Puppeteer 捕获页面中的所有链接? - How can I capture all links in a page with Puppeteer? 我正在编写一个 discord 机器人,但是当我使用 ping 命令时,它会显示 0 毫秒。 我应该怎么办? - I'm coding a discord bot, but when I'm using the ping command its shows me 0 ms. what should i do?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM