There is a way to send my location to facebook-messenger from a mobile client, but how can I send some location from a bot? (messenger platform api)
When I try to send a similar structure from bot, I get an error:
(#100) Unsupported attachment type
Is there a way to send my location from bot?
Example of received message to bot:
{
"object": "page",
"entry": [{
"id": "1719442148306048",
"time": 1466780344978,
"messaging": [{
"sender": {"id": "123456789"},
"recipient": {"id": "987654321"},
"timestamp": 1466780344847,
"message": {
"mid": "mid.12345698875:c80066d69b6cee1779",
"seq": 65,
"attachments": [{
"title": "Dmitry's Location",
"url": "Link to bing.com through facebook redirect"
"type": "location",
"payload": {"coordinates": {"lat": 55, "long": 37}}
}]
}
}]
}]
}
I try send message with attachment like this:
"attachment": {
"type": "location",
"payload": {"coordinates": {"lat": 55, "long": 37}}
}
You can share your live location with friends in Messenger conversations to let them see where you are and when you'll arrive. When you share your live location, only the people in that conversation will be able to see where you are.
Location SharingYou or someone on your friends list can open up a chat dialog through Facebook Messenger, by tapping on the four dots found at the bottom left portion of your screen. Click Location. From there, just select Share Live Location and your friend will get to see your current location.
Dmitry, thanks for the hack! FB API has slightly changed, here's what worked for me in the payload section:
payload = dict()
payload['type'] = 'template'
payload['text'] = dict(
template_type="generic",
elements=[
dict(
title='{venue} location',
# subtitle='Test',
image_url="https://maps.googleapis.com/maps/api/staticmap?size=764x400¢er=" + lat + "," + long +
"&zoom=15&markers=" + lat + "," + long,
default_action=dict(
type="web_url",
url="http://maps.apple.com/maps?q=" + venue + "&ll=" + lat + "," + long +
"&z=15"
)
) # buttons=[])
]
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With