Flow Preview
Overview
Monitor Telegram group messages, classify moderation risk with AI, and warn, delete, mute, or ban users through the Telegram module.
Who It's For
The user runs a Telegram group or supergroup and wants a starter moderation bot that can evaluate messages, warn members, and apply basic enforcement actions.
Setup Requirements
- Should the bot only observe, delete and warn, or auto-enforce mutes and bans?
- Which content should be moderated: spam links, scams, abuse, adult content, off-topic posts, or custom rules?
- Should admins be exempt from moderation actions?
- Add the Telegram bot to the target group or supergroup.
- Promote the bot to administrator and grant delete messages plus ban/restrict members permissions if enforcement is enabled.
- If the bot should inspect every message, disable privacy mode for the bot in BotFather.
- Review the moderation policy variable and AI prompt before running in an active community.
- Start in observe-only mode for a test period, then switch to delete-and-warn or auto-enforce after checking false positives.
Node Breakdown
- Telegram group/supergroup MESSAGE trigger receives a group message
- The trigger maps runtime contact context to the sender while preserving chat_id for group enforcement
- The bot checks its Telegram member permissions in the chat
- AI_ACTION returns exactly one action token: allow, warn, delete, mute, or ban
- Condition blocks route to the matching Telegram module action
- The bot uses send-message for warnings, delete-message for cleanup, restrict-chat-member for mutes, and ban-chat-member for severe enforcement
Details
Good to know
- Use trigger type MESSAGE with config.source.platform="telegram" and config.source.chatTypes=["group", "supergroup"].
- For moderation, map the contact/session to identities.sender.* so contact-scoped variables represent the user who sent the message.
- Keep chat_id, message_id, and sender_user_id as trigger output variables because Telegram enforcement actions need them.
- To process every group message, use config.source.visibility="all" and disable Telegram BotFather privacy mode for the bot.
- The bot must be an administrator in the target group with delete and restrict/ban permissions before enforcement actions will work.
- This template is a starter. A production v2 should add an atomic strike ledger keyed by chat_id and sender_user_id before escalating repeated violations.
Keep in mind
- Do not use TELEGRAM_CHANNEL_POST, TELEGRAM_CHAT_MEMBER, CHAT_MEMBER, STARTING_STEP, or MESSAGE_LISTENER as trigger.type.
- Do not claim the bot can read every group message unless BotFather privacy mode is disabled.
- Do not claim enforcement will work unless the bot is a group administrator with the needed permissions.
- Do not store strike counts only in group-scoped variables if repeated-user escalation is required.
- Do not auto-ban from ambiguous AI output; the classifier must return one exact action token.
