Send messages
Send a contact
Send 1 to 10 contact cards over WhatsApp with POST /v1/messages and type contacts, with name, phone numbers and emails.
type: "contacts" sends contact cards that the recipient can save with one tap. WhatsApp only. The fields shared by every type (to, reply_to, typing, delay_ms, the 24 h window) are in Common fields.
Fields
Section titled “Fields”contacts is a list of 1 to 10 cards.
| Field | Rule |
|---|---|
contacts[].name.formatted_name |
Required, 1 to 256 characters |
contacts[].name.first_name |
Optional, up to 128 characters |
contacts[].name.last_name |
Optional, up to 128 characters |
contacts[].phones |
Optional, up to 10 items |
contacts[].phones[].phone |
1 to 64 characters |
contacts[].phones[].type |
Optional, up to 32 characters (e.g. CELL, WORK) |
contacts[].phones[].wa_id |
Optional, up to 64 characters: the number on WhatsApp, for the chat button |
contacts[].emails |
Optional, up to 10 items |
contacts[].emails[].email |
1 to 128 characters |
contacts[].emails[].type |
Optional, up to 32 characters |
Send a contact
Section titled “Send a contact”curl https://api.messajo.com/v1/messages \ -H "Authorization: Bearer $MESSAJO_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d '{ "connection_id": "conn_...", "to": "5511999999999", "type": "contacts", "contacts": [ { "name": { "formatted_name": "Ana Souza", "first_name": "Ana", "last_name": "Souza" }, "phones": [{ "phone": "+55 11 98888-7777", "type": "CELL", "wa_id": "5511988887777" }], "emails": [{ "email": "[email protected]", "type": "WORK" }] } ] }'import { Messajo } from "@messajo/sdk";
const messajo = new Messajo({ apiKey: process.env.MESSAJO_API_KEY! });
const sent = await messajo.messages.send({ connection_id: "conn_...", to: "5511999999999", type: "contacts", contacts: [ { name: { formatted_name: "Ana Souza", first_name: "Ana", last_name: "Souza" }, phones: [{ phone: "+55 11 98888-7777", type: "CELL", wa_id: "5511988887777" }], }, ],});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": "conn_...", "to": "5511999999999", "type": "contacts", "contacts": [ { "name": { "formatted_name": "Ana Souza", "first_name": "Ana", "last_name": "Souza" }, "phones": [ { "phone": "+55 11 98888-7777", "type": "CELL", "wa_id": "5511988887777" } ], "emails": [ { "type": "WORK" } ] } ]}Replace mj_... with your API key.
The response is the same as for a text message (201, status: "queued"); see Response.
Errors
Section titled “Errors”422outside_service_window: a contact is a free-form message, so it only goes out within 24 hours of the recipient’s last message. Outside the window, use a template.422type_not_supported_by_channel: Instagram or Messenger connection. Contacts are WhatsApp only.400validation_failed: empty list or more than 10 cards, missingformatted_name, a size limit exceeded, or an unknown field.