Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ArnasDon/wacrm/llms.txt

Use this file to discover all available pages before exploring further.

The Messages API is the primary way to send WhatsApp messages from your own scripts and automations. Rather than working with internal conversation IDs, you pass an E.164 phone number and Wacrm handles everything else — looking up or creating the contact and conversation before dispatching the message through the WhatsApp Business API.

POST /api/v1/messages

Required scope: messages:send Sends a WhatsApp message to any E.164 phone number. The endpoint finds or creates the contact and conversation associated with that number and then runs the send. Because contact and conversation resolution is part of the request, a single call is enough for any automation — no separate contact-creation step is needed.

Request body

to
string
required
The recipient’s phone number in E.164 format (e.g. +14155550123). This is the only required field. The endpoint resolves or creates the contact and conversation automatically.
type
string
default:"text"
The message type. One of: text, template, image, video, document, audio. Defaults to text when omitted.
text
string
The message body for type: text, or the caption for media types (image, video, document, audio). Required when type is text.
media_url
string
A publicly accessible URL for the media file. Required when type is image, video, document, or audio.
filename
string
An optional display filename for type: document (e.g. invoice.pdf). Ignored for other types.
template
object
Required when type is template. Describes the approved WhatsApp template to send.
reply_to_message_id
string
The UUID of a message in the same conversation to reply to. The referenced message must belong to the resolved conversation or the request will be rejected.
name
string
An optional display name to set when a new contact is created for the given phone number. Has no effect when the contact already exists.

Examples

Sending a plain text message:
curl -X POST https://your-crm.example.com/api/v1/messages \
  -H "Authorization: Bearer wacrm_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{ "to": "+14155550123", "type": "text", "text": "Hi 👋" }'
Sending a template message with positional parameters:
{
  "to": "+14155550123",
  "type": "template",
  "template": {
    "name": "order_update",
    "language": "en_US",
    "params": ["A123"]
  },
  "reply_to_message_id": "<uuid>"
}
curl -X POST https://your-crm.example.com/api/v1/messages \
  -H "Authorization: Bearer wacrm_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
        "to": "+14155550123",
        "type": "template",
        "template": {
          "name": "order_update",
          "language": "en_US",
          "params": ["A123"]
        }
      }'

Response (201)

{
  "data": {
    "message_id": "a1b2c3d4-…",
    "whatsapp_message_id": "wamid.…",
    "conversation_id": "e5f6g7h8-…",
    "contact_id": "i9j0k1l2-…",
    "contact_created": true
  }
}
message_id
string
The internal UUID of the created message row.
whatsapp_message_id
string
The wamid.* identifier returned by the WhatsApp Business API. Use this to correlate delivery status webhooks.
conversation_id
string
The UUID of the conversation the message was sent in (found or created).
contact_id
string
The UUID of the contact associated with the given phone number (found or created).
contact_created
boolean
true when a new contact record was created for the number; false when an existing contact was matched.

Domain error codes

Beyond the standard error codes, the Messages API may return:
HTTPcodeMeaning
400whatsapp_not_configuredNo WhatsApp Business integration is connected to this account.
502meta_errorThe request reached Meta’s servers but was rejected — check your template approval and phone number.
500template_malformedThe template payload could not be serialized into a valid API request.
The contact_created field lets you detect when a send implicitly created a new contact — useful for auditing or triggering a follow-up workflow on first contact.

Build docs developers (and LLMs) love