· 4 min · TextMeFlow Team

Handling WhatsApp Location Messages via the API

A customer typing "third house past the bridge, blue door" isn't the exception — it's the norm for couriers, tradespeople and movers. A typed address is error-prone: wrong house numbers, missing unit numbers, street names that autocomplete gets wrong. WhatsApp has had a solution for years that few businesses actually use: the user can share their exact GPS position as a location message instead of putting it into words. Through the TextMeFlow API, that location message arrives on your existing webhook just like any other message — you only need to know how to recognize it.

How a location message arrives

Every incoming message — text, photo, document or location — arrives through the same InboundMessage payload on your webhook URL, as described in the webhook documentation. The type field tells them apart:

{
  "type": "location",
  "from": "32472932208",
  "from_name": "Jan Janssens",
  "to": "32499123456",
  "file": "null",
  "message": "51.2194,4.4025"
}

With type: "location", the position isn't in a separate field — it's a string in message: "<lat>,<lng>". There's no address, no place name — just the two coordinates, exactly as the WhatsApp app sends them the moment the customer shares their pin.

Processing the coordinates in your own system

Split the string on the comma and use the two values as plain float coordinates. In PHP, as you'd receive it in a Laravel controller:

if ($payload['type'] === 'location') {
    [$lat, $lng] = explode(',', $payload['message']);

    $mapsUrl = "https://www.google.com/maps?q={$lat},{$lng}";

    Order::where('phone', $payload['from'])
        ->latest()
        ->first()
        ?->update(['delivery_lat' => $lat, 'delivery_lng' => $lng]);
}

With that link, a courier or technician can open the pin directly in Google Maps or Waze — no address needed, just the exact position. If you want to calculate distance or travel time yourself, just pass $lat/$lng to whatever geocoding or routing API you already use (OpenRouteService, Google Routes, OSRM).

Practical use cases

A few sectors where this makes an immediate difference:

  • Couriers and delivery — the customer shares their location instead of typing an address that doesn't match the courier's navigation. This pairs well with the delivery updates from WhatsApp updates for couriers and logistics.
  • Tradespeople and installers — a technician on the way to a job gets the exact location of the site or property, even when the address doesn't match what's listed in Google Maps. This complements the ETA communication from WhatsApp for tradespeople and installers.
  • Moving companies — a quote request with the exact location of the new address, with no back-and-forth over floor number or accessibility that a typed address doesn't show.
  • Real estate agents — an interested buyer shares their own location to estimate travel time to a viewing.

Don't trust the payload without verifying it

Coordinates look harmless, but it's still data you use to make decisions on — a wrong or spoofed location sends a driver to the wrong place. Always verify the X-TextMeFlow-Signature header before processing the payload, as explained in verifying webhook signatures. Without that check, anyone who knows your webhook URL could submit fake location messages.

What a location message isn't

A few limits worth knowing: the API today only delivers the raw coordinates, not a place name or address string — you do that translation yourself with a geocoding service if you need it. Sending is one-directional too: you can send text and media back via POST /v1/messages, but not (yet) a location pin. And because a GPS position is personal data, the same retention logic applies as for other customer data — see WhatsApp messages and GDPR if you still need to work that out. This is general information, not legal advice.

Want to try this yourself? The free plan gives you 50 messages a month, forever — enough to send a location message from your own WhatsApp and watch the webhook fire. Start for free.

Want to send WhatsApp messages via API yourself?

Free forever up to 50 messages/month. Scan a QR and send your first message within 5 minutes.

Free forever