Treber Lagrosa
Treber Lagrosa

Reputation: 3

How to get location (lat & long) sent by user from Facebook messenger bot through Dialog Flow?

I'm creating a emergency chatbot in dialogflow that can get the location of the user.

my custom paload

sample talks

So what I'm trying to achieve is to get the Latitude and Longitude from that location like how and store it in variable like this

var lat = latitude
var long = longitude

Upvotes: 0

Views: 928

Answers (2)

Marvin Ajcuc
Marvin Ajcuc

Reputation: 36

Create a custom follw-up intent with event input called FACEBOOK_LOCATION, then the lat and lng is set in context facebook_location, you can print this in a dialwoflow response with "lat: #facebook_location.lat, long: #facebook_location.long"

Image example:

enter image description here

Upvotes: 1

Slatan-ko
Slatan-ko

Reputation: 266

you can get information from webhook event in payload.coordinates property

reference : https://developers.facebook.com/docs/messenger-platform/send-messages/quick-replies

Upvotes: 1

Related Questions