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

# Channels

> Where end users talk to an agent, the inbound and outbound channel vocabularies, which channels the CLI can link, and how phone numbers fit in

A channel is where an end user talks to the agent: the web widget on your site, WhatsApp, email, Slack, a phone number. One agent serves every channel it is linked to, with the same persona, skills, and knowledge, and your code can tell them apart when it needs to.

## How a channel reaches your code

An inbound message on any channel becomes a turn for the same agent. Inside a tool or a processor, `Lua.request.channel` names the channel the message came from, using the inbound vocabulary below; a model resolver receives the same value, and a persona or skill context can carry a `voice` or `text` variant. An outbound message the agent starts itself goes through `Channels.send` and uses a second, smaller vocabulary: the seven channels that accept agent-initiated messages.

The two vocabularies overlap but are not the same set, and two names differ: the widget arrives as `pop` at run time (the `Channel` type lists it as `web`, so write handlers that accept both) and is `webchat` outbound, and Messenger is `facebook` inbound and `messenger` outbound.

| Channel                         | `Lua.request.channel`                          | `Channels.send`                                                                  | Set up in                           |
| ------------------------------- | ---------------------------------------------- | -------------------------------------------------------------------------------- | ----------------------------------- |
| Web widget and hosted chat page | `pop` at run time; typed as `web`              | `webchat` (to a known user)                                                      | Dashboard                           |
| WhatsApp                        | `whatsapp`                                     | `whatsapp`                                                                       | CLI or dashboard                    |
| Facebook Messenger              | `facebook`                                     | `messenger` (after the end user has written first)                               | CLI or dashboard                    |
| Instagram                       | `instagram`                                    | `instagram` (after the end user has written first)                               | Dashboard                           |
| Slack                           | `slack`                                        | —                                                                                | CLI or dashboard                    |
| Microsoft Teams                 | `teams`                                        | `teams` (after the end user has written first; can address a group conversation) | Dashboard                           |
| Email                           | `email`                                        | `email`                                                                          | CLI or dashboard                    |
| SMS                             | `sms`                                          | `sms`                                                                            | CLI (phone numbers) or dashboard    |
| MMS                             | `mms`                                          | —                                                                                | Same phone number as SMS            |
| RCS                             | `rcs`                                          | —                                                                                | REST API                            |
| iMessage                        | `imessage`                                     | —                                                                                | Dashboard                           |
| Front                           | `front`                                        | —                                                                                | Dashboard                           |
| MessageBird                     | `messagebird`                                  | —                                                                                | Dashboard                           |
| Meetings                        | `meeting`                                      | —                                                                                | Dashboard                           |
| Voice call                      | `phone` at run time; not in the `Channel` type | —                                                                                | CLI (phone numbers) or dashboard    |
| HTTP chat API                   | `api`                                          | —                                                                                | Your own app, sending `channel=api` |
| `lua chat`                      | `dev`                                          | —                                                                                | Automatic                           |
| Device trigger                  | `device`                                       | —                                                                                | `lua devices`                       |

Inbound channel values are an open set: `Channel` is a union of named strings plus `string`, so values such as `pop`, `phone`, `sms`, and `meeting` arrive even though the type doesn't list them; compare against the ones you handle and treat the rest as the default. Outbound, `Channels.send` accepts exactly `whatsapp`, `sms`, `email`, `webchat`, `teams`, `instagram`, and `messenger`. WhatsApp and SMS can reach a phone number that has never written to the agent; email can reach an address; the rest deliver only to an end user who already has a conversation, addressed by `userId`. The [formatting overview](/channels/formatting/overview) has the per-channel rendering matrix.&#x20;

`Channels.send` takes the channel, one recipient field (`userId` on any channel, `phoneNumber` for WhatsApp and SMS, `email` for email, `conversationId` for a Teams group), and the text; it returns a `deliveryId` and a `status` that `Channels.getStatus` follows as receipts arrive.

```ts src/skills/tools/SendShippingNoticeTool.ts theme={null}
import { LuaTool, Channels } from 'lua-cli';
import { z } from 'zod';

export default class SendShippingNoticeTool implements LuaTool {
  name = 'send_shipping_notice';
  description = 'Text the customer on WhatsApp that their order has shipped.';
  inputSchema = z.object({ phoneNumber: z.string(), orderId: z.string() });

  async execute(input: z.infer<typeof this.inputSchema>) {
    const result = await Channels.send({
      channel: 'whatsapp',
      to: { phoneNumber: input.phoneNumber },
      text: `Order ${input.orderId} has shipped.`,
    });
    return { deliveryId: result.deliveryId, status: result.status };
  }
}
```

With an end user rather than an address, `user.send([{ type: 'text', text: '…' }])` on the record `User.get()` returns reaches that person on the channel of their last message when it was WhatsApp, Messenger, Instagram, a Teams personal chat, MessageBird, or SMS; the web widget always receives a live copy, and Slack, Front, iMessage, RCS, and email are never reached this way. Under `lua test` it throws on failure; deployed, it resolves `true` whether or not the message was delivered, so never branch on the value and confirm delivery in `lua logs`.

## Linking a channel

`lua channels` is interactive and can link WhatsApp, Facebook Messenger, email (a Lua-generated inbox or forwarding from your own address), and Slack as a private or public app; `lua channels list` is its only scriptable action. Every other channel is linked in the admin dashboard, which handles the OAuth flows (the provider's own sign-in and consent screens), and the CLI's menu opens it for you. Linking is the same operation either way; the CLI is a shortcut for the channels that take provider credentials rather than OAuth. A WhatsApp phone-number ID links to one agent across the whole platform, and a second link is refused with `Channel already exists`; an Instagram account connects to one agent; re-linking a Messenger page that is already linked fails without a clear message; re-linking an email address that is already linked moves that channel to the agent you link it from.

Phone numbers are managed from the same command: search for a number, purchase one (voice and SMS, or voice only), bind it to the agent, unbind, list, or release. Binding a number for calls requires a [voice](/concepts/voice) already pushed on the agent. Carrier registration for US messaging (10DLC, the registration US carriers require before a business texts from a standard ten-digit number, and toll-free verification) is available through the REST API, not the CLI.

## Channels and integrations

A channel is where end users talk to the agent. An [integration](/concepts/integrations) is a system the agent acts on for them (Linear, HubSpot, a CRM) through tools it provisions. Slack appears on both lists for different jobs: as a channel it is where people message the agent, as an integration it is somewhere the agent posts messages.

## When to reach out first

* A reply to a message the end user has sent: nothing special; the agent answers on the channel it arrived on.
* A reminder, a shipping notice, a follow-up: `Channels.send` to an address or `userId`, or `user.send(…)` to reach the end user on the channel they last used.
* WhatsApp outside the customer-service window: an approved [WhatsApp message template](/build/send-proactive-messages), because free-form sends are allowed only for a limited time after the end user's last message; by default `Channels.send` queues the text behind an opt-in prompt, and `onClosedWindow: 'fail'` makes it fail instead.
* A message to a Teams group chat: `to: { conversationId }`; it is delivered but not stored on any end user's record.

## Limits

* Outbound sends are limited to the seven `Channels.send` channels; `teams`, `instagram`, and `messenger` require a prior inbound message.
* The WhatsApp customer-service window is 24 hours after the end user's last message.

## Next steps

<Columns cols={2}>
  <Card title="Channels overview" href="/channels/overview">Connect each channel, with the capability matrix.</Card>
  <Card title="Send proactive messages" href="/build/send-proactive-messages">Reminders, notices, and WhatsApp message templates.</Card>
  <Card title="Channels reference" href="/reference/sdk/channels">`send`, `whatsapp.sendTemplate`, `email.send`, and delivery status.</Card>
  <Card title="lua channels" href="/reference/cli/channels">Link channels and manage phone numbers.</Card>
</Columns>
