# Configure Channels

Connect your agent to messaging platforms.

## What Are Channels?

Channels allow your agent to communicate on external platforms:

* **Telegram** - Mobile and desktop messaging
* **Discord** - Community and server chat
* **Others** - Slack, WhatsApp (future)

## Accessing Channel Settings

Navigate to **Channels** in the sidebar.

## Telegram Configuration

### Prerequisites

* Telegram bot token from [@BotFather](https://t.me/botfather)
* Token format: `123456:ABC-DEF...`

### Setup Steps

1. **Go to Channels**
   * Click **Channels** in sidebar
   * Click **"Add Channel"** or **Telegram**
2. **Enter Bot Token**

   ```
   Bot Token: 123456:ABC-DEF1234...
   ```
3. **Configure Options**

   | Option              | Description          |
   | ------------------- | -------------------- |
   | **Webhook URL**     | Auto-generated       |
   | **Allowed Updates** | Select message types |
   | **Parse Mode**      | Markdown/HTML        |
4. **Test Connection**
   * Click **"Test"** or **"Connect"**
   * Send `/start` to your bot on Telegram
   * Should receive response
5. **Save Configuration**
   * Click **"Save"**
   * Channel shows as "Connected"

### Group Chat Setup

To add agent to groups:

1. Add bot to Telegram group
2. Promote to admin (for full features)
3. Mention bot: `@yourbotname command`
4. Or use commands directly if privacy mode is off

### Telegram Commands

Common commands to configure:

```
/start - Start interaction
/help - Show help
/status - Check agent status
```

## Discord Configuration

### Prerequisites

* Discord bot token from [Developer Portal](https://discord.com/developers/applications)
* Bot invited to your server

### Setup Steps

1. **Go to Channels**
   * Click **Channels** in sidebar
   * Click **"Add Channel"** or **Discord**
2. **Enter Bot Token**

   ```
   Bot Token: MTk... (your token)
   ```
3. **Configure Options**

   | Option          | Description                  |
   | --------------- | ---------------------------- |
   | **Guild ID**    | Your Discord server ID       |
   | **Channel IDs** | Specific channels (optional) |
   | **Prefix**      | Command prefix (e.g., `!`)   |
4. **Set Intents** Enable in Discord Developer Portal:
   * Server Members Intent
   * Message Content Intent
5. **Test Connection**
   * Click **"Test"**
   * Type `!ping` in Discord
   * Should receive response
6. **Save Configuration**
   * Click **"Save"**

### Discord Permissions

Required bot permissions:

* Send Messages
* Read Message History
* Add Reactions
* Embed Links
* Attach Files (if needed)

### Slash Commands

Modern Discord bots use slash commands:

```
/status - Check agent status
/ask - Ask agent a question
/task - Create a task
```

## Managing Multiple Channels

### Channel List View

```
┌─────────────────┐
│ Channels        │
├─────────────────┤
│ Telegram ✅     │
│   @myagent_bot  │
│ Discord ✅      │
│   MyServer      │
│ + Add Channel   │
└─────────────────┘
```

### Per-Channel Settings

Each channel can have:

* Different response styles
* Specific allowed commands
* Custom greetings
* Rate limits

### Disabling Channels

1. Find channel in list
2. Toggle **off** or click **Disconnect**
3. Confirm

Agent stops responding on that platform.

## Channel-Specific Features

### Telegram

* Reply keyboards
* Inline buttons
* File sharing
* Voice messages (if supported)

### Discord

* Embeds (rich formatting)
* Reactions
* Threads
* Slash commands

## Message Routing

### How Messages Flow

```
User (Telegram)
    ↓
Telegram API
    ↓
Agent receives message
    ↓
Agent processes
    ↓
Response sent back
    ↓
User sees reply
```

### Context Isolation

Each channel maintains separate:

* Conversation history
* Session state
* User contexts

## Troubleshooting

### Channel Not Responding

| Issue               | Solution                             |
| ------------------- | ------------------------------------ |
| Token invalid       | Re-enter correct token               |
| Bot not started     | Start bot in Telegram/Discord        |
| Permissions missing | Check and grant required permissions |
| Webhook failed      | Regenerate webhook URL               |

### Duplicate Messages

* Check webhook configuration
* Ensure only one instance running
* Clear duplicate integrations

### Rate Limiting

Platforms have limits:

* Telegram: \~30 messages/second
* Discord: Varies by endpoint

Agent automatically handles rate limits.

## Security Best Practices

✅ **Do**:

* Keep bot tokens secret
* Use minimal required permissions
* Monitor unauthorized access
* Rotate tokens periodically

❌ **Don't**:

* Share tokens in public
* Grant admin unnecessarily
* Ignore unusual activity

## Monitoring Channel Activity

View in **Sessions** section:

* Message volume per channel
* Response times
* Error rates
* Active users

## Next Steps

→ [Install Skills](/agos/agos-cloud/agent/skills.md) to extend agent capabilities


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://agos.gitbook.io/agos/agos-cloud/agent/channels.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
