5

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!

1
  • 1
    You can't. The user has to send it
    – WizKid
    Jul 31, 2016 at 5:27

2 Answers 2

5

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?

4
  • 1
    Unfortunately you don't have access to Javascript in the FB Bot API Aug 1, 2016 at 2:20
  • then it´s not possible at all in an automatic way (without user interaction)
    – andyrandy
    Aug 1, 2016 at 5:52
  • Correct. There is no Javascript access and you can't get users IP address and the API won't give you the location. Aug 1, 2016 at 6:47
  • So 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? Jun 9, 2018 at 22:56
2

Pretty sure there is no automatic geo-location support in the FB messenger API but:

  1. On mobile you can have them submit their location using the location icon, this works pretty well (gives you their lat and long)
  2. On both desktop and mobile you can ask them to input their location, then use that information to get their coordinates
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.