Attaching location
Attaching location
Locations can be attached to Direct Messages created with POST direct_messages/events/new. The location is defined as an attachement object with longitue and latitude coordinates or a Twitter place.
Example message with shared coordinate attachment
{
"event": {
"type": "message_create",
"message_create": {
"target": {
"recipient_id": "844385345234"
},
"message_data": {
"text": "Here's my location",
"attachment": {
"type": "location",
"location": {
"type": "shared_coordinate",
"shared_coordinate": {
"coordinates": {
"type": "Point",
"coordinates": [-122.443893, 37.771718]
}
}
}
}
}
}
}
}
Example message with shared place attachment
{
"event": {
"type": "message_create",
"message_create": {
"target": {
"recipient_id": "844385345234"
},
"message_data": {
"text": "Here's my location",
"attachment": {
"type": "location",
"location": {
"type": "shared_place",
"shared_place": {
"place": {
"id": "123456"
}
}
}
}
}
}
}
}
}
Note: Not all place IDs are discoverable with GET geo/search. To retrieve all available details for a place ID you may also use GET geo/id/:place_id.