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

> ## Agent Instructions
> Automate.ax automations are TypeScript programs.
> Use Bun for installation and command examples.
> Use Automate.ax for the product name and automate.ax for the package, CLI, and domain.
> Treat documented public APIs as current; do not invent transitional or deprecated names.

# Send message

> Sends a supported message through a contact conversation.

`highlevel.sendMessage` sends a supported message through a contact conversation.

```ts automations/highlevel-send-message.automation.ts theme={null}
import { automation, markSignificant } from "automate.ax"
import { highlevel } from "automate.ax/highlevel"

export default automation("Send message", () => {
  markSignificant(
    highlevel.sendMessage({
      type: "SMS",
      contactId: "abc123def456",
      message: "Your appointment is confirmed.",
      status: "delivered",
    }),
  )
})
```

## Input

| Field                    | Type                                                                             | Required | Description                                                                                                                            |
| ------------------------ | -------------------------------------------------------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| `type`                   | `SMS \| Email \| WhatsApp \| IG \| FB \| Custom \| Live_Chat \| InternalComment` | Yes      | Type of message being sent                                                                                                             |
| `contactId`              | `string`                                                                         | Yes      | ID of the contact receiving the message                                                                                                |
| `appointmentId`          | `string`                                                                         | No       | ID of the associated appointment                                                                                                       |
| `attachments`            | `string[]`                                                                       | No       | Array of attachment URLs                                                                                                               |
| `emailFrom`              | `string`                                                                         | No       | Email address to send from                                                                                                             |
| `emailCc`                | `string[]`                                                                       | No       | Array of CC email addresses                                                                                                            |
| `emailBcc`               | `string[]`                                                                       | No       | Array of BCC email addresses                                                                                                           |
| `html`                   | `string`                                                                         | No       | HTML content of the message                                                                                                            |
| `message`                | `string`                                                                         | No       | Text content of the message                                                                                                            |
| `subject`                | `string`                                                                         | No       | Subject line for email messages                                                                                                        |
| `replyMessageId`         | `string`                                                                         | No       | ID of message being replied to                                                                                                         |
| `templateId`             | `string`                                                                         | No       | ID of message template                                                                                                                 |
| `threadId`               | `string`                                                                         | No       | ID of message thread. For email messages, this is the message ID that contains multiple email messages in the thread                   |
| `scheduledTimestamp`     | `number`                                                                         | No       | UTC Timestamp (in seconds) at which the message should be scheduled                                                                    |
| `conversationProviderId` | `string`                                                                         | No       | ID of conversation provider                                                                                                            |
| `emailTo`                | `string`                                                                         | No       | Email address to send to, if different from contact's primary email. This should be a valid email address associated with the contact. |
| `customSubtypeId`        | `string`                                                                         | No       | Custom subtype ID for email opt-out preferences. Only applies to email messages.                                                       |
| `emailReplyMode`         | `reply \| reply_all`                                                             | No       | Mode for email replies                                                                                                                 |
| `fromNumber`             | `string`                                                                         | No       | Phone number used as the sender number for outbound messages                                                                           |
| `toNumber`               | `string`                                                                         | No       | Recipient phone number for outbound messages                                                                                           |
| `forward`                | `JSON value`                                                                     | No       | Forwarding configuration for emails                                                                                                    |
| `status`                 | `delivered \| failed \| pending \| read`                                         | Yes      | Message status                                                                                                                         |
| `usesNativeSchedulingAi` | `boolean`                                                                        | No       | Whether the scheduled email uses native AI for the email scheduling                                                                    |
| `optimizationPeriod`     | `24h \| 48h \| 72h`                                                              | No       | Optimization period in hours (24, 48, or 72)                                                                                           |
| `mentions`               | `string[]`                                                                       | No       | User IDs mentioned by an internal comment.                                                                                             |
| `userId`                 | `string`                                                                         | No       | User attributed as the internal-comment author.                                                                                        |

Automate.ax supplies the connected sub-account's location ID. Optional second argument `{ account }` selects a named HighLevel binding.

## Output

| Field            | Type                                     | Required | Description                                                                                                                      |
| ---------------- | ---------------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------- |
| `conversationId` | `string`                                 | Yes      | Conversation ID.                                                                                                                 |
| `emailMessageId` | `string`                                 | No       | This contains the email message id (only for Email type). Use this ID to send inbound replies to GHL to create a threaded email. |
| `messageId`      | `string`                                 | Yes      | This is the main Message ID                                                                                                      |
| `messageIds`     | `string[]`                               | No       | When sending via the GMB channel, we will be returning list of `messageIds` instead of single `messageId`.                       |
| `msg`            | `string`                                 | No       | Additional response message when sending a workflow message                                                                      |
| `threadId`       | `string`                                 | No       | Email conversation thread ID.                                                                                                    |
| `forwardData`    | `JSON value`                             | No       | Optional metadata for forwarded email                                                                                            |
| `status`         | `delivered \| failed \| pending \| read` | No       | Message status, when HighLevel returns one.                                                                                      |

This action calls `POST /conversations/messages` with HighLevel API version `2021-04-15` and requires `conversations/message.write`. HighLevel validation and permission errors fail the action. Rate limits honor the provider's retry timing. Automate.ax does not automatically replay this create or send operation after an indeterminate transport failure.
