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

# Send Text Message

> Send a text message via WhatsApp

## Authentication

<ParamField header="X-API-Key" type="string" required>
  Your API key for authentication
</ParamField>

## Request Body

<ParamField body="to" type="string" required>
  Recipient phone number (without + symbol, e.g., 1234567890)
</ParamField>

<ParamField body="message" type="string" required>
  Text message content
</ParamField>

<ParamField body="type" type="string" required>
  Message Type (e.g., Text)
</ParamField>

<ParamField body="replyToMessageId" type="string">
  WhatsApp message ID to reply to (optional)
</ParamField>

<ParamField body="clientId" type="string">
  Your custom reference ID for tracking (optional)
</ParamField>

## Response

<ResponseField name="statusCode" type="number">
  HTTP status code (200 for success)
</ResponseField>

<ResponseField name="message" type="string">
  Success or error message
</ResponseField>

<ResponseField name="data" type="object">
  <Expandable title="properties">
    <ResponseField name="messageId" type="string">
      WhatsApp message ID
    </ResponseField>

    <ResponseField name="status" type="string">
      Message status (sent, queued)
    </ResponseField>

    <ResponseField name="to" type="string">
      Recipient phone number
    </ResponseField>

    <ResponseField name="clientId" type="string">
      Your custom reference ID (if provided)
    </ResponseField>

    <ResponseField name="timestamp" type="string">
      Message sent timestamp
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://backend.conversales.in/api/v1/sendTextMessage" \
    -H "X-API-Key: 3kJ9mP2nQ8rT5vW7xY1zA4bC6dE8fG0hI" \
    -H "Content-Type: application/json" \
    -d '{
      "to": "1234567890",
      "message": "Hello! This is a test message from Conversales AI.",
      "clientId": "client_ref_12345",
      "type":"text"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    "https://backend.conversales.in/api/v1/sendTextMessage",
    {
      method: "POST",
      headers: {
        "X-API-Key": "3kJ9mP2nQ8rT5vW7xY1zA4bC6dE8fG0hI",
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        to: "1234567890",
        message: "Hello! This is a test message from Conversales AI.",
        clientId: "client_ref_12345",
      }),
    }
  );

  const data = await response.json();
  console.log(data);
  ```

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

  url = "https://backend.conversales.in/api/v1/sendTextMessage"
  headers = {
      "X-API-Key": "3kJ9mP2nQ8rT5vW7xY1zA4bC6dE8fG0hI",
      "Content-Type": "application/json"
  }
  payload = {
      "to": "1234567890",
      "message": "Hello! This is a test message from Conversales AI.",
      "clientId": "client_ref_12345"
  }

  response = requests.post(url, json=payload, headers=headers)
  print(response.json())
  ```
</RequestExample>

<ResponseExample>
  ```json Success Response theme={null}
  {
    "statusCode": 200,
    "message": "Text message sent successfully",
    "data": {
      "messageId": "wamid.HBgNMTIzNDU2Nzg5MA==",
      "status": "sent",
      "recipient": "1234567890"
    }
  }
  ```

  ```json Error - Unauthorized theme={null}
  {
    "statusCode": 401,
    "message": "Invalid or missing API key",
    "data": null
  }
  ```

  ```json Error - Invalid Phone Number theme={null}
  {
    "statusCode": 400,
    "message": "Invalid recipient phone number",
    "data": null
  }
  ```
</ResponseExample>

<Tip>
  Use the `clientId` parameter to track messages in your own system. This ID
  will be returned in webhooks and status updates.
</Tip>
