← Blog

·

How to Request a Customer’s Location with the WhatsApp Business API (Location Request)

Updated on November 24, 2026

To request a customer’s location with the WhatsApp Business API, send an interactive message of type location_request_message with the send_location action, inside the customer service window opened by the customer. They see your text with a send-location button; when they tap it, WhatsApp opens the location sharing screen. The reply reaches your webhook as a type: "location" message with latitude, longitude and, if the customer chooses, the place name and address.

This article covers the end-to-end flow: when to ask, how to word the request for each use case, how to match the reply to the right order, what to validate in the coordinates and what to do when the customer would rather type the address. For a general overview of sending and receiving locations, see the guide to location messages in the WhatsApp API.

When requesting a location makes sense

A location request solves a specific problem: addresses typed by hand arrive incomplete, misspelled or without a street number. Coordinates remove that ambiguity. It pays off in these cases:

  • Delivery and in-house couriers. Calculate the delivery fee by distance, check that the address is inside your delivery area and send the exact pin to the driver. See also WhatsApp for food delivery and restaurants.
  • Field visits and installations. Internet, solar panels, air conditioning, pest control: the technician gets to the right gate, even in gated communities, rural areas or streets without numbers.
  • Roadside and emergency assistance. Towing, locksmiths, car assistance: customers can’t always describe where they are, but they can tap a button.
  • Pointing to the nearest branch. Chains with several stores or clinics that need to route the customer.

When the address is already on file and reliable (a returning customer, an order placed on your website), don’t ask again. Just ask whether the delivery goes to the same place.

Meta rules you need to know

The location request is a regular interactive message, not a template. That has three consequences:

  1. Only inside the customer service window. Non-template messages can only be sent within 24 hours of the customer’s last message. Details in the WhatsApp 24-hour customer service window.
  2. Body up to 1,024 characters. The location request messages documentation sets this limit and says the body supports URLs.
  3. No header, footer or custom button label. The interactive object has only body and an action with name: "send_location".

Outside the window, you need an approved template, for example a utility template that notifies the customer and invites a reply; once they reply, the window opens and you can send the location request.

Want to try it while you read? Create a Vectalk account and send your first message through the official API. Create free account →

The request JSON

Request to the Cloud API messages endpoint (the example number is Brazilian; use the recipient’s number in international format without +):

curl -X POST "https://graph.facebook.com/v27.0/PHONE_NUMBER_ID/messages" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "messaging_product": "whatsapp",
    "recipient_type": "individual",
    "to": "5511988887777",
    "type": "interactive",
    "interactive": {
      "type": "location_request_message",
      "body": {
        "text": "To schedule the technician visit, tap *Send location*. Prefer typing? Reply with street, number, neighborhood and ZIP code."
      },
      "action": {
        "name": "send_location"
      }
    }
  }'

The response returns the wamid of the message you sent. Store that ID: it’s how you will recognize the customer’s reply.

{
  "messaging_product": "whatsapp",
  "contacts": [{ "input": "5511988887777", "wa_id": "5511988887777" }],
  "messages": [{ "id": "wamid.HBgNNTUxMTk4ODg4Nzc3NxUCABEYEjQ0QkRBQjQ4MjM0NTZBRkYxAA==" }]
}

Request copy by use case

The body text decides whether the customer taps the button or ignores it. Be specific about why you’re asking and always offer a fallback:

Use caseSuggested text
Delivery“To calculate your delivery fee, tap Send location. Prefer typing? Send street, number and neighborhood.”
Field visit“So the technician reaches the right place, send the property’s location. Not there right now? Type the address with ZIP code.”
24/7 assistance“Send your current location so we can dispatch the nearest help.”
Nearest branch“Share your location and we’ll point you to the closest branch.”

Note the field visit case: the customer may be at work, far from the property. Tell them to type the address in that situation.

What arrives in the webhook

When the customer shares, Meta sends a messages webhook with type: "location". According to the documentation, the location object contains:

FieldTypeNote
latitudenumberDecimal degrees
longitudenumberDecimal degrees
namestringOnly if the customer chooses to share it
addressstringOnly if the customer chooses to share it

The message also includes from, id, timestamp and a context.id pointing to the request message you sent. Excerpt of value:

{
  "messages": [{
    "context": {
      "from": "551130000000",
      "id": "wamid.HBgNNTUxMTk4ODg4Nzc3NxUCABEYEjQ0QkRBQjQ4MjM0NTZBRkYxAA=="
    },
    "from": "5511988887777",
    "id": "wamid.HBgNNTUxMTk4ODg4Nzc3NxUCABIYFjNFQjBDQTk5RTI0RkU0QjMwMzlBAA==",
    "timestamp": "1764000000",
    "type": "location",
    "location": {
      "latitude": -23.561414,
      "longitude": -46.655881
    }
  }]
}

Notice that name and address are missing: that’s the common case when the customer sends their current pin without picking a place from the list. Don’t depend on those fields. The full webhook payload, with entry, changes and metadata, is in WhatsApp webhook payload examples.

Matching the reply to the right request

A customer may have an open delivery order and a scheduled field visit at the same time. To know which one the location belongs to, use context.id. The same quoting mechanism is explained in how to reply to a specific message.

The flow looks like this:

  1. When sending the request, save wamid → { order_id, purpose, sent_at }.
  2. When a type: "location" message arrives, look up its context.id in that table.
  3. If found, attach the coordinates to the order. If not (the customer sent a location on their own, through the attachment menu), use the most recent open conversation for that number.

Node.js (Express) example, with a Map standing in for the database:

const locationRequests = new Map(); // wamid -> { orderId, purpose }

async function requestLocation(to, orderId, purpose, text) {
  const res = await fetch(`https://graph.facebook.com/v27.0/${process.env.PHONE_NUMBER_ID}/messages`, {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.TOKEN}`,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      messaging_product: "whatsapp",
      recipient_type: "individual",
      to,
      type: "interactive",
      interactive: {
        type: "location_request_message",
        body: { text },
        action: { name: "send_location" }
      }
    })
  });
  const data = await res.json();
  const wamid = data.messages?.[0]?.id;
  if (wamid) locationRequests.set(wamid, { orderId, purpose });
  return wamid;
}

function handleLocation(msg) {
  const { latitude, longitude, name, address } = msg.location;
  const origin = msg.context?.id ? locationRequests.get(msg.context.id) : null;
  return {
    orderId: origin?.orderId ?? null, // null = look up the number's open conversation
    purpose: origin?.purpose ?? "unknown",
    latitude,
    longitude,
    placeName: name ?? null,
    address: address ?? null,
    receivedAt: new Date(Number(msg.timestamp) * 1000).toISOString()
  };
}

In production, replace the Map with a table indexed by wamid, and return 200 to the webhook before processing.

Validating the coordinates

Getting the pin isn’t the end. Before confirming with the customer, check:

  • Service area. Calculate the distance to the store or base (Haversine formula or your geospatial database’s distance function) and compare it with your service radius. If it’s outside, say so right away, while the window is still open.
  • A pin that fits the purpose. For field visits, confirm with the customer: “Will the visit be at this location?” with two reply buttons (Yes / Fix address).
  • Address details. Coordinates don’t tell you the apartment, building or landmark. Ask for those next, as free text.

A sequence that works well: location request → confirmation with buttons → request for address details → final summary with date, time and address.

Fallback: when the customer types the address

Some customers will reply with text even when the button is there. Your system needs to accept both:

  1. If a type: "text" message arrives while a location request is pending, treat it as a typed address.
  2. Extract the postal code (in Brazil, the CEP has 8 digits) and query a postal code database to fill in street, neighborhood and city.
  3. If you need coordinates, use a geocoding service to convert the address.
  4. Confirm the result with the customer before moving on.

If the customer doesn’t reply, you can send a reminder while the window is open. After it closes, only with an approved template.

Showing the way: the other side of the flow

After receiving the location, you often want to send something back: your store’s pin (a type: "location" message) or an order-tracking link. For the link, a button is clearer than a bare URL in the text; see the CTA URL link button. The other interactive message types are covered in the guide to WhatsApp interactive messages.

Privacy and data protection

Location is personal data, and combined with other data it can reveal routines, home address and workplace. In Brazil, the General Data Protection Law (LGPD, Law No. 13,709/2018) requires a defined purpose, necessity and security when processing personal data; other countries have similar rules, such as the GDPR in Europe. In practice:

  • State in the request text what the location will be used for.
  • Keep only what you need, for as long as you need it: the delivery pin, not a history of locations.
  • Restrict access: the driver needs the pin for that delivery, not the whole database.

This content is informational and is not a substitute for advice from a lawyer.

How to do this with Vectalk

Vectalk is a proxy for Meta’s official WhatsApp Cloud API: the request body is the same as Meta’s. To request a location, send the JSON above to POST https://apis.vectalk.com.br/api/messages with the header Authorization: Bearer YOUR_TOKEN. With an instance token, the phone_number_id is resolved automatically; with an organization token, include phone_number_id in the body.

Replies arrive at the webhook you configure on the instance, in the same format as Meta’s documentation. Vectalk has no inbox or customer service automation in its dashboard: the request, validation and confirmation flow runs in your own system. See the Vectalk documentation and create your account. For the big picture, read the guide to the official WhatsApp API.

Frequently asked questions

Can I request the location of someone who has never messaged me?

Not with an interactive message: it requires an open customer service window. Outside the window, send an approved template and, once the customer replies, send the location request.

Why did the webhook arrive without an address?

The name and address fields only appear if the customer chooses to share them. When they send their current pin, you usually get only latitude and longitude. Convert the coordinates into an address in your system if you need one.

How do I know which order the location belongs to?

From the context.id of the incoming message, which points to the wamid of your location request. Store that ID when you send it.

Can I customize the button label?

No. The request only has the body text and the send_location action. WhatsApp displays the button label.

Can I get real-time location?

The location request documentation describes sending a single pin. To follow movement, ask for new pins when needed or use your own tracking app.


Official sources consulted on November 24, 2026: Location request messages · Send messages · Law No. 13,709/2018 (LGPD) · Vectalk documentation

Put your business on the official WhatsApp

Create your account, connect your number to the official API (you can keep the app with coexistence) and start serving customers and sending messages.