Skip to main content
The user messages on Telegram, Slack, or Discord; the gateway routes each channel to your agent. Connect PraisonAI agents to popular chat platforms through the channels gateway integration.

How It Works

Quick Start

1

Install Bot Dependencies

Install the bot integration package:
This adds support for Telegram, Discord, Slack, and WhatsApp platforms.
2

Configure Platform Tokens

Set environment variables for your chosen platforms:
3

Launch Gateway with Channels

Start the integrated gateway with channel bot support:
This starts Pattern B host integration with channels feature enabled.
All configured channels now start reliably from a single gateway, resolving the previous cannot pickle '_thread.RLock' object error through automatic Agent Cloning.
Validate channel credentials before starting the gateway with praisonai gateway doctor — see Gateway CLI → Pre-flight credential check.

Platform Configuration

Telegram Setup

  1. Create bot with @BotFather
  2. Get your bot token
  3. Set environment variable:
Telegram bots now support live streaming replies that update in real-time as your agent thinks. See Bot Streaming Replies for configuration options.

Discord Setup

  1. Create application in Discord Developer Portal
  2. Create bot and get token
  3. Set environment variable:

Slack Setup

  1. Create Slack app in Slack API
  2. Get Bot User OAuth Token and App-Level Token
  3. Set environment variables:

WhatsApp Setup

  1. Set up WhatsApp Business API
  2. Get access token and phone number ID
  3. Set environment variables:

Gateway Patterns

Pattern B: In-Process Host

Run channels within your application process:

Pattern C: Integrated Gateway

Single process with WebSocket support:
The gateway serves:
  • Chat UI at http://localhost:8080
  • REST API at http://localhost:8080/api
  • WebSocket at ws://localhost:8080/ws
  • Bot integrations auto-start based on environment variables
WebSocket gateway YAML may include a gateway.rate_limit: block (max_requests, window_seconds, lockout_seconds). See Gateway Rate Limit Policy and Gateway Handshake Protocol for how denials surface as rate_limited during connect.

Legacy Mode

For callback-only integration without provider wiring:
This uses only @aiui.reply callbacks without automatic agent integration.

BotOS Multi-Platform Orchestration

Use BotOS for advanced multi-platform management:
Pass reliability="production" to enable graceful drain + inbound admission control in one line. See Gateway Reliability.

Channel Features Integration

The praisonaiui.features.channels module provides: Example with custom configuration:

Channel Security

All channels enforce the same access-control pipeline regardless of whether you run them via praisonai bot start or praisonai gateway start.

Gateway YAML Reference

Complete YAML field documentation and pipeline diagram

BotConfig Reference

Standalone bot configuration options

Shell execution opt-in

Set allow_shell: true on a channel to let its bot run shell commands on the gateway host. Policy is per-channel — Slack can auto-approve while WhatsApp requires approval.

Bot Shell Execution

Full field reference, per-platform approval routing, and copy-paste recipes.

Platform-Specific Features

Telegram

  • Supports markdown formatting
  • File uploads and downloads
  • Inline keyboards
  • Command handling (/start, /help)

Discord

  • Rich embeds and attachments
  • Slash commands
  • Thread support
  • Role-based permissions

Slack

  • Block kit UI components
  • App Home tab
  • Workflow integration
  • Enterprise security features

WhatsApp

  • Media message support
  • Template messages
  • Business API features
  • Webhook verification

Outbound Media Delivery

Send agent-generated images and files through channel adapters with path validation

Bot Inbound Media

Receive and validate photos and documents from users

Development vs Production


Reachable Targets

Give the agent a named directory of channels it can deliver to. When a message arrives, the agent’s system prompt lists which channels are reachable by friendly name.
describe_targets() compiles the list that appears in the agent prompt:
ChannelDirectory covers outbound delivery (which channel an agent sends to). For inbound routing — dispatching an incoming WhatsApp/SMS number to a specific agent — use the Agent Registry.
Call refresh_directory() on a background loop so the agent sees channels it has not yet been messaged from:

Platform-Aware Agents

Full reference for Origin, ReachableTarget, and channel-directory configuration.

Troubleshooting

Common Issues

Check environment variables are set correctly:
Ensure gateway is running with proper agent configuration:
For Pattern C, ensure WebSocket endpoint is accessible:

Best Practices

Never hardcode tokens in source code:
Different platforms have different rate limits:
Set up monitoring for production deployments:

Host Integration

Pattern B/C integration

Integration Patterns

Pattern comparison

Outbound Media Delivery

Deliver agent-generated media via gateway channel adapters

Messaging Bots

Full bot setup for Telegram, Discord, Slack, and WhatsApp