Get users current location from Facebook messenger Chatbot api
12,751
Solution 1
The only way to get the location is when the user sends it: https://developers.facebook.com/docs/messenger-platform/send-api-reference/quick-replies
More information: How to send location from Facebook messenger platform?
Solution 2
Pretty sure there is no automatic geo-location support in the FB messenger API but:
- On mobile you can have them submit their location using the location icon, this works pretty well (gives you their lat and long)
- On both desktop and mobile you can ask them to input their location, then use that information to get their coordinates
Author by
Charan Goud
Updated on June 04, 2022Comments
-
Charan Goud almost 2 years
I am working on fb messenger bot and I want to access user's current location without them sending it as an attachment.I tried to get user's current location from fb graph API but it seems like to return the user's location from their profile. I need something like real time geo coordinates.
Thanks in Advance!
-
Lejdi Prifti almost 8 yearsYou can't. The user has to send it
-
-
Metablocks Corp almost 8 yearsUnfortunately you don't have access to Javascript in the FB Bot API
-
andyrandy almost 8 yearsthen it´s not possible at all in an automatic way (without user interaction)
-
Metablocks Corp almost 8 yearsCorrect. There is no Javascript access and you can't get users IP address and the API won't give you the location.
-
Jarrod McGuire almost 6 yearsSo does mean everytime you want a location you need to ask for it via the quick reply, or does a permission get set that allows it for a period of time?