Location request messages display body text and a send location button. When a WhatsApp user taps the button, a location sharing screen appears which the user can then use to share their location.
Once the user shares their location, a messages webhook is triggered, containing the user's location details.
Use the POST /
curl 'https://graph.facebook.com// /messages' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer ' \ -d ' { "messaging_product": "whatsapp", "recipient_type": "individual", "type": "interactive", "to": " ", "interactive": { "type": "location_request_message", "body": { "text": " " }, "action": { "name": "send_location" } } }'
Placeholder | Description | Example Value |
---|---|---|
String | Required. |
|
String | Optional. Graph API version. | v23.0 |
String | Required. Message body text. Supports URLs. Maximum 1024 characters. |
|
String | Required. WhatsApp business phone number ID. |
|
String | Required. WhatsApp user phone number. |
|
When a WhatsApp user shares their location in response to your message, a messages webhook is triggered containing the user's location details.
{ "object": "whatsapp_business_account", "entry": [ { "id": "", "changes": [ { "value": { "messaging_product": "whatsapp", "metadata": { "display_phone_number": " ", "phone_number_id": " " }, "contacts": [ { "profile": { "name": " " }, "wa_id": " " } ], "messages": [ { "context": { "from": " ", "id": " " }, "from": " ", "id": " ", "timestamp": " ", "location": { "address": " ", "latitude": , "longitude": , "name": " " }, "type": "location" } ] }, "field": "messages" } ] } ] }
Placeholder | Description | Example Value |
---|---|---|
String | Location address. This parameter will only appear if the WhatsApp user chooses to share it. |
|
Number | Location latitude in decimal degrees. |
|
Number | Location longitude in decimal degrees. |
|
String | Location name. This parameter will only appear if the WhatsApp user chooses to share it. |
|
String | UNIX timestamp indicating when our servers processed the WhatsApp user's message. |
|
String | WhatsApp Business Account ID. |
|
String | WhatsApp business phone number's display number. |
|
String | WhatsApp business phone number. |
|
String | WhatsApp business phone number ID. |
|
String | WhatsApp message ID of message that the user is responding to. |
|
String | WhatsApp message ID of the user's message. |
|
String | WhatsApp user's WhatsApp ID. |
|
String | WhatsApp user's name. |
|
curl 'https://graph.facebook.com/v23.0
/106540352242922/messages' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer EAAJB...' \
-d '
{
"messaging_product": "whatsapp",
"recipient_type": "individual",
"type": "interactive",
"to": "+16505551234",
"interactive": {
"type": "location_request_message",
"body": {
"text": "Let'\''s start with your pickup. You can either manually *enter an address* or *share your current location*."
},
"action": {
"name": "send_location"
}
}
}'
{ "messaging_product": "whatsapp", "contacts": [ { "input": "+16505551234", "wa_id": "16505551234" } ], "messages": [ { "id": "wamid.HBgLMTY0NjcwNDM1OTUVAgARGBJCNUQ5RUNBNTk3OEQ2M0ZEQzgA" } ] }
{ "object": "whatsapp_business_account", "entry": [ { "id": "102290129340398", "changes": [ { "value": { "messaging_product": "whatsapp", "metadata": { "display_phone_number": "15550783881", "phone_number_id": "106540352242922" }, "contacts": [ { "profile": { "name": "Pablo Morales" }, "wa_id": "16505551234" } ], "messages": [ { "context": { "from": "15550783881", "id": "wamid.HBgLMTY0NjcwNDM1OTUVAgARGBI1QjJGRjI1RDY0RkE4Nzg4QzcA" }, "from": "16505551234", "id": "wamid.HBgLMTY0NjcwNDM1OTUVAgASGBQzQTRCRDcwNzgzMTRDNTAwRTgwRQA=", "timestamp": "1702920965", "location": { "address": "1071 5th Ave, New York, NY 10128", "latitude": 40.782910059774, "longitude": -73.959075808525, "name": "Solomon R. Guggenheim Museum" }, "type": "location" } ] }, "field": "messages" } ] } ] }