Install
openclaw skills install telegram-autopilotClawHub Security found sensitive or high-impact capabilities. Review the scan results before using.
Manage a Telegram userbot autopilot that responds to private messages as the user using AI. Use when the user wants to set up auto-replies on their personal Telegram account, manage allowed contacts, configure AI response style, or send messages/media as themselves. Triggers on "telegram autopilot", "auto reply telegram", "manage my telegram", "respond for me", "telegram userbot", "paid media telegram". Requires secrets — Telegram API credentials (api_id, api_hash), phone number, optional 2FA password, AI provider API key (Anthropic or OpenAI-compatible), optional Telegram bot token for owner notifications.
openclaw skills install telegram-autopilotSource: https://github.com/Shor73/telegram-autopilot Author: @Shor73 License: MIT
AI-powered autopilot for personal Telegram accounts. Responds to private messages as the user when they're unavailable.
pip3 install telethonDirect the user to https://my.telegram.org → API Development Tools → create app. They need: API ID (number) and API Hash (string).
Telegram login requires: phone → OTP code → optional 2FA password.
Critical: OTP codes expire in ~60 seconds. Minimize latency:
Run scripts/setup.py with the user's credentials. It handles:
enter_code.txt)python3 scripts/setup.py --api-id 12345 --api-hash "abc123" --phone "+1234567890"
The session file (.session) persists auth — login is one-time only.
Edit config.json to define allowed contacts:
{
"contacts": {
"username": {
"name": "Display Name",
"id": 123456789,
"tone": "friendly",
"language": "en"
}
},
"ai": {
"provider": "anthropic",
"model": "claude-sonnet-4-6",
"api_key": "sk-ant-...",
"max_tokens": 300
},
"owner": {
"name": "Owner Name",
"bio": "Brief description for the AI persona",
"telegram_id": 123456789
},
"notifications": {
"bot_token": "optional-bot-token-for-notifications",
"chat_id": "optional-chat-id"
}
}
python3 scripts/autopilot.py --config config.json --session session_name
Telegram paid media (inputMediaPaidMedia) only works in channels, not private chats.
To send paid media:
InputMediaPaidMedia(stars_amount=N, extended_media=[...])python3 scripts/send_paid_media.py --session session_name --target username --photo /path/to/photo.jpg --stars 1
Stop autopilot: kill the process or send SIGTERM.
Add/remove contacts: edit config.json and restart.
telegram-autopilot/
├── SKILL.md
├── scripts/
│ ├── setup.py — Login flow (OTP + 2FA)
│ ├── autopilot.py — Main event loop
│ ├── send_paid_media.py — Paid media via channel
│ └── code_server.py — Web form for fast OTP entry
└── references/
└── telegram-auth.md — Telegram auth flow documentation
| Secret | Purpose | Where used |
|---|---|---|
| Telegram API ID + Hash | MTProto client auth | setup.py, autopilot.py |
| Phone number + 2FA | Account login (one-time) | setup.py |
| AI API key | Response generation | autopilot.py |
| Bot token (optional) | Owner notifications | autopilot.py |
All secrets are stored in config.json — never commit this file.
.session file grants full access to the account. Protect it like a password.code_server.py binds to 127.0.0.1 (localhost only). Never expose it to the network.