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.
Send a location
Section titled “Send a location”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 |
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" }}'import { Messajo } from "@messajo/sdk";
const messajo = new Messajo({ apiKey: process.env.MESSAJO_API_KEY! });
const message = await messajo.messages.send({ 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", },});console.log(message.id, message.status);n8n HTTP Request node settings
- Method:
POST - URL:
https://api.messajo.com/v1/messages - Authentication: Generic Credential Type, then Header Auth. Name:
Authorization; Value:Bearer mj_... - Headers: turn on Send Headers and add
Idempotency-Key(a unique value per item) - Body: turn on Send Body; Body Content Type: JSON; Specify Body: Using JSON
{ "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" }}Replace mj_... with your API key.
The response is 201 with id (msg_…), status: "queued" and conversation_id. The final state arrives by webhook.
Request the contact’s location
Section titled “Request the contact’s location”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.
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" } }}'await messajo.messages.send({ 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" }, },});n8n HTTP Request node settings
- Method:
POST - URL:
https://api.messajo.com/v1/messages - Authentication: Generic Credential Type, then Header Auth. Name:
Authorization; Value:Bearer mj_... - Headers: turn on Send Headers and add
Idempotency-Key(a unique value per item) - Body: turn on Send Body; Body Content Type: JSON; Specify Body: Using JSON
{ "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" } }}Replace mj_... with your API key.
Receive the answer
Section titled “Receive the answer”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.
Instagram and Messenger
Section titled “Instagram and Messenger”They accept neither location nor interactive: both return 422 type_not_supported_by_channel.
Errors
Section titled “Errors”| 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 |