Multi-Channel Distribution

Learn how to distribute your AI agent across multiple platforms: Web, Telegram, Discord, and Slack.

What is Multi-Channel Distribution?

Multi-channel distribution means your agent can interact with users on different platforms:

  • Web: Built-in chat interface at app.flutch.ai
  • Telegram: Bot integration for messaging app
  • Discord: Bot for community servers
  • Slack: Integration for workplace communication (coming soon)

Key benefit: Write your agent logic once, deploy everywhere. Users choose their preferred platform.

Accessing Distribution Settings

  1. Log in to console.flutch.ai
  2. Navigate to Agents → Select your agent
  3. Go to SettingsDistribution section

URL: https://console.flutch.ai/agents/{agentId}/settings

Channel Overview

Web (Always Enabled)

Status: ✅ Always active (cannot be disabled)

What you get:

  • Public chat URL: https://app.flutch.ai/a/{agentId}
  • Embeddable widget for your website
  • Mobile-responsive interface
  • Conversation persistence
  • Streaming responses

Use cases:

  • Primary user interface
  • Embedding on your website
  • Sharing with testers
  • Public demos

No configuration needed - works immediately after deployment.

Telegram Bot

Status: ⚠️ Requires bot token

What you get:

  • Users interact via Telegram app
  • Push notifications
  • Mobile + desktop support
  • Group chat support (optional)
  • Conversation context preserved

Use cases:

  • Customer support via messaging
  • Personal assistant bots
  • Community engagement
  • Automated notifications

Discord Bot

Status: ⚠️ Requires bot token and webhook

What you get:

  • Bot presence in Discord servers
  • Channel-specific conversations
  • Role-based access control (via Discord)
  • Rich embeds and reactions
  • Multi-server deployment

Use cases:

  • Community support servers
  • Gaming communities
  • Developer communities
  • Team collaboration

Slack Integration

Status: 🚧 Coming soon

What you'll get:

  • Workplace assistant
  • Channel integration
  • Direct messages
  • Slash commands
  • Enterprise SSO support

Use cases:

  • Internal company assistant
  • HR/IT support bot
  • Workflow automation
  • Knowledge base access

Setting Up Telegram Bot

Step 1: Create Telegram Bot

  1. Open Telegram and find @BotFather
  2. Send /newbot command
  3. Follow prompts:
    BotFather: Alright, a new bot. How are we going to call it?
    You: My Awesome Agent
    
    BotFather: Good. Now let's choose a username for your bot.
    You: my_awesome_agent_bot
    
    BotFather: Done! Here's your token:
    123456789:ABCdefGHIjklMNOpqrsTUVwxyz
    
  4. Copy the token (you'll need it in next step)

Step 2: Configure in Flutch

  1. Go to agent settings in console.flutch.ai
  2. Find Telegram Bot section
  3. Click Enable Telegram
  4. Paste your bot token
  5. Click Save

Flutch automatically:

  • Configures webhook: https://app.flutch.ai/api/public/tg/webhook/{agentId}
  • Registers it with Telegram
  • Starts listening for messages

Step 3: Test Your Bot

  1. Find your bot in Telegram (search for username you created)
  2. Click Start
  3. Send a message
  4. Bot responds using your agent logic

Example conversation:

bash
You: Hello!
Bot: Hi! I'm your AI assistant. How can I help you today?

You: What can you do?
Bot: I can help with [your agent's capabilities]. What would you like to know?

Telegram Bot Settings (Optional)

Configure bot behavior via BotFather:

bash
/setdescription - Set bot description (shown in chat)
/setabouttext - Set about text (shown in bot profile)
/setuserpic - Set bot profile picture
/setcommands - Set bot commands menu

Example commands:

bash
/setcommands

start - Start conversation
help - Show available commands
reset - Start new conversation

Setting Up Discord Bot

Step 1: Create Discord Application

  1. Go to Discord Developer Portal
  2. Click New Application
  3. Enter application name: "My Awesome Agent"
  4. Navigate to Bot section
  5. Click Add Bot
  6. Copy Bot Token (click "Reset Token" if needed)

Step 2: Configure Bot Permissions

  1. In Discord Developer Portal → Bot section
  2. Enable required intents:
    • ✅ Server Members Intent (read members)
    • ✅ Message Content Intent (read messages)
  3. In OAuth2URL Generator:
    • Scopes: bot
    • Permissions: Send Messages, Read Message History, Embed Links
  4. Copy generated URL

Step 3: Invite Bot to Server

  1. Paste OAuth2 URL in browser
  2. Select server (you must have "Manage Server" permission)
  3. Authorize bot
  4. Bot appears in server member list (offline until configured)

Step 4: Configure in Flutch

  1. Go to agent settings in console.flutch.ai
  2. Find Discord Bot section
  3. Click Enable Discord
  4. Paste your bot token
  5. Webhook URL is shown: https://app.flutch.ai/api/public/discord/webhook/{agentId}
  6. Click Save

Bot comes online in your Discord server!

Step 5: Test Your Bot

Option A: Direct Message

  1. Find bot in server member list
  2. Right-click → Message
  3. Send a message
  4. Bot responds

Option B: Channel Mention

  1. In any channel, mention bot: @MyBot hello
  2. Bot responds in same channel

Example conversation:

bash
You: @MyBot what's the weather like?
MyBot: I don't have access to weather information, but I can help with
       [your agent's capabilities]. What would you like to know?

Discord Bot Behavior

When bot responds:

  • Direct mentions: @MyBot message
  • Direct messages (DMs)
  • Replies to bot's messages

When bot ignores:

  • Regular channel messages without mention
  • Messages from other bots
  • System messages

Thread support:

  • Conversations in DMs maintain context
  • Channel conversations use Discord thread as context
  • Each thread = separate conversation

Setting Up Slack (Manual)

Note: Slack integration is in beta. Configuration requires manual webhook setup.

Step 1: Create Slack App

  1. Go to Slack API
  2. Click Create New AppFrom scratch
  3. Enter app name: "My Awesome Agent"
  4. Select workspace
  5. Click Create App

Step 2: Configure Bot Token

  1. In app settings → OAuth & Permissions
  2. Add scopes:
    • chat:write - Send messages
    • chat:write.public - Send to public channels
    • im:history - Read DMs
    • im:read - List DMs
  3. Click Install to Workspace
  4. Copy Bot User OAuth Token (starts with xoxb-)

Step 3: Set Up Event Subscriptions

  1. In app settings → Event Subscriptions
  2. Enable events
  3. Request URL: https://app.flutch.ai/api/public/slack/webhook/{agentId}
  4. Subscribe to bot events:
    • message.im - Direct messages
    • app_mention - When bot is mentioned
  5. Save changes

Step 4: Configure in Flutch

  1. Go to agent settings in console.flutch.ai
  2. Find Slack Integration section
  3. Click Enable Slack
  4. Paste Bot User OAuth Token
  5. Verify webhook URL matches Event Subscriptions URL
  6. Click Save

Step 5: Test Your Bot

  1. Open Slack workspace
  2. Find bot in Apps section
  3. Send direct message
  4. Or mention in channel: @MyBot hello

Embedded Web Widget

Want to embed chat on your own website?

Step 1: Get Embed Code

  1. Go to agent settings
  2. Web section → Embed Widget
  3. Copy embed code:
html
<script src="https://app.flutch.ai/embed.js"></script>
<script>
  FlutchChat.init({
    agentId: 'your-agent-id',
    position: 'bottom-right', // or 'bottom-left'
    theme: 'light', // or 'dark'
    primaryColor: '#0066FF'
  });
</script>

Step 2: Add to Your Website

Paste before closing </body> tag:

html
<!DOCTYPE html>
<html>
<head>
  <title>My Website</title>
</head>
<body>

  <script src="https://app.flutch.ai/embed.js"></script>
  <script>
    FlutchChat.init({
      agentId: 'abc123',
      position: 'bottom-right',
      theme: 'light',
      primaryColor: '#0066FF'
    });
  </script>
</body>
</html>

Step 3: Customize Appearance

Widget options:

javascript
FlutchChat.init({
  agentId: 'abc123',

  // Position
  position: 'bottom-right', // 'bottom-left', 'top-right', 'top-left'

  // Theme
  theme: 'light', // 'dark', 'auto'
  primaryColor: '#0066FF',

  // Behavior
  autoOpen: false, // Auto-open on page load
  greeting: "Hi! How can I help?", // First message

  // Size
  width: '400px',
  height: '600px',

  // Advanced
  allowFileUpload: true,
  showTimestamps: true,
  enableNotifications: true
});

Widget API

Control widget programmatically:

javascript
// Open chat
FlutchChat.open();

// Close chat
FlutchChat.close();

// Send message programmatically
FlutchChat.sendMessage("Hello from website!");

// Listen for events
FlutchChat.on('message', (message) => {
  console.log('User sent:', message);
});

FlutchChat.on('response', (response) => {
  console.log('Agent responded:', response);
});

Managing Multiple Channels

Viewing Active Channels

Dashboard shows all enabled channels:

bash
✅ Web       Active   app.flutch.ai/a/abc123
✅ Telegram  Active   @my_awesome_agent_bot
✅ Discord   Active   MyBot#1234
⚪ Slack     Disabled -

Channel-Specific Settings

Each channel can have separate configuration:

Per-channel settings:

  • Enable/disable channel
  • Rate limiting
  • Access control (coming soon)
  • Custom prompts (coming soon)

Unified Conversation History

All conversations from all channels are stored together:

  • View in Message Audit
  • Same thread can span multiple channels (if user provides ID)
  • Analytics aggregate across channels

Monitoring Usage by Channel

Analytics dashboard shows:

  • Messages per channel
  • Most active channel
  • Channel-specific costs
  • User distribution across channels

Example:

bash
Channel Usage (Last 7 Days):
- Web:      1,245 messages (45%)
- Telegram: 980 messages (35%)
- Discord:  550 messages (20%)
- Slack:    0 messages (0%)

Total: 2,775 messages

Security & Access Control

Bot Token Security

Important rules:

  • ✅ Never commit bot tokens to git
  • ✅ Store tokens securely in Flutch settings
  • ✅ Rotate tokens if compromised
  • ❌ Don't share tokens publicly
  • ❌ Don't hardcode tokens in code

If token is compromised:

  1. Regenerate token in platform (BotFather/Discord/Slack)
  2. Update token in Flutch settings immediately
  3. Check Message Audit for suspicious activity

Rate Limiting

Protect your agent from abuse:

Global limits:

  • 60 messages per minute per user
  • 1000 messages per hour per channel
  • Automatic backoff for violations

Configure in settings:

bash
Rate Limits:
- Messages per minute: 60
- Messages per hour: 1000
- Backoff duration: 60 seconds

Channel-Specific Access

Telegram:

  • Public bots: Anyone can start conversation
  • Private bots: Share link, user must click Start
  • Group bots: Admin adds bot to group

Discord:

  • Server-level: Bot must be invited by admin
  • Channel-level: Permissions control where bot responds
  • Role-based: Use Discord roles for access control

Slack:

  • Workspace-level: Admin installs app
  • Channel-level: Invite bot to specific channels
  • Enterprise: SSO integration (coming soon)

Troubleshooting

Telegram Bot Not Responding

Check:

  • Bot token is correct
  • Webhook is configured (automatic in Flutch)
  • Bot is not blocked by user
  • Agent is deployed and active

Test webhook:

bash
curl https://app.flutch.ai/api/public/tg/webhook/{agentId}
# Should return: {"status": "ok"}

Check logs:

bash
flutch logs <agent-id> --grep "telegram"

Discord Bot Offline

Check:

  • Bot token is correct and not expired
  • Message Content Intent is enabled
  • Bot has permissions in channel
  • Agent is deployed and active

Test bot:

  1. Send DM to bot
  2. Check Message Audit for message
  3. Check logs for errors

Webhook Not Working

Common issues:

  1. Webhook URL wrong:

    • Copy exactly from Flutch settings
    • Format: https://app.flutch.ai/api/public/{platform}/webhook/{agentId}
  2. SSL certificate issues:

    • Webhooks require HTTPS
    • Flutch handles this automatically
  3. Firewall blocking:

    • Ensure platform can reach Flutch servers
    • Check platform status page

Widget Not Showing

Check:

  • Embed script is loaded before init
  • Agent ID is correct
  • No JavaScript errors in console
  • Website allows iframes (CSP policy)

Debug in browser console:

javascript
// Check if FlutchChat is loaded
console.log(FlutchChat);

// Check initialization
FlutchChat.debug = true;
FlutchChat.init({ agentId: 'abc123' });

Best Practices

1. Start with Web, Add Channels Gradually

  • Deploy to web first, ensure it works
  • Add one channel at a time
  • Test thoroughly before adding next channel

2. Use Channel-Appropriate Language

Consider platform culture:

  • Telegram: More casual, emoji-friendly
  • Discord: Gaming/community terminology
  • Slack: Professional, workplace language

Configure different system prompts per channel (coming soon).

3. Monitor Channel-Specific Issues

Some issues are channel-specific:

  • Telegram: Formatting (Markdown syntax)
  • Discord: Mentions and embeds
  • Web: Mobile responsiveness

4. Set Clear Expectations

Tell users what your bot can do:

  • Use bot description (Telegram/Discord)
  • Welcome message on first interaction
  • Help command explaining capabilities

5. Handle Rate Limits Gracefully

When rate limited:

  • Don't ignore messages silently
  • Send clear message: "Too many requests, try again in 60s"
  • Log rate limit hits for analysis

6. Keep Tokens Secure

  • Store in Flutch settings, not in code
  • Use environment variables for local testing
  • Rotate periodically
  • Audit token usage

Analytics by Channel

Track performance per channel:

Metrics available:

  • Messages per channel
  • Response time by channel
  • Token usage by channel
  • User satisfaction by channel (if using feedback)
  • Error rate by channel

Use insights to:

  • Prioritize channels with most usage
  • Identify channel-specific issues
  • Optimize for each platform
  • Allocate resources effectively

Next Steps


Tip: Start with web only, ensure your agent works perfectly, then expand to other channels!

Screenshots Needed

TODO: Add screenshots for:

  • Distribution settings page
  • Telegram bot configuration
  • Discord bot setup
  • Web widget customization
  • Channel usage analytics