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

# Send Message

> Sends a message via a specified channel (Email, WhatsApp, Slack, etc.) to a recipient with support for templating

## Header

<ParamField header="Authorization" type="string" required={true} description="Bearer token for API authentication. Format: `Bearer {{apiToken}}" />

## Request Body

```json theme={null}
{
  "channel": "EMAIL | SMS | WHATSAPP | SLACK | TEAMS | DISCORD | LINE | IN_APP | PUSH",
  "recipient": {
    "email": "user@example.com",
    "sms": "+911234567890",
    "whatsapp": "+911234567890",
    "pushToken": "push-token-123",
    "inApp": "internal-user-id",
    "slack": "U01XXXXXXX",
    "discord": "discord-user-id",
    "teams": "teams-user-id",
    "line": "line-user-id",
    "userId": "unified-user-id"
  },
  "template": {
    "name": "welcome_template"
  },
  "templateVariables": {
    "firstName": "John",
    "offerCode": "ABCD123"
  },
  "providerIntegration": {
    "id": "provider-uuid-1234",
    "name": "Provider Name",
    "code": "SLACK | TWILIO | WATI | ..."
  },
  "subject": "Welcome to our app!",
  "body": "Hello John, welcome onboard!",
  "buttons": [
    {
      "text": "Visit Website",
      "value": "https://example.com"
    }
  ]
}
```

## Request Fields

### Required Fields

<ParamField body="channel" type="string" required>
  The communication channel. One of: `EMAIL`, `SMS`, `WHATSAPP`, `SLACK`, `TEAMS`, `DISCORD`, `LINE`, `IN_APP`, `PUSH`
</ParamField>

<ParamField body="recipient" type="object" required>
  The destination for the message. Must include the field matching the selected channel.

  <ParamField type="string">
    Recipient's email address (for EMAIL channel)
  </ParamField>

  <ParamField type="string">
    Recipient's phone number (for SMS channel)
  </ParamField>

  <ParamField type="string">
    Recipient's WhatsApp number (for WHATSAPP channel)
  </ParamField>

  <ParamField type="string">
    Recipient's Slack user ID (for SLACK channel)
  </ParamField>

  <ParamField type="string">
    Unified user ID if supported across channels
  </ParamField>
</ParamField>

### Optional Fields

<ParamField body="template" type="object">
  Template configuration for the message

  <ParamField type="string">
    Template name as registered in the system
  </ParamField>
</ParamField>

<ParamField body="templateVariables" type="object">
  Key-value pairs to populate template placeholders
</ParamField>

<ParamField body="providerIntegration" type="object">
  Provider configuration

  <ParamField type="UUID">
    ID of the provider integration
  </ParamField>

  <ParamField type="string">
    Name of the provider
  </ParamField>

  <ParamField type="string">
    Provider code (e.g., `SLACK`, `TWILIO`)
  </ParamField>
</ParamField>

<ParamField body="subject" type="string">
  Message subject (for EMAIL only)
</ParamField>

<ParamField body="body" type="string">
  Message body (for SLACK, EMAIL, TEAMS)
</ParamField>

<ParamField body="buttons" type="array">
  Interactive buttons (for SLACK only)

  <ParamField type="object">
    <ParamField type="string">
      Button display text
    </ParamField>

    <ParamField type="string">
      Button action value or URL
    </ParamField>
  </ParamField>
</ParamField>

## Response

### Success Response (200 OK)

```json theme={null}
{
  "notificationId": "c1234567-89ab-4def-9012-3456789abcdef"
}
```

### Response Fields

<ResponseField name="notificationId" type="UUID">
  Unique identifier for the sent message
</ResponseField>

## Error Responses

* `400` - Bad Request (Invalid request format or missing required fields)
* `401` - Unauthorized (Missing or invalid API key)
* `403` - Forbidden (Insufficient permissions to send message)
* `404` - Not Found (Template or provider not found)
* `429` - Too Many Requests
* `500` - Internal Server Error

## Examples

<CodeGroup>
  ```json Send Slack Message with Buttons theme={null}
  {
    "channel": "SLACK",
    "recipient": {
      "slack": "U01ABCDEF"
    },
    "body": "Hello from Slack!",
    "buttons": [
      {
        "text": "Open App",
        "value": "open_app"
      }
    ],
    "providerIntegration": {
      "code": "SLACK",
      "name": "Slack Default"
    }
  }
  ```

  ```json Send Email with Template theme={null}
  {
    "channel": "EMAIL",
    "recipient": {
      "email": "user@example.com"
    },
    "template": {
      "name": "welcome_email"
    },
    "templateVariables": {
      "firstName": "John",
      "expiryDate": "2023-12-31"
    },
    "providerIntegration": {
      "code": "SENDGRID",
      "name": "Production Email"
    }
  }
  ```

  ```json Send SMS with Raw Message theme={null}
  {
    "channel": "SMS",
    "recipient": {
      "sms": "+1234567890"
    },
    "body": "Your verification code is 123456. Valid for 10 minutes.",
    "providerIntegration": {
      "code": "TWILIO",
      "name": "Twilio Production"
    }
  }
  ```
</CodeGroup>
