Multi-Platform Channels Overview
The Channel system turns Elftia into a cross-platform AI bot. You can connect an Agent to Discord, Telegram, Slack, and other platforms simultaneously — receiving messages, calling tools, and generating replies from anywhere.
When to Use
- You want to deploy an AI assistant bot in a Discord server
- You need to have private conversations with an Agent via Telegram
- You want to integrate an AI collaborator into a Slack workspace
- You want the same Agent to serve users across multiple platforms at once
Supported Platforms
| Platform | Type ID | Connection Method | Max Message Length | Category |
|---|---|---|---|---|
| Discord | discord | Bot Token | 2,000 characters | Core |
| Telegram | telegram | Bot Token | 4,096 characters | Core |
| Slack | slack | Bot Token + App Token | 4,000 characters | Core |
| QQ Bot | qqbot | Bot Token | 1,500 characters | China |
| LINE | line | Channel Access Token + Secret | 5,000 characters | Core |
email | SMTP + IMAP credentials | 100,000 characters | Core | |
whatsapp | Phone number | 65,000 characters | Core | |
wechat | Wechaty Token | 2,000 characters | China | |
| Matrix | matrix | Access Token | 65,536 characters | Extended |
| Microsoft Teams | msteams | App ID + Password | 28,000 characters | Extended |
| Mattermost | mattermost | Bot Token | 16,383 characters | Extended |
| WeCom (Enterprise WeChat) | wecom | Webhook Key | 4,000 characters | China |
| WeCom (App) | wecom-app | Corp ID + Secret | 4,000 characters | China |
:::tip Platforms Are Plugins All platforms are implemented via Channel plugins. Built-in plugins ship with the app; additional plugins can be downloaded and installed via the Marketplace. :::
Core Concepts
Channel Instance
Each Channel instance represents a connection to an external platform. You can create multiple instances for the same platform (e.g., connecting two different Discord bots). Each instance independently manages its own:
- Credentials: the token/key required to connect
- Trigger rules: determine when the Agent should reply (see Trigger Rules & Security)
- Connection state: disconnected / connecting / connected / error
Trigger Rules
Trigger rules determine which messages the Agent responds to:
| Mode | Description | Best For |
|---|---|---|
all | Reply to all messages | Personal bots, test environments |
mention | Reply only when @mentioned | Multi-user groups, shared servers |
keyword | Reply when a specified keyword is matched | Topic-specific triggers |
dm_only | Reply to direct messages only | Public groups where only private chat is accepted |
Security Pipeline
Every message passes through multiple security checks before reaching the Agent:
- InputSanitizer — strips invisible control characters
- RateLimiter — rate limiting (prevents spam flooding)
- PromptGuardian — AI-driven prompt injection detection
- UserPermissionService — role-based access control
- ChannelPermissionGate — sensitive operation confirmation mechanism
Workflow
External platform message (Discord/Telegram/...)
│
▼
Channel Plugin ─── receive and parse message
│
▼
ChannelPluginRegistry ─── convert to unified ChannelMessage format
│
▼
ChannelMessageRouter ─── security pipeline checks + trigger rule matching
│
▼
ChannelMagiBridge ─── convert to MagiIncomingMessage
│
▼
MagiService (Agent) ─── process and generate reply
│
▼
ChannelMessageRouter ─── format + message splitting
│
▼
Channel Plugin ─── send reply back to the original platform
Plugin Architecture
The Channel system uses a plugin-based architecture supporting two plugin sources:
| Source | Directory | Description | Priority |
|---|---|---|---|
| Built-in (Bundled) | resources/bundled-channel-plugins/ | Distributed with the app installer; read-only | Lower |
| User (Marketplace) | {userData}/channel-plugins/ | Downloaded from Marketplace or manually installed; read/write | Higher |
When the same plugin type exists in both directories, the user directory version takes precedence (potentially a newer Marketplace version).
Each plugin must include an elftia-channel.json manifest file declaring the plugin type, entry file, required credentials, and other information.
Quick Start
- Open Settings → Channel
- Click Add Channel and select a platform (e.g., Discord)
- If the plugin is not installed, the system will automatically download it from the Marketplace
- Enter the platform credentials (e.g., Discord Bot Token)
- Configure the trigger rules (recommended: start with
mentionmode for testing) - Click Connect to start the instance
- Send a message to the bot on the corresponding platform to verify the connection
Next Steps
- Discord Setup Guide — detailed steps for configuring a Discord bot
- Trigger Rules & Security — trigger mode configuration and security pipeline details