javascript - botbuilder v4 nodejs 在提示对话框中添加快速回复 facebook messenger

标签 javascript node.js botframework messenger

async locationStep(step) {
    await step.context.sendActivity('Please give me your location')
    const reply = MessageFactory.suggestedActions(['Send location'])
    reply.suggestedActions.actions[0].content_type = 'location'
    reply.suggestedActions.actions[0].type = 'location'
    return step.prompt(LOCATION_PROMPT, reply)
}

我想在 botbuilder v4 中提示位置时添加快速回复 FB Messenger 像这个 ( https://developers.facebook.com/docs/messenger-platform/send-messages/quick-replies/#best_practices ) 但它不起作用。有针对这个的解决方法吗?谢谢你帮助我!

最佳答案

在Microsoft Botframework v4 中,可以使用事件中的channelData 属性发送Facebook 位置快速回复。请参见下面的示例。

await turnContext.sendActivity({
    text: 'Would you mind sharing your location?',
    channelData: {
        "quick_replies":[
            {
                "content_type": "location"
            }
        ]
    }
});

enter image description here

希望这对您有所帮助!

关于javascript - botbuilder v4 nodejs 在提示对话框中添加快速回复 facebook messenger,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53700011/

相关文章:

node.js - 只允许通过 nginx 和 docker 访问express app

azure - 我们可以在没有 Azure 的情况下在 IIS 中部署 Microsoft bot 应用程序吗?

c# - 使用网络应用程序通过机器人主动发送消息

javascript - vue-router:防止参数更改时的路由

javascript - 在 AngularJS 中处理 $q.all 和 promises 时出错

javascript - 如何控制打印调查的页面?

javascript - 在 React js 中如何将映射转换为数组时进行连接?

node.js - Node 请求添加 header

node.js - 尝试修复 NPM 安装时出错

node.js - Nodejs SDK - 合并对话框 + 意图