Claude AI on your phone/desktop — personal, self-hosted messenger bot for Telegram, WhatsApp, and Slack
Project description
Telechat
Claude AI on your phone / desktop — personal, self-hosted, zero-infrastructure.
Supports WhatsApp, Telegram, and Slack simultaneously from a single process.
A bot that connects to Claude AI via two modes:
- CLI mode — Uses the Claude Code CLI (
claude). No API key needed if you have a Claude subscription. - API mode — Uses the Anthropic API directly. Requires an API key. Works in Docker.
Install
# npm (auto-installs Python deps on first run)
npm install -g telechat
telechat
# pip
pip install telechat
telechat
Quick Start (from source)
# Clone
git clone https://github.com/telechatai/telechat.git
cd telechat
# Install
./scripts/install.sh
# Edit .env with your tokens
nano .env
# Run
./scripts/start.sh
Platform comparison
| Telegram | Slack | ||
|---|---|---|---|
| Bridge | Telegram Bot API | Green API free tier | Slack Bolt + Socket Mode |
| Setup | Talk to @BotFather | Scan a QR code | Create a Slack app |
| Photo / file support | Yes | Text only | Text only |
| Interactive UI | Inline buttons | No | Reactions as status indicator |
| Works without public URL | Yes (polling) | Yes (polling) | Yes (WebSocket) |
| Works on corporate Wi-Fi | Depends | Yes | Yes |
Setup
1 — Choose your platform(s)
Set BOT_MODE in .env — accepts a comma-separated list or a shorthand:
| Value | What starts |
|---|---|
telegram |
Telegram only (default) |
whatsapp |
WhatsApp only |
slack |
Slack only |
telegram,slack |
Telegram + Slack |
telegram,whatsapp |
Telegram + WhatsApp |
both |
Telegram + WhatsApp (legacy alias) |
all |
All three platforms |
2a — Telegram setup
- Open Telegram and search for @BotFather (verified blue checkmark).
- Send
/newbotand follow the prompts. - Copy the token → set
TELEGRAM_BOT_TOKENin.env.
Optional: customize your bot
| BotFather command | What it does |
|---|---|
/setdescription |
Text users see before starting the bot |
/setabouttext |
Bio shown on the bot's profile |
/setuserpic |
Profile picture |
/setcommands |
Register autocomplete hints |
Register command hints:
start - Welcome message
reset - Clear conversation history
mode - Show current mode and model
id - Show your Telegram user ID
Finding your user ID (for ALLOWED_USER_IDS)
- Start your bot and send
/id - Copy the numeric ID → paste into
ALLOWED_USER_IDSin.env
2b — Slack setup (Socket Mode — no public URL needed)
Corporate / enterprise workspace? Most company Slack workspaces (e.g. Intuit) block individual users from installing new apps. If you hit "An error occurred while creating your request", create a free personal workspace at slack.com/get-started and install the bot there instead. You're the admin — no approval needed. Invite your teammates to the personal workspace to share the bot.
Step-by-step
-
Go to https://api.slack.com/apps → Create New App → From scratch
(pick your personal workspace, not a corporate one) -
Settings → Socket Mode → Enable
→ Create an App-Level Token → name it anything → scope:connections:write
→ copy thexapp-1-...token — this isSLACK_APP_TOKEN -
OAuth & Permissions → Bot Token Scopes → add all of these:
Scope Purpose chat:writeSend messages channels:historyRead public channel messages groups:historyRead private channel messages im:historyRead DMs im:writeOpen DM conversations app_mentions:readDetect @mentions reactions:writeShow ⏳ while Claude thinks -
Event Subscriptions → Enable → Subscribe to bot events:
message.im,message.channels,message.groups,app_mention
→ Save Changes -
OAuth & Permissions → Install to Workspace → Allow
→ copy thexoxb-...Bot Token — this isSLACK_BOT_TOKEN -
In your Slack workspace, invite the bot to any channel:
/invite @yourbot
.env for Slack
BOT_MODE=slack
SLACK_BOT_TOKEN=xoxb-...
SLACK_APP_TOKEN=xapp-1-...
# Your Slack member ID to restrict access (leave empty to allow everyone)
# Find it: click your name → View profile → ⋯ → Copy member ID
SLACK_ALLOWED_USER_IDS=U01234567
How it works
| Trigger | How to use |
|---|---|
| Direct message | Just message the bot |
| Channel | @yourbot <question> |
| Thread | Reply mentioning the bot to keep conversation in-thread |
A ⏳ reaction appears on your message while Claude is thinking, removed when done.
2c — WhatsApp setup (Green API — free, no Meta account needed)
- Sign up at https://console.green-api.com
- Click Create instance → choose Developer plan (free — 1 500 msg/month)
- In the instance dashboard → Scan QR → scan with your WhatsApp phone
- Copy Instance ID and API Token → paste into
.env:
BOT_MODE=whatsapp
GREEN_API_INSTANCE_ID=1234567890
GREEN_API_TOKEN=your_token_here
WHATSAPP_ALLOWED_NUMBERS=919876543210 # your number without the +
Corporate network note: Green API works over standard HTTPS polling — no webhook or public URL needed. If Telegram is blocked on your network, use
BOT_MODE=whatsappinstead.
3 — Configure Claude
All Claude settings apply to both platforms:
| Variable | Default | Description |
|---|---|---|
CLAUDE_MODE |
cli |
cli or api |
ANTHROPIC_API_KEY |
— | Required for API mode |
CLAUDE_MODEL |
claude-sonnet-4-20250514 |
API mode model |
SYSTEM_PROMPT |
(generic) | Your personal instructions to Claude |
CLAUDE_CLI_WORK_DIR |
~ |
Working directory for CLI |
CLAUDE_CLI_ADD_DIRS |
— | Comma-separated extra dirs Claude can access |
CLAUDE_CLI_PERMISSION_MODE |
— | acceptEdits / auto / bypassPermissions |
CLAUDE_CLI_MODEL |
sonnet |
CLI model: haiku / sonnet / opus |
CLAUDE_TIMEOUT |
180 |
Seconds to wait for Claude |
RATE_LIMIT_REQUESTS |
20 |
Max messages per window |
RATE_LIMIT_WINDOW |
60 |
Rate limit window (seconds) |
CLI mode — requires Claude Code CLI installed and authenticated:
# Install Claude Code CLI: https://docs.anthropic.com/en/docs/claude-code
claude auth login
API mode:
CLAUDE_MODE=api
ANTHROPIC_API_KEY=sk-ant-...
Running
Foreground
./scripts/start.sh
As a system service (macOS launchd / Linux systemd)
./scripts/service.sh install # Install and start
./scripts/service.sh status # Check status
./scripts/service.sh logs # Tail logs
./scripts/service.sh restart # Restart
./scripts/service.sh stop # Stop
./scripts/service.sh uninstall # Remove service
Docker (API mode only)
# Set CLAUDE_MODE=api in .env
docker compose up -d
docker logs -f telechat
Telegram commands
| Command | Description |
|---|---|
/start |
Welcome message |
/reset |
Clear conversation history |
/mode |
Show current mode and model |
/model |
Switch model (haiku / sonnet / opus) |
/verbose |
Set output verbosity: 0 quiet · 1 normal · 2 detailed |
/permissions |
Change CLI permission mode |
/usage |
Show usage statistics |
/id |
Show your Telegram user ID |
WhatsApp usage
Just send a message. There are no slash commands — WhatsApp is intentionally kept simple.
Project structure
├── main.py Entry point — reads BOT_MODE, starts adapters
├── claude_core.py Shared: Claude CLI/API, SQLite history, rate limiting
├── telegram_bot.py Telegram adapter
├── whatsapp_bot.py WhatsApp adapter (Green API polling)
├── slack_bot.py Slack adapter (Socket Mode)
├── bot.py Backward-compat shim (runs Telegram, same as before)
├── scripts/
│ ├── install.sh
│ ├── start.sh
│ └── service.sh
├── Dockerfile (API mode only)
├── docker-compose.yml
├── requirements.txt
└── .env.example
Features
- Three platforms — Telegram, WhatsApp, and Slack from one process (
BOT_MODE=all) - Dual Claude mode — CLI (free with Claude subscription) or API
- Typing indicator — shows "typing…" while Claude processes
- Image & file analysis — Telegram only (photos + documents)
- Model switching — haiku / sonnet / opus from Telegram inline buttons
- Verbose mode — see what tools Claude is using
- Rate limiting — configurable per-user throttling
- Persistent history — SQLite, keyed per platform+user; survives restarts
- Usage tracking — per-user message and token statistics
- Markdown rendering — formatted responses with plain-text fallback
Per-developer sharing
Each developer runs their own instance on their own machine:
- Clone this repo
./scripts/install.sh- Set their own credentials +
SYSTEM_PROMPTin.env ./scripts/start.sh
No shared server. No shared credentials. Fully private.
Security
- Set
ALLOWED_USER_IDS(Telegram) orWHATSAPP_ALLOWED_NUMBERSto restrict who can use your bot - Never commit
.env— it is in.gitignore - In CLI mode the bot inherits your Claude auth — don't run on untrusted machines
Troubleshooting
| Symptom | Fix |
|---|---|
| WhatsApp: no replies | Check instance status in Green API console — must be authorized |
| Slack: "error creating request" on install | Corporate workspace blocks app installs — create a free personal workspace at slack.com/get-started instead |
| Slack: bot doesn't respond | Check Socket Mode is enabled; App-Level Token must have connections:write scope |
| Slack: works in channels but not DMs | Add im:history + im:write scopes and reinstall the app to workspace |
| Slack: missing messages after reinstall | Re-subscribe to events (message.im, message.channels, etc.) under Event Subscriptions |
| Telegram: SSL/handshake error | Telegram may be blocked on your network; use BOT_MODE=slack or BOT_MODE=whatsapp |
claude: command not found |
Install Claude Code CLI and ensure it's in PATH |
| Response cut off | Bot auto-chunks at 4 000 chars per message — expected |
| Bot stops after reboot | Use ./scripts/service.sh install for a proper system service |
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file telechatai-1.0.0.tar.gz.
File metadata
- Download URL: telechatai-1.0.0.tar.gz
- Upload date:
- Size: 42.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2023f0669643b6adfc00d0570b3c92f1ec9035530e0f8acfe8aa18e3a66f41eb
|
|
| MD5 |
40bd7c98e2c490a6d7bb439f7409249e
|
|
| BLAKE2b-256 |
a057607d67035c6b55c557cf3a44ce303d936d35264bba49364b3ae46ba9a89b
|
File details
Details for the file telechatai-1.0.0-py3-none-any.whl.
File metadata
- Download URL: telechatai-1.0.0-py3-none-any.whl
- Upload date:
- Size: 37.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e35bb21f74d64ad1861426e6084eac7b80902bd9d6b1ce507ca35df4f1f5b546
|
|
| MD5 |
31aee3033c46e80b1d61e992d0d34f59
|
|
| BLAKE2b-256 |
13603ea3dd6384dd55ce3500a939644b32cf9ad806eb6bed003c47f839bb89f1
|