Skip to main content

Channel Commands

Channels connect OpenFang agents to external messaging platforms like Telegram, Discord, Slack, and more. All channel commands are under the openfang channel namespace.

Listing Channels

openfang channel list

List configured channels and their status.
Example Output:
Status Values:
  • Ready ✓ - Channel is configured and credentials are valid
  • Missing env ⚠ - Channel is configured in config.toml but environment variable is not set
  • Not configured ✗ - Channel has not been set up
The webchat channel is built-in and always available via the web dashboard.

Setting Up Channels

openfang channel setup

Interactive setup wizard for a channel integration.
Arguments: Supported Channels:
  • telegram - Telegram bots
  • discord - Discord bots
  • slack - Slack apps
  • whatsapp - WhatsApp Business API
  • email - SMTP email
  • signal - Signal messenger
  • matrix - Matrix protocol

Telegram Setup

Generated Configuration:

Discord Setup

Generated Configuration:

Slack Setup

Generated Configuration:

WhatsApp Setup

Email Setup

All credentials are saved to ~/.openfang/.env with owner-only permissions (0600 on Unix). Never commit this file to version control.

Testing Channels

openfang channel test

Send a test message through a configured channel.
Arguments: Requirements:
  • Daemon must be running
  • Channel must be configured and enabled
Example:
Test Message Content: The test message includes:
  • Timestamp
  • OpenFang version
  • Confirmation that the channel is working
If the test fails, check the daemon logs: openfang logs or ~/.openfang/tui.log

Enabling & Disabling Channels

openfang channel enable

Enable a configured channel.
Example:

openfang channel disable

Disable a channel without removing its configuration.
Example:
Disabling a channel keeps all configuration and credentials. The channel can be re-enabled without re-entering credentials.

Channel Configuration Reference

Telegram

Environment Variables:
  • TELEGRAM_BOT_TOKEN - Bot token from @BotFather

Discord

Environment Variables:
  • DISCORD_BOT_TOKEN - Bot token from Discord Developer Portal

Slack

Environment Variables:
  • SLACK_BOT_TOKEN - Bot User OAuth Token (starts with xoxb-)

WhatsApp (Twilio)

Environment Variables:
  • WHATSAPP_ACCOUNT_SID - Twilio Account SID
  • WHATSAPP_AUTH_TOKEN - Twilio Auth Token

Email (SMTP)

Environment Variables:
  • SMTP_USERNAME - Email address
  • SMTP_PASSWORD - Email password or app-specific password

Using Channels with Agents

Once configured, agents can automatically respond to messages from channels.

Agent Channel Binding

Bind an agent to specific channels in its manifest:

Message Flow

  1. User sends message via Telegram/Discord/Slack
  2. Channel adapter receives message and forwards to daemon
  3. Agent processes the message
  4. Response sent back through the same channel

Example Telegram Interaction

Would you like me to explain any part of this code?
Verify environment variables:
Check daemon logs:

Invalid Token Error

Solution:
  1. Re-run setup: openfang channel setup telegram
  2. Or manually edit ~/.openfang/.env with the correct token
  3. Restart daemon: openfang stop && openfang start

Permission Denied

Solution: For Discord:
  1. Go to Discord Developer Portal
  2. Bot → Privileged Gateway Intents → Enable MESSAGE CONTENT INTENT
  3. Reinvite bot with correct permissions
For Slack:
  1. Go to api.slack.com/apps
  2. OAuth & Permissions → Add missing scopes
  3. Reinstall app to workspace

Channel Webhook Not Found

Solution:
  1. Verify bot is in the channel/server
  2. Check channel ID is correct
  3. For Discord: Bot needs “View Channel” permission

Advanced Configuration

Multi-Agent Channel Routing

Route different channels to different agents:

Rate Limiting

Configure per-channel rate limits:

Message Formatting

Customize message formatting per channel:

Next Steps

Workflow Commands

Automate multi-step tasks

Channel Adapters

Learn about channel architecture