Location Messages

Location messages allow you to send a location's latitude and longitude coordinates to a WhatsApp user.

Sending Text Messages

Use the POST /<WHATSAPP_BUSINESS_PHONE_NUMBER_ID>/messages endpoint to send a location message to a WhatsApp user.

Request Syntax

POST /<WHATSAPP_BUSINESS_PHONE_NUMBER_ID>/messages

Post Body

{
  "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>"
  }
}

Post Body Parameters

PlaceholderDescriptionExample Value

<LOCATION_ADDRESS>

String

Optional.

Location address.

101 Forest Ave, Palo Alto, CA 94301

<LOCATION_LATITUDE>

String

Required.

Location latitude in decimal degrees.

37.44216251868683

<LOCATION_LONGITUDE>

String

Required.

Location longitude in decimal degrees.

-122.16153582049394

<LOCATION_NAME>

String

Optional.

Location name.

Philz Coffee

<WHATSAPP_USER_PHONE_NUMBER>

String

Required.

WhatsApp user phone number.

+16505551234

Example Request

Example request to send a location message with a name and address.

curl 'https://graph.facebook.com/v21.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"
    }
}'

Example Response

{
  "messaging_product": "whatsapp",
  "contacts": [
    {
      "input": "+16505551234",
      "wa_id": "16505551234"
    }
  ],
  "messages": [
    {
      "id": "wamid.HBgLMTY0NjcwNDM1OTUVAgARGBI1RjQyNUE3NEYxMzAzMzQ5MkEA"
    }
  ]
}