Thuan Nguyen
Thuan Nguyen

Reputation: 11

botbuilder v4 nodejs add quick reply facebook messenger in prompt dialog

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)
}

I want to add quick replies FB Messenger when prompt location in botbuilder v4 like this one (https://developers.facebook.com/docs/messenger-platform/send-messages/quick-replies/#best_practices) but it not works. Is there a solution to this? Thank you for helping me!

Upvotes: 1

Views: 392

Answers (1)

tdurnford
tdurnford

Reputation: 3712

In v4 of the Microsoft Botframework, Facebook location quick replies can be sent using the channelData attribute in the activity. See the example below.

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

enter image description here

Hope this helps!

Upvotes: 1

Related Questions