botbuilder v4 nodejs在提示对话框中添加快速回复Facebook Messenger

时间:2018-12-10 05:33:05

标签: 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)一样,但是不起作用。有针对这个的解决方法吗?谢谢您的帮助!

1 个答案:

答案 0 :(得分:0)

在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

希望这会有所帮助!