> ## Documentation Index
> Fetch the complete documentation index at: https://docs.contactship.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Send WhatsApp Message

> Send a text message to a contact via WhatsApp Business API (WABA)

Sends a plain text message to a contact through a configured WhatsApp Business channel. Automatically creates or reuses an existing conversation thread.

## Headers

<ParamField header="x-api-key" type="string" required>
  Your API key for authentication. Found in your dashboard under API settings.
</ParamField>

## Body

<ParamField body="channel_id" type="string" required>
  UUID of the WABA channel to send from. Find your channel IDs in your dashboard under **Channels**.
</ParamField>

<ParamField body="contact_id" type="string" required>
  UUID of the contact to message. The contact must have a valid WhatsApp number (`wa_id` or `phone_number`).
</ParamField>

<ParamField body="content" type="string" required>
  The text content of the message.
</ParamField>

<ParamField body="thread_id" type="string">
  UUID of an existing conversation thread. If provided, `channel_id` and `contact_id` are inferred from the thread automatically.
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  `true` if the message was sent successfully.
</ResponseField>

<ResponseField name="message" type="string">
  Human-readable status description.
</ResponseField>

<ResponseField name="data" type="object">
  <Expandable title="Response data">
    <ResponseField name="message_id" type="string">
      Internal UUID of the message record.
    </ResponseField>

    <ResponseField name="provider_id" type="string">
      WhatsApp message ID returned by Meta.
    </ResponseField>

    <ResponseField name="thread_id" type="string">
      UUID of the conversation thread.
    </ResponseField>

    <ResponseField name="status" type="string">
      Message status: `sent` or `pending`.
    </ResponseField>
  </Expandable>
</ResponseField>

## Error Codes

* `400 Bad Request` — Missing required fields or channel is not WABA type
* `401 Unauthorized` — Invalid or missing API key
* `404 Not Found` — Channel or contact not found
* `500 Internal Server Error` — Server-side or Meta API error

## Code Examples

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api.contactship.ai/v1/waba/send" \
    -H "x-api-key: your-api-key" \
    -H "Content-Type: application/json" \
    -d '{
      "channel_id": "chn_abc123",
      "contact_id": "c1d2e3f4-a5b6-7890-cdef-123456789012",
      "content": "Hello! How can I help you today?"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://api.contactship.ai/v1/waba/send',
    {
      method: 'POST',
      headers: {
        'x-api-key': 'your-api-key',
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        channel_id: 'chn_abc123',
        contact_id: 'c1d2e3f4-a5b6-7890-cdef-123456789012',
        content: 'Hello! How can I help you today?',
      }),
    }
  );
  const result = await response.json();
  console.log(`Sent: ${result.data.message_id}`);
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://api.contactship.ai/v1/waba/send',
      headers={'x-api-key': 'your-api-key'},
      json={
          'channel_id': 'chn_abc123',
          'contact_id': 'c1d2e3f4-a5b6-7890-cdef-123456789012',
          'content': 'Hello! How can I help you today?',
      },
  )
  print(response.json())
  ```
</RequestExample>

<ResponseExample>
  ```json Example Response theme={null}
  {
    "success": true,
    "message": "Mensaje WABA enviado",
    "data": {
      "message_id": "msg-a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "provider_id": "wamid.HBgNMTIxMjM0NTY3ODkwFQIAERgSM...",
      "thread_id": "thr-b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "status": "sent"
    }
  }
  ```
</ResponseExample>
