Skip to content

Send messages

Send and request location

Send a map pin or ask the contact to share their location on WhatsApp.

Two location tasks, both WhatsApp only: sending a map pin and asking for the contact’s location. Fields shared by every type (to, reply_to, typing, delay_ms, the 24 h window) are in Common fields.

Use type: "location" in POST /v1/messages.

Field Rule
location.latitude Number from -90 to 90
location.longitude Number from -180 to 180
location.name Optional, up to 256 characters
location.address Optional, up to 512 characters
Janela do terminal
curl -X POST https://api.messajo.com/v1/messages \
-H "Authorization: Bearer $MESSAJO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"connection_id": "con_123",
"to": "5511999990000",
"type": "location",
"location": {
"latitude": -23.5614,
"longitude": -46.6559,
"name": "Paulista Store",
"address": "Av. Paulista, 1000, São Paulo"
}
}'

The response is 201 with id (msg_…), status: "queued" and conversation_id. The final state arrives by webhook.

Use type: "interactive" with interactive.type: "location_request_message". The contact sees the text and a button to share their location. body.text is up to 1024 characters and action.name is always send_location.

Janela do terminal
curl -X POST https://api.messajo.com/v1/messages \
-H "Authorization: Bearer $MESSAJO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"connection_id": "con_123",
"to": "5511999990000",
"type": "interactive",
"interactive": {
"type": "location_request_message",
"body": { "text": "Where should we deliver your order?" },
"action": { "name": "send_location" }
}
}'

When the contact shares their location, a message.received event arrives with content.type: "location":

{
"type": "location",
"latitude": -23.5614,
"longitude": -46.6559,
"name": null,
"address": null,
"url": null
}

name, address and url are null when the contact does not provide them. If they ignore the request, nothing arrives.

They accept neither location nor interactive: both return 422 type_not_supported_by_channel.

Code Status When
outside_service_window 422 Free-form message outside the 24 h window
validation_failed 400 Latitude or longitude out of range, or text above the limit
type_not_supported_by_channel 422 Instagram or Messenger