Telegram Auto Topic
by @itstauq
Add `/topic` to the start of any message in a Telegram forum group to auto-create a new topic from it. A title is generated automatically from the message content. Github: https://github.com/itstauq/telegram-auto-topic
clawhub install telegram-auto-topicπ About This Skill
name: telegram-auto-topic description: > Add
/topic to the start of any message in a Telegram forum group to
auto-create a new topic from it. A title is generated automatically from
the message content.
Github: https://github.com/itstauq/telegram-auto-topic
metadata:
openclaw:
requires:
config:
- ~/.openclaw/openclaw.json
env:
- OPENCLAW_CONFIG
bins:
- curl
- jq
Telegram Auto-Topic
Add /topic to the start of any message in a Telegram forum group β a new topic is created from it. The title is figured out from your message automatically β no need to think of one yourself.
Example
1. You send a message starting with /topic:
> /topic @your_bot I need to look into renewing my passport before March
2. A new forum topic "Passport Renewal Before March" is created with your message quoted inside it. You get a reply linking directly to the new topic.
Prerequisites
channels.telegram.groups.) β this is how OpenClaw knows to process messages from it.Handling /topic
When a message starts with /topic:
1. Generate a concise 3-7 word title summarising the message. 2. Run the script β replace placeholders with actual values from the message context:
scripts/telegram-auto-topic.sh "" "" ""
Pass an empty string for the text arg if there's no text (e.g. media-only).
Use the path relative to this skill's directory.
3. The script returns JSON with topic_id, title, and link.
4. Reply to the original message with: Topic created β
5. Then send a response to the actual message content in the NEW topic (use message tool with threadId from the returned topic_id). Respond naturally as you would to any message.
6. After both replies are sent, respond with NO_REPLY.How It Works
1. You send a message starting with /topic
2. A new forum topic is created β titled from your message automatically
3. Your message is quoted in the new topic with your name
4. You get a reply with a clickable link to the new topic
5. The bot responds to your message in the new topic
Works with media too β photos, videos, or documents with /topic in the caption get forwarded into the new topic.
Script Reference
scripts/telegram-auto-topic.sh [title] [text]
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| chat_id | arg | yes | Supergroup chat ID (negative number) |
| message_id | arg | yes | Original message to quote |
| sender | arg | yes | Display name of original sender |
| title | arg | no | Topic title. Falls back to first ~50 chars of text if omitted |
| text | arg | no | Message body after /topic. If empty, forwards as media |
Returns JSON: {"topic_id": 123, "title": "Used title", "link": "https://t.me/c/..."}
Optional configuration
Skip the @bot mention β by default, the bot only responds when mentioned. To use /topic without mentioning the bot:
"channels.telegram.groups.": {
"requireMention": false
}
Telegram autocomplete β to get /topic in Telegram's command menu, add under channels.telegram:
{
"customCommands": [
{
"command": "topic",
"description": "Create a new forum topic from a message"
}
]
}
Limitations
π‘ Examples
1. You send a message starting with /topic:
> /topic @your_bot I need to look into renewing my passport before March
2. A new forum topic "Passport Renewal Before March" is created with your message quoted inside it. You get a reply linking directly to the new topic.
βοΈ Configuration
channels.telegram.groups.) β this is how OpenClaw knows to process messages from it.