Location messages allow you to send a location's latitude and longitude coordinates to a WhatsApp user.
Use the POST /<WHATSAPP_BUSINESS_PHONE_NUMBER_ID>/messages endpoint to send a location message to a WhatsApp user.
POST /<WHATSAPP_BUSINESS_PHONE_NUMBER_ID>/messages
{ "messaging_product": "whatsapp", "recipient_type": "individual", "to": "<WHATSAPP_USER_PHONE_NUMBER>", "type": "location", "location": { "latitude": "<LOCATION_LATITUDE>", "longitude": "<LOCATION_LONGITUDE>", "name": "<LOCATION_NAME>", "address": "<LOCATION_ADDRESS>" } }
Placeholder | Description | Example Value |
---|---|---|
String | Optional. Location address. |
|
String | Required. Location latitude in decimal degrees. |
|
String | Required. Location longitude in decimal degrees. |
|
String | Optional. Location name. |
|
String | Required. WhatsApp user phone number. |
|
Example request to send a location message with a name and address.
curl 'https://graph.facebook.com/v20.0
/106540352242922/messages' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer EAAJB...' \
-d '{
"messaging_product": "whatsapp",
"recipient_type": "individual",
"to": "+16505551234",
"type": "location",
"location": {
"latitude": "37.44216251868683",
"longitude": "-122.16153582049394",
"name": "Philz Coffee",
"address": "101 Forest Ave, Palo Alto, CA 94301"
}
}'
{ "messaging_product": "whatsapp", "contacts": [ { "input": "+16505551234", "wa_id": "16505551234" } ], "messages": [ { "id": "wamid.HBgLMTY0NjcwNDM1OTUVAgARGBI1RjQyNUE3NEYxMzAzMzQ5MkEA" } ] }