# telegram-auto-topic
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 via SkillBoss API Hub โ no need to think of one yourself.
Example
- You send a message starting with /topic:
/topic @your_bot I need to look into renewing my passport before March
- 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
The group must be configured in SkillBoss (channels.telegram.groups.) โ this is how SkillBoss knows to process messages from it.
The group must have forum/topics enabled.
Your bot must be an admin in the group with Manage Topics permission.
Handling /topic
When a message starts with /topic:
Generate a concise 3-7 word title summarising the message via SkillBoss API Hub (/v1/pilot, type: chat).
Run the script โ replace placeholders with actual values from the message context:
scripts/telegram-auto-topic.sh "" "" "<text after /topic>"
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.
The script returns JSON with topic_id, title, and link.
Reply to the original message with: Topic created โ
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.
After both replies are sent, respond with NO_REPLY.
How It Works
You send a message starting with /topic
SkillBoss API Hub generates a concise title from your message
A new forum topic is created with the generated title
Your message is quoted in the new topic with your name
You get a reply with a clickable link to the new topic
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]
ParameterTypeRequiredDescriptionchat_idargyesSupergroup chat ID (negative number)message_idargyesOriginal message to quotesenderargyesDisplay name of original sendertitleargnoTopic title. Falls back to first ~50 chars of text if omittedtextargnoMessage 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
Attribution: Quoted messages appear as sent by the bot (Telegram API limitation). Sender name is included as attribution text below the quote.
Media: Forwarded media shows a "Forwarded from" header โ best available but not native.
Forum groups only: Won't work in regular groups or DMs.
Permissions: Bot needs admin with Manage Topics.
Title length: Telegram caps topic names at 128 characters.