💬 Shared WhatsApp Inbox on the new PlatformMore
1msg official logo

Send a location via WhatsApp API (sendLocation)

This scenario sends a map location with sendLocation during the 24-hour customer service window.

Use case overview

This scenario sends a map location with sendLocation during the 24-hour customer service window. Coordinates, location name, and address help the buyer navigate without copying text.

Template example

Your pickup point is ready. Tap the map pin below to navigate.

WhatsApp Business API for delivery update — share pickup location

When to use it

Reach for this scenario when an order moves to ready-for-pickup and the buyer still needs the exact collection point while the WhatsApp session is open. It fits click-and-collect ecommerce where typing addresses by hand causes wrong turns and repeat support contacts.

Fewer wrong pickup directions
sendLocation delivers latitude, longitude, pickup point name, and street address as a map pin, so the buyer navigates to the exact coordinates instead of copying a mistyped address from chat.
Fewer "where do I pick up?" messages
The send fires when the order status changes to ready-for-pickup during an open 24-hour session, so the pin lands in the same thread where the buyer already asked about delivery.
One-tap maps from chat
The shared location card opens navigation in the buyer's maps app; the session text tells them to tap the map pin below rather than hunt for an address elsewhere.
No manual address retyping
Your backend loads coordinates, location name, and street address when the order event fires, so support does not repeat pickup details in free text.

Workflow

  1. Status tracked

    An order status change indicates the parcel is ready for pickup.

    status: "read"

  2. Capture event

    Your backend loads coordinates, location name, and street address.

    phone: "+…"

  3. Build & send

    sendLocation delivers the pin to the client in the active session.

    POST /send_location

  4. Delivered

    The client opens maps navigation from the shared location card.

    delivered

WhatsApp Business API for delivery update — share pickup location

Technical implementation

Prerequisites

  1. 1MSG API Key · How to get API Key
  2. WhatsApp Business account · How to Connect WABA
  3. Open 24-hour session window · How the 24-hour window works
  4. Customer opt-in · How to Manage Customers Consent
  5. Webhook endpoint · How to Set Up Webhooks

Code examples

#!/usr/bin/env bash
set -euo pipefail

# === Configuration (replace "___" placeholders) ===
API_BASE_URL="https://api.1msg.io"        # production 1MSG API base URL
CHANNEL_ID="___"                           # channel ID from 1MSG dashboard
API_TOKEN="___"                            # channel JWT token (Bearer)



# === Test data ===
TEST_PHONE="___"                 # client phone in international format

PHONE_NORM="$(printf '%s' "$TEST_PHONE" | tr -cd '0-9')"
URL="${API_BASE_URL%/}/${CHANNEL_ID}/sendLocation"

read -r -d '' PAYLOAD <<JSON || true
{
  "phone": "${PHONE_NORM}",
  "lat": "41.40338",
  "lng": "2.17403",
  "name": "Pickup point",
  "address": "Example street 1"
}
JSON

RESPONSE="$(curl -s -w '\n%{http_code}' -X POST "$URL" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ${API_TOKEN}" \
  -d "$PAYLOAD")"

HTTP_CODE="$(printf '%s' "$RESPONSE" | tail -n1)"
BODY="$(printf '%s' "$RESPONSE" | sed '$d')"

case "$BODY" in
  *'"sent":true'*) ok=1 ;;
  *) ok=0 ;;
esac

if [ "$HTTP_CODE" -ge 200 ] && [ "$HTTP_CODE" -lt 300 ] && [ "$ok" -eq 1 ]; then
  echo "Message sent to client."
else
  echo "$BODY" >&2
  exit 1
fi

Response and delivery status

HTTP 2xx and JSON "sent": true mean 1MSG accepted the message for sending — not that it already reached the customer's phone. Save the id field (looks like wamid.…) to correlate delivery callbacks.

200 OKResponse
{
  "sent": true,
  "message": "Sent to [email protected]",
  "description": "Message has been sent to the provider",
  "id": "wamid.HBgLMzgwNjM5..."
}
  • sent

    Accepted for sending — not yet on the customer's phone

  • id

    Store it; delivery callbacks and hookInfo are keyed on this

Delivery statuses and webhooks →

Common errors

StatusAPI responseCauseFix
200Message was not sent: provide chatId, phone, bsuid, or usernameNo recipient the channel could resolve.Pass exactly one recipient: phone (country code plus number, digits only), chatId (for example [email protected]) or bsuid.
401token is requiredThe request has no token.Add your channel token as the token query parameter: https://api.1msg.io/{channelId}/{method}?token=…
429too many requests. please try laterThe channel is over its send rate.Queue messages on your side and retry with exponential backoff.

All error codes →

Common questions

Related

Build for WhatsApp in hours
without infrastructure hassle