# Channels

> How people reach Nestor, from the admin’s chat, a messaging app or satellites, what they can send, and what they can name with @.

Source: https://nestorhome.dev/docs/channels/

All `channels` share one agent and one memory. To talk aloud, see [Voice](https://nestorhome.dev/docs/voice/).

*Talk, the admin's chat: one thread per discussion*

## Choose channels

### Chat

The admin's **Chat**, added by `nestor init`:

```yaml
channels:
  - kind: web
```

Each chat has its own [title](https://nestorhome.dev/docs/models/#roles). **Stop** ends an answer; leaving the page does
not. A task's result lands in the chat that asked. Open to admin accounts linked to a person.

### Telegram

Create a bot with [@BotFather](https://t.me/BotFather), token in `.env`:

```ini
TELEGRAM_BOT_TOKEN=123456:ABC-...
```

```yaml
channels:
  - kind: telegram
    token: ${TELEGRAM_BOT_TOKEN}
```

Your user id: write to the bot, the log prints each ignored id.

### Discord

In the [Developer Portal](https://discord.com/developers/applications): an application, a bot with
the **Message Content** intent, invited to your server.

```yaml
channels:
  - kind: discord
    token: ${DISCORD_BOT_TOKEN}
```

Answers direct messages and mentions.

### Slack

A Slack app with Socket Mode (no public address), an app-level token (`connections:write`) and a
bot token with `chat:write`, `files:read`, `files:write`, `im:history` and `app_mentions:read`,
subscribed to `message.im` and `app_mention`.

```yaml
channels:
  - kind: slack
    app_token: ${SLACK_APP_TOKEN}
    bot_token: ${SLACK_BOT_TOKEN}
```

Answers direct messages and mentions.

### Matrix

A bot account on a homeserver, its access token, invited to a room.

```yaml
channels:
  - kind: matrix
    homeserver: https://matrix.org
    token: ${MATRIX_TOKEN}
```

Encrypted rooms are not read.

### Signal

A number registered with [signal-cli-rest-api](https://github.com/bbernhard/signal-cli-rest-api)
(`normal` or `native` mode).

```yaml
channels:
  - kind: signal
    url: http://signal:8080
    number: "+33612345678"
```

Answers direct messages and groups; voice messages in writing.

### WhatsApp

A WhatsApp Business number on Meta's Cloud API: the number's id, a system user's permanent token,
the app's secret. Webhook: `https://<your host>/whatsapp` (proxied to port 8473), with a verify
token you choose.

```yaml
channels:
  - kind: whatsapp
    phone_number_id: "1098…"
    token: ${WHATSAPP_TOKEN}
    verify_token: ${WHATSAPP_VERIFY_TOKEN}
    app_secret: ${WHATSAPP_APP_SECRET}
```

Meta's signature is checked. Outside 24 hours after the person's last message, Meta may refuse a
reminder.

### Email

Nestor's own mailbox; answers come back in the thread.

```yaml
channels:
  - kind: email
    address: nestor@example.org
    username: nestor@example.org
    password: ${NESTOR_MAIL_PASSWORD}
    imap_host: imap.example.org
    smtp_host: smtp.example.org
```

Only authenticated mail (DMARC, or DKIM and SPF) is answered. Turn `require_authenticated` off only
for a local bridge.

### Satellites

```yaml
channels:
  - kind: satellites
    host: 0.0.0.0
```

`host: 0.0.0.0` opens port 8471 to your network. Add a [voice](https://nestorhome.dev/docs/voice/), then
[pair devices](https://nestorhome.dev/docs/satellites/).

### API

Nestor answers `POST /v1/chat/completions` like a model, for Open WebUI, LibreChat, a script or
Home Assistant (Extended OpenAI Conversation). Each key belongs to an account:

```yaml
channels:
  - kind: openai-api
    keys:
      mathis: ${NESTOR_API_KEY}
```

Client: `http://<nestor>:8472/v1`, model `nestor`. `host: 0.0.0.0` opens it to other machines. Only
your last message counts: Nestor keeps its own conversation.

### ntfy

Phone notifications through [ntfy](https://ntfy.sh), one way:

```yaml
channels:
  - kind: ntfy
```

On the public server, anyone who knows the topic reads it: pick one nobody would guess, or set your
own `url` and `token`. ntfy.sh keeps attachments 3 hours, 15 MB at most.

### Webhook

Posts each message Nestor sends by itself as JSON (Home Assistant, n8n, a script).

```yaml
channels:
  - kind: webhook
    url: https://homeassistant.local:8123/api/webhook/nestor
    secret: ${WEBHOOK_SECRET}
```

Body: `{"to", "text", "attachments"}`, each attachment with `kind` (`image`, `voice`, `audio`,
`file`), `name` and content. With `secret`, signed in `X-Nestor-Signature: sha256=…`, like GitHub.

## Who is who

Each person's [`accounts`](https://nestorhome.dev/docs/configuration/#the-household); send-only channels take a `reach`.

| Channel    | In `accounts` or `reach`                        |
| ---------- | ----------------------------------------------- |
| Telegram   | `telegram:<user id>`                            |
| Discord    | `discord:<user id>`                             |
| Slack      | `slack:<member id>`                             |
| Matrix     | `matrix:@you:matrix.org`                        |
| Signal     | `signal:+33…`, your number                      |
| WhatsApp   | `whatsapp:<your number, digits only>`           |
| Email      | `email:you@example.org`                         |
| OpenAI API | `openai-api:<key name>`, such as `openai-api:mathis` |
| ntfy       | `reach: "ntfy:<topic>"`                         |
| Webhook    | `reach: "webhook:<to>"`, sent as `to`           |

## Photos and voice messages

Messaging channels and the admin's chat pass files on; the admin shows them in the journal. The
chat takes 10 files of 20 MB per message.

| Received        | What Nestor does                                                                                       |
| --------------- | ------------------------------------------------------------------------------------------------------ |
| voice message   | transcribes it; answers with one when a speech model is set and the channel sends them ([Voice](https://nestorhome.dev/docs/voice/#voice-messages)) |
| photo           | shows it to a model that sees images (`vision: true`, `anthropic`, `gemini`); otherwise the model says it cannot see it |
| PDF, text file  | the model reads its text in parts; a scan has no text, and the model says so. `anthropic` and `gemini` read the last two PDFs whole, scans included |
| any other file  | names it to the model, which says it cannot open it                                                     |

Every messaging channel sends files with the answer: [pictures](https://nestorhome.dev/docs/models/#pictures), a task's
documents and audio.

## Mentions

| Written    | Names                                     | Nestor                                  |
| ---------- | ----------------------------------------- | --------------------------------------- |
| `@sam`     | a person, by their `id`                   | writes to them what is for them         |
| `@kitchen` | a room, by its Home Assistant area        | does what the message asks in that room |
| `@hermes`  | an [executor](https://nestorhome.dev/docs/executors/), by name  | hands it that part of the work          |
| `@gmail`   | a service of a [connected account](https://nestorhome.dev/docs/accounts/) | uses that account’s tools for it |

Services: `@gmail` or `@calendar` (Google), `@mail` (IMAP), `@linear` (its MCP server). Two accounts
with one name are told apart by their address: `@calendar-alex`, `@calendar-alex-gmail`.

- Case and accents do not count; names, addresses and their start work as aliases.
- A name that matches nothing, or an e-mail address, stays a word.
- Each person names only what they may use.

## When a conversation ends

After a silence, the next message starts a new conversation.

| Channel | Silence   |
| ------- | --------- |
| aloud   | 5 minutes |
| written | 4 hours   |

Change it with `conversation_ends_after_s` on the channel.
