Skills telegram-ops
Telegram Bot API operations for forum management. Use for creating/editing/archiving forum topics, setting topic icons, managing Telegram groups via Bot API. Use when archiving channels/topics. Requires bot token from OpenClaw config.
git clone https://github.com/openclaw/skills
T=$(mktemp -d) && git clone --depth=1 https://github.com/openclaw/skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/brennerspear/telegram-ops" ~/.claude/skills/clawdbot-skills-telegram-ops && rm -rf "$T"
skills/brennerspear/telegram-ops/SKILL.mdTelegram Ops
Manage Telegram forum topics and Bot API operations.
Prerequisites
- Bot must be admin in the group with
permissioncan_manage_topics - Get the bot token from OpenClaw config:
gateway action=config.get | jq -r '.result.parsed.channels.telegram.botToken'
Creating a Topic
When creating a topic, follow all of these steps:
- Create the topic via Telegram Bot API (returns
)message_thread_id - Set the icon -- pick one that matches the topic's purpose (see Icon Reference)
- Choose relevant skills -- run
, pick onlyopenclaw skills list
skills that fit the topic's purposeready - Write a system prompt -- give the agent context for what this topic is about
- Patch the OpenClaw config -- register the topic with its skills and system prompt
Step 1: Create via Bot API
curl -X POST "https://api.telegram.org/bot<TOKEN>/createForumTopic" \ -H "Content-Type: application/json" \ -d '{ "chat_id": <GROUP_ID>, "name": "topic name" }'
Returns
message_thread_id (the topic ID) -- you need this for all subsequent steps.
Step 2: Set the Icon
curl -X POST "https://api.telegram.org/bot<TOKEN>/editForumTopic" \ -H "Content-Type: application/json" \ -d '{ "chat_id": <GROUP_ID>, "message_thread_id": <TOPIC_ID>, "name": "topic name", "icon_custom_emoji_id": "<EMOJI_ID>" }'
Step 3-5: Configure OpenClaw
Patch the config to register the topic with a system prompt:
gateway action=config.patch raw='{"channels":{"telegram":{"groups":{"<GROUP_ID>":{"topics":{"<TOPIC_ID>":{"systemPrompt":"Topic-specific instructions"}}}}}}}'
Topic configs inherit from the parent group -- only specify overrides.
Do NOT add a
key -- omitting it means all skills are available. Only restrict skills if you have a specific reason to limit the topic's capabilities.skills
Session Keys
Each topic gets its own isolated OpenClaw session:
agent:main:telegram:group:<GROUP_ID>:topic:<TOPIC_ID>
Each session has independent conversation history, context window, and compaction.
Topic Icons
| Emoji | ID | Use Case |
|---|---|---|
| ⚡ | | Ops, speed, alerts |
| 💡 | | Ideas, suggestions |
| 📰 | | News, announcements |
| 🔥 | | Hot topics, urgent |
| ❤️ | | Community, love |
| 📝 | | Notes, documentation |
| 🤖 | | Bots, automation |
| 💬 | | Chat, discussion |
| 📊 | | Stats, analytics |
| 🎯 | | Goals, targets |
See
references/emoji-ids.md for complete list.
To fetch all valid icon sticker IDs:
curl -X POST "https://api.telegram.org/bot<TOKEN>/getForumTopicIconStickers"
Archiving a Topic
Archive workflow: rename with
[ARCHIVED] prefix, set folder icon, close topic, then handle the OpenClaw session.
Step 1: Archive in Telegram
Use the archive script:
scripts/archive_topic.sh <TOKEN> <GROUP_ID> <TOPIC_ID> "Current Topic Name"
This will:
- Rename to
[ARCHIVED] Current Topic Name - Set the 📁 folder icon (
)5357315181649076022 - Close the topic (locks it from new messages)
Step 2: Export and Delete OpenClaw Session
# Export session history to the sessions archive folder openclaw sessions history 'agent:main:telegram:group:<GROUP_ID>:topic:<TOPIC_ID>' > ~/.openclaw/agents/main/sessions/archive/<topic-name>-<date>.md # Delete the session (manual - remove from sessions.json and delete transcript) # Session key: agent:main:telegram:group:<GROUP_ID>:topic:<TOPIC_ID>
Step 3: Clean Up Config (Optional)
Remove the topic from OpenClaw config if it had custom settings:
gateway action=config.patch raw='{"channels":{"telegram":{"groups":{"<GROUP_ID>":{"topics":{"<TOPIC_ID>":null}}}}}}'
Limitations
No
method exists. Cannot query topic name by thread ID.getForumTopicInfo
Workarounds:
- Cache names from
eventsforum_topic_created - Store mapping in local config
- Monitor topic creation service messages