All nodes/Integrations/Telegram

Telegram Moderate

Chat moderation: delete messages, ban/unban, mute/unmute, grant or revoke admin rights, pin/unpin. The bot must be an administrator holding the matching right (can_delete_messages / can_restrict_members / can_pin_messages). Own messages can only be deleted under 48 hours old; delete_messages is sent in batches of 100. Supports dry_run. Requires a Telegram Config.

Telegram Moderate
Telegram ConfigSuccess
Error

Type in the graph: telegram_moderate

Exec

An error branch can be enabled (expose_error_output) to handle failures on their own path.

Try it

Minimal working workflow

Entry
Telegram Moderate
Exit
  • Execute
  • Execute + Data
Press “Copy nodes”, open the editor and hit Ctrl+V on the canvas.

Runs as pasted

When to use it

This node acts on people and messages: delete, ban, mute, grant or revoke admin rights, pin and unpin. Settings of the chat itself — title, invites, read-only mode — live in the sibling node Manage Chat. When the decision belongs to a model rather than the graph, use Telegram Tools, which exposes the same actions behind an explicit allowlist.

How it works

The bot must be an administrator holding the matching right: can_delete_messages, can_restrict_members, can_pin_messages. Chat Info can check that in advance with its bot-rights action.

Every real action writes an audit record, and deleted messages are marked in the recorded group history, so Group History stops returning them.

Common mistakes

  • 48 hours for the bot’s own messages. The bot can delete its own message only while it is under two days old; anyone else’s needs can_delete_messages.
  • affected on a bulk delete counts ids submitted, not messages removed. Ids go out in batches of 100 and Telegram skips the too-old ones silently, without an error.
  • A bulk delete fails on the first refusal. How much went through beforehand is unknowable, so the node stops and affected is not reported on that path.
  • Duration 0 means forever. And Telegram also reads any positive value under about 30 seconds as forever, so the platform raises it to 31 seconds — otherwise “mute for 10 seconds” would become a permanent mute.
  • Muting works in supergroups only. Telegram does not let a bot restrict a member of a plain group.
  • Granting admin rights is deliberately bounded. The right to promote further admins (can_promote_members) is never granted, so a bot cannot mint administrators.
  • Dry run does not check rights. It returns the plan without calling Telegram, so a green dry run proves nothing.
  • A refusal stops the node rather than arriving as a success: false field. Turn on the error output when a refusal should be handled by a branch.
  • Unpin with a blank Message ID unpins the most recently pinned message.

Inputs

PortWirePayloadNotes
Telegram Configtelegram_configDatadata

shown when connection_source ≠ "auto"

Outputs

PortWirePayloadNotes
SuccessoutputExecute + Dataexecute_dataobject
Erroron_errorExecute + Dataexecute_data

shown when expose_error_output = true

Configuration

FieldTypeDefaultDescription
Connection sourceconnection_sourcestringauto

Where this node gets its connection. 'From the run context' uses what the platform already knows (the Telegram bot this workflow is deployed to / this workspace's own file store) and needs no wiring. 'External connection' shows the resource port so a config node can be wired into it.

Options: auto — From the run context, external — External connection (wire a config node)

Actionactionstringunpin

Requires the bot to be an administrator. delete_message/delete_messages — deletion (own messages only under 48 hours old; other people's only with can_delete_messages); ban/unban — bans; restrict/unrestrict — mute/unmute; promote/demote — admin rights; pin/unpin/unpin_all — pinned messages.

Options: delete_message — Delete one message, delete_messages — Delete many messages, ban — Ban a member, unban — Unban a member, restrict — Mute a member, unrestrict — Unmute a member, promote — Grant admin rights, demote — Revoke admin rights, pin — Pin a message, unpin — Unpin a message, unpin_all — Unpin every message

Chat IDchat_idstring""

Numeric Telegram chat_id (an @username is not accepted here). Blank = the chat of the running Telegram turn. Templates are supported.

supports templates

Silentdisable_notificationbooleanfalse

Pin without notifying the members.

shown when action = pin

Dry rundry_runbooleanfalse

Do not call Telegram — only report what would have been done. The safe way to debug a moderation branch.

Duration (seconds)duration_secondsinteger0

How long the ban/mute lasts. 0 = forever. Telegram treats anything under 30 seconds or over 366 days as forever.

shown when action = ban | restrict

Message IDmessage_idstring""

Numeric id of the message to act on. Templates are supported, e.g. {{ nodes.send_message_1.message_id }}. Required for delete_message and pin; for unpin it is optional — blank unpins the most recently pinned message.

supports templates

shown when action = delete_message | pin | unpin

Message IDsmessage_idsstring""

Comma-separated ids or a JSON array. Sent in batches of 100 (the Bot API limit); ids older than 48 hours are silently skipped by Telegram.

supports templates

shown when action = delete_messages

Delete their messagesrevoke_messagesbooleanfalse

When banning, also delete every message the user posted in the chat.

shown when action = ban

User IDuser_idstring""

Numeric Telegram user_id. Templates are supported.

supports templates

shown when action = ban | unban | restrict | unrestrict | promote | demote

Shared fields

Every node has these three — the platform adds them, not the node author.

  • expose_error_output — When enabled, show an execution output to connect nodes that run if this step fails.