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

# Send template

> Send a WhatsApp message using a pre-approved message template.

Sends a WhatsApp message using an approved template. Template messages are required when initiating a new conversation or messaging outside the 24-hour session window.

<Note>
  This endpoint is rate-limited to **5 requests per second** per user.
</Note>

## Endpoint

`POST /user/whatsapp/send`

## Request

<ParamField body="sender_id" type="integer" required>
  ID of the WhatsApp sender to send from. Use the [Get senders](/api-reference/whatsapp/get-senders) endpoint to retrieve available senders.
</ParamField>

<ParamField body="template_id" type="integer" required>
  ID of the approved message template to use.
</ParamField>

<ParamField body="recipient_phone" type="string" required>
  Recipient's phone number in international format (e.g., `+1234567890`).
</ParamField>

<ParamField body="recipient_name" type="string">
  Recipient's name for conversation tracking. Maximum 255 characters.
</ParamField>

<ParamField body="variables" type="object">
  Key-value pairs for template variables. Keys should match the variable names in your template.

  ```json theme={null}
  "variables": {
    "1": "John",
    "2": "January 15, 2026",
    "3": "2:00 PM"
  }
  ```
</ParamField>

## Response

<ResponseField name="success" type="boolean">Whether the message was sent successfully.</ResponseField>
<ResponseField name="conversation_id" type="integer">ID of the conversation (new or existing).</ResponseField>
<ResponseField name="message_id" type="integer">ID of the conversation message record.</ResponseField>
<ResponseField name="whatsapp_message_id" type="integer">ID of the WhatsApp message record.</ResponseField>
<ResponseField name="message_sid" type="string">Twilio message SID for delivery tracking.</ResponseField>
<ResponseField name="status" type="string">Initial delivery status (e.g., `queued`, `sent`).</ResponseField>

## Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://portal.intellixent.ai/api/user/whatsapp/send" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "sender_id": 12,
      "template_id": 45,
      "recipient_phone": "+1234567890",
      "recipient_name": "John Doe",
      "variables": {
        "1": "John",
        "2": "January 15, 2026",
        "3": "2:00 PM"
      }
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://portal.intellixent.ai/api/user/whatsapp/send', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      sender_id: 12,
      template_id: 45,
      recipient_phone: '+1234567890',
      recipient_name: 'John Doe',
      variables: { '1': 'John', '2': 'January 15, 2026', '3': '2:00 PM' }
    })
  });

  const data = await response.json();
  console.log(data.conversation_id);
  ```
</CodeGroup>

```json 200 Success theme={null}
{
  "success": true,
  "conversation_id": 1234,
  "message_id": 567,
  "whatsapp_message_id": 890,
  "message_sid": "SMxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "status": "queued"
}
```

```json 404 Sender not found theme={null}
{
  "success": false,
  "error": "Sender not found or does not belong to you",
  "error_code": "SENDER_NOT_FOUND"
}
```

```json 422 Template not approved theme={null}
{
  "success": false,
  "error": "Template is not approved. Current status: pending",
  "error_code": "TEMPLATE_NOT_APPROVED"
}
```

```json 402 Insufficient balance theme={null}
{
  "success": false,
  "error": "Insufficient balance. Please top up your account.",
  "error_code": "INSUFFICIENT_BALANCE"
}
```

<Note>
  After a template message is sent successfully, a 24-hour messaging window opens. During this window you can send [freeform messages](/api-reference/whatsapp/send-freeform) without needing a template.
</Note>
