Commands, package names, and image names on this page come from the open-source project that Mibyan Desktop is built on, and can differ from the Mibyan Desktop installer. For the supported Mibyan install and update path, see Install and update.
What We’re Building
A Telegram bot that:- Any authorized team member can DM for help — code reviews, research, shell commands, debugging
- Runs on your server with full tool access — terminal, file editing, web search, code execution
- Per-user sessions — each person gets their own conversation context
- Secure by default — only approved users can interact, with two authorization methods
- Scheduled tasks — daily standups, health checks, and reminders delivered to a team channel
Prerequisites
Before starting, make sure you have:- Mibyan installed on a server or VPS (not your laptop — the bot needs to stay running). Follow the installation guide if you haven’t yet.
- A Telegram account for yourself (the bot owner)
- An LLM provider configured — at minimum, an API key for OpenAI, Anthropic, or another supported provider in
~/.mibyan/.env
Step 1: Create a Telegram Bot
Every Telegram bot starts with @BotFather — Telegram’s official bot for creating bots.-
Open Telegram and search for
@BotFather, or go to t.me/BotFather -
Send
/newbot— BotFather will ask you two things:- Display name — what users see (e.g.,
Team Mibyan Assistant) - Username — must end in
bot(e.g.,myteam_mibyan_bot)
- Display name — what users see (e.g.,
-
Copy the bot token — BotFather replies with something like:
Save this token — you’ll need it in the next step.
-
Set a description (optional but recommended):
Choose your bot, then enter something like:
-
Set bot commands (optional — gives users a command menu):
Choose your bot, then paste:
Step 2: Configure the Gateway
You have two options: the interactive setup wizard (recommended) or manual configuration.Option A: Interactive Setup (Recommended)
Option B: Manual Configuration
Add these lines to~/.mibyan/.env:
Finding Your User ID
Your Telegram user ID is a numeric value (not your username). To find it:- Message @userinfobot on Telegram
- It instantly replies with your numeric user ID
- Copy that number into
TELEGRAM_ALLOWED_USERS
Telegram user IDs are permanent numbers like
123456789. They’re different from your @username, which can change. Always use the numeric ID for allowlists.Step 3: Start the Gateway
Quick Test
Run the gateway in the foreground first to make sure everything works:Ctrl+C to stop.
Production: Install as a Service
For a persistent deployment that survives reboots:--system.
Verify It’s Running
Step 4: Set Up Team Access
Now let’s give your teammates access. There are two approaches.Approach A: Static Allowlist
Collect each team member’s Telegram user ID (have them message @userinfobot) and add them as a comma-separated list:Approach B: DM Pairing (Recommended for Teams)
DM pairing is more flexible — you don’t need to collect user IDs upfront. Here’s how it works:-
Teammate DMs the bot — since they’re not on the allowlist, the bot replies with a one-time pairing code:
- Teammate sends you the code (via any channel — Slack, email, in person)
-
You approve it on the server:
- They’re in — the bot immediately starts responding to their messages
Security Considerations
- Never set
GATEWAY_ALLOW_ALL_USERS=trueon a bot with terminal access — anyone who finds your bot could run commands on your server - Pairing codes expire after 1 hour and use cryptographic randomness
- Rate limiting prevents brute-force attacks: 1 request per user per 10 minutes, max 3 pending codes per platform
- After 5 failed approval attempts, the platform enters a 1-hour lockout
- All pairing data is stored with
chmod 0600permissions
Step 5: Configure the Bot
Set a Home Channel
A home channel is where the bot delivers cron job results and proactive messages. Without one, scheduled tasks have nowhere to send output. Option 1: Use the/sethome command in any Telegram group or chat where the bot is a member.
Option 2: Set it manually in ~/.mibyan/.env:
Configure Tool Progress Display
Control how much detail the bot shows when using tools. In~/.mibyan/config.yaml:
Users can also change this per-session with the
/verbose command in chat.
Set Up a Personality with SOUL.md
Customize how the bot communicates by editing~/.mibyan/SOUL.md:
For a full guide, see Use SOUL.md with Mibyan.
Add Project Context
If your team works on specific projects, create context files so the bot knows your stack:Context files are injected into every session’s system prompt. Keep them concise — every character counts against your token budget.
Step 6: Set Up Scheduled Tasks
With the gateway running, you can schedule recurring tasks that deliver results to your team channel.Daily Standup Summary
Message the bot on Telegram:Server Health Check
Managing Scheduled Tasks
Production Tips
Use Docker for Safety
On a shared team bot, use Docker as the terminal backend so agent commands run in a container instead of on your host:~/.mibyan/config.yaml:
Monitor the Gateway
Keep Mibyan Updated
From Telegram, send/update to the bot — it will pull the latest version and restart. Or from the server:
Log Locations
Going Further
You’ve got a working team Telegram assistant. Here are some next steps:- Security Guide — deep dive into authorization, container isolation, and command approval
- Messaging Gateway — full reference for gateway architecture, session management, and chat commands
- Telegram Setup — platform-specific details including voice messages and TTS
- Scheduled Tasks — advanced cron scheduling with delivery options and cron expressions
- Context Files — AGENTS.md, SOUL.md, and .cursorrules for project knowledge
- Personality — built-in personality presets and custom persona definitions
- Add more platforms — the same gateway can simultaneously run Discord, Slack, and WhatsApp
Questions or issues? Open an issue on GitHub — contributions are welcome.

