add-telegram
Add Telegram channel integration via Chat SDK.
- License 许可
- MIT
- 最近更新
- 2026-10-30
- Stars
- ★ 5
- Forks
- 2
01 前言 Front Matter
- name
- add-telegram
- description
- Add Telegram channel integration via Chat SDK.
02 资源文件 3
- 参考文档references/attribution.md1.9 KB
- 参考文档REMOVE.md195 B
- 参考文档VERIFY.md182 B
03 SKILL.md 正文
Add Telegram Channel
Adds Telegram bot support via the Chat SDK bridge.
Install
NanoClaw doesn't ship channels in trunk. This skill copies the Telegram adapter, its formatting/pairing helpers, their tests, and the pair-telegram setup step in from the channels branch.
Pre-flight (idempotent)
Skip to Credentials if all of these are already in place:
src/channels/telegram.ts,telegram-pairing.ts,telegram-markdown-sanitize.ts(and their.test.tssiblings) all existsrc/channels/index.tscontainsimport './telegram.js';setup/pair-telegram.tsexists andsetup/index.ts'sSTEPSmap contains'pair-telegram':@chat-adapter/telegramis listed inpackage.jsondependencies
Otherwise continue. Every step below is safe to re-run.
1. Fetch the channels branch
git fetch origin channels
2. Copy the adapter, helpers, tests, and setup step
git show origin/channels:src/channels/telegram.ts > src/channels/telegram.ts
git show origin/channels:src/channels/telegram-pairing.ts > src/channels/telegram-pairing.ts
git show origin/channels:src/channels/telegram-pairing.test.ts > src/channels/telegram-pairing.test.ts
git show origin/channels:src/channels/telegram-markdown-sanitize.ts > src/channels/telegram-markdown-sanitize.ts
git show origin/channels:src/channels/telegram-markdown-sanitize.test.ts > src/channels/telegram-markdown-sanitize.test.ts
git show origin/channels:setup/pair-telegram.ts > setup/pair-telegram.ts
3. Append the self-registration import
Append to src/channels/index.ts (skip if already present):
import './telegram.js';
4. Register the setup step
In setup/index.ts, add this entry to the STEPS map (right after the register line is fine; skip if already present):
'pair-telegram': () => import('./pair-telegram.js'),
5. Install the adapter package (pinned)
pnpm install @chat-adapter/telegram@4.27.0
6. Build
pnpm run build
Credentials
Create Telegram Bot
- Open Telegram and search for
@BotFather - Send
/newbotand follow the prompts:- Bot name: Something friendly (e.g., "NanoClaw Assistant")
- Bot username: Must end with "bot" (e.g., "nanoclaw_bot")
- Copy the bot token (looks like
123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11)
Important for group chats: By default, Telegram bots only see @mentions and commands in groups. To let the bot see all messages:
- Open
@BotFather>/mybots> select your bot - Bot Settings > Group Privacy > Turn off
Configure environment
Add to .env:
TELEGRAM_BOT_TOKEN=your-bot-token
Sync to container: mkdir -p data/env && cp .env data/env/env
Next Steps
If you're in the middle of /setup, return to the setup flow now.
Otherwise, run /manage-channels to wire this channel to an agent group.
Channel Info
- type:
telegram - terminology: Telegram calls them "groups" and "chats." A "group" has multiple members; a "chat" is a 1:1 conversation with the bot.
- how-to-find-id: Do NOT ask the user for a chat ID. Telegram registration uses pairing — run
pnpm exec tsx setup/index.ts --step pair-telegram -- --intent <main|wire-to:folder|new-agent:folder>, show the user the 4-digitCODEfrom thePAIR_TELEGRAM_ISSUEDblock (follow theREMINDER_TO_ASSISTANTline in that block), and tell them to send just the 4 digits as a message from the chat they want to register (DM the bot formain, post in the group otherwise). In groups with Group Privacy ON, prefix with the bot handle:@<botname> CODE. Wrong guesses invalidate the code — if aPAIR_TELEGRAM_ATTEMPTblock arrives with a mismatchedRECEIVED_CODE, aPAIR_TELEGRAM_NEW_CODEblock will follow automatically (up to 5 regenerations); show the new code. OnPAIR_TELEGRAM STATUS=failed ERROR=max-regenerations-exceeded, ask the user if they want to try again and re-invoke the step — each invocation starts a fresh 5-attempt batch. Success emitsPAIR_TELEGRAM STATUS=successwithPLATFORM_ID,IS_GROUP, andADMIN_USER_ID. The service must be running for this to work (the polling adapter is what observes the code). - supports-threads: no
- typical-use: Interactive chat — direct messages or small groups
- default-isolation: Same agent group if you're the only participant across multiple chats. Separate agent group if different people are in different groups.
04 同仓库更多 Skills
whatsapp-formatting
Format messages for WhatsApp, including mentions that render as real WhatsApp tags. Use when responding in a WhatsApp conversation (platform_id / chatJid ends with @s.whatsapp.net or @g.us).
welcome
Introduce yourself to a newly connected channel. Triggered automatically when a channel is first wired. Send a friendly greeting and brief overview of what you can do.
vercel-cli
Deploy apps to Vercel. Use when asked to deploy, ship, or publish a web application, or manage Vercel projects, domains, and environment variables.
slack-formatting
Format messages for Slack using mrkdwn syntax. Use when responding to Slack channels (folder starts with "slack_" or JID contains slack identifiers).
self-customize
Customize your own agent — add capabilities, install packages, add MCP servers, edit code or CLAUDE.md. Use when the user asks you to add a feature, install a tool, or modify how you work. For non-trivial code changes, delegate to a builder agent via create_agent.
onecli-gateway
OneCLI Gateway: transparent HTTPS proxy that injects stored credentials into outbound calls. You MUST use this skill when the user asks you to read emails, check calendar, access GitHub repos, create issues, check Stripe payments, or interact with ANY external service or API. Do NOT use browser extensions or OAuth CLI tools. Make HTTP requests directly; the gateway injects credentials automatically.