Skip to main content

Admission and routing

Admission and inherited access​

Routing is scoped to a bot connection. Displayed room names are descriptive metadata, not identities or security boundaries.

  • Telegram DMs retain per-chat admission. For a group or supergroup, a request received in the root or any forum topic creates one pending root-group admission for that connection. Approving it admits the root and every topic, while each topic still has its own Core session and bounded room history. Existing explicit topic mappings remain authoritative overrides.
  • Discord DMs retain per-DM admission. Guild access is authorized separately from observed-guild metadata. After an operator approves a server, visible channels and threads need no individual admission; Switchboard creates inherited routes as traffic or a supported command is observed. Channel and thread sessions/history remain isolated, and Discord permissions still determine what the bot can see and send.
  • Existing explicit Discord channel/thread mappings and legacy DM admissions remain supported. An explicit mapping, including a disabled one, takes precedence over inherited server access.

A nonempty text message or image from an unknown Telegram DM/group, or a text/image message from a Discord DM/channel/thread can create or refresh a pending route entry when no inherited access applies. No Core turn is submitted. Pending admissions are bounded to 100 entries and are not a permanent request archive. Discord guild observation is separate: an observed but unauthorized guild appears as a pending server, not as proof that every channel is reachable.

Approve requires an existing enabled agent. An empty approval body ({}) uses the connection's assigned goblin; Telegram records this as inheritance, while a Discord legacy room approval remains an independent room access grant; both transports follow the connection's default responder when agentId is omitted. Supplying agentId makes an explicit room choice. If the connection has no assignment, {} cannot approve a route. The triggering message is not replayed, so send a new message after approval.

Deny removes the current request. It is not a permanent ban; later eligible input from an unknown route can create another request.

Approved routing rules​

RouteInput forwarded
Telegram direct chatEvery approved nonempty text message or photo/image-document (with or without caption); group recipient selection does not apply
Telegram approved group root or inherited forum topicHuman text or image with no known managed-bot target goes to every admitted managed bot that received it; known bot targets select only those bots
Discord DMApproved human text or supported image attachments, including image-only messages; no mention required
Discord authorized-server channel/thread or explicit guild mappingHuman text or supported images mentioning that bot or replying to its message
Disabled explicit mappingNothing; it does not fall through to inherited access or return to pending admissions

Telegram group recipient selection​

For approved non-direct routes, Switchboard derives recipients from valid Telegram entities and reply metadata:

  1. Explicit mention, text_mention, or addressed bot_command entities that identify connected Telegram bots select only those bot connections. Explicit targets take precedence over reply threading. Multiple connected bots can be selected.
  2. With no recognized explicit bot target, a reply to a known connected bot selects that bot.
  3. Mentions of humans, unknown bots, or malformed/nonmatching names do not select recipients. They remain ordinary group speech, so all admitted managed bots that receive the update can run.
  4. With no known bot target, ordinary human group speech goes to all admitted managed bots that receive it.
  5. Bot-authored messages never start agent turns (Telegram messages carrying sender_chat represent a speaking chat instead of the synthetic bot sender). On an approved room they are context only, preventing bot-to-bot wake loops.

A selected bot's first matching username mention (not text_mention or command) is removed from its submitted display text; the remainder must be nonempty for a text-only request. For an image, an empty caption is represented as [Image attached]. Caption entities use the same selection rules and UTF-16 offsets as text entities. A visually similar @name without a matching entity does not select a bot. Telegram's delivery/privacy rules are a prerequisite: Switchboard cannot route an update Telegram never delivered. See Telegram setup.

For Telegram, update.message supports text, photos and image documents. The highest-resolution photo within the hosted Bot API 20 MiB download limit is selected; a smaller advertised variant may be used if the highest exceeds that limit. Documents must be PNG, JPEG, GIF or WebP; images are identified by downloaded bytes. A declared image MIME must match those bytes; a missing MIME or application/octet-stream is allowed only when the bytes have a supported image signature. Other declared MIME types are rejected. Captions and caption_entities participate in recipient selection; an image without a caption is a valid turn. Download occurs only after admission, enabled mapping and recipient checks. Unsupported documents, unrecognized/mismatched image signatures, oversized files and failed downloads are recorded as failed deliveries rather than forwarding a caption without the image. Each delivered Telegram update is a separate turn (including album items). Other media, edited-message updates and channel-post updates are not supported. Switchboard handles its native commands separately from turn routing. Other addressed commands can still be routed like ordinary bot-targeted text.

Discord handles MESSAGE_CREATE text and image attachments via Gateway. Bot/webhook senders cannot create admissions or trigger turns; on approved guild routes their text may contribute context. Human guild text without a mention/reply is context only. Image attachments and image-only messages become turns after the same admission and mention/reply checks. A mention-only caption with images uses [Image attached]; DMs need no mention. Up to four PNG/JPEG/GIF/WebP images / 20 MiB aggregate are downloaded anonymously only from exact Discord CDN attachment hosts after routing. Redirects, unsupported or mismatched MIME/signatures and oversize fail the whole input rather than forwarding its caption alone. Frozen bytes replay without downloading signed URLs again. Native Discord slash commands are documented separately in Discord setup.

Messages receive a short transport-specific sender/room prefix before Core submission. This is conversational context, not verified authorization for actions described in the text.

Sessions, assignment and overrides​

The migrated default connection keeps session ID telegram:<chatId>:<topicId-or-root>. New Telegram connections use telegram:<connectionId>:<chatId>:<topicId-or-root>. A Telegram root-group approval therefore authorizes every topic but does not merge them: root and each topic retain isolated sessions and room history.

Discord initially uses discord:<connectionId>:<channelId> for each DM, channel or thread. On both transports, /new creates an owner-bound Core session for that bot and route, preserving old sessions but suppressing late replies and pre-reset context. /model changes the selection for that owned session. Changing agents clears owned-session bindings; routes then use their original deterministic session IDs for the newly assigned agent until /new. Server authorization removes the channel-admission step, not channel isolation. A thread remains separate from its parent and sibling threads.

Each connection has a nullable default responder (Who answers new chats in the selected bot editor). New connections default to unassigned when agentId is omitted or null. Configuration updates that omit agentId preserve the current assignment; an explicit null clears it. Approvals made with {} follow later assignment changes. Editing a room mapping with an explicit agent selects a custom responder; agentId: null restores the default responder without changing where it is authorized. Discord generated server routes follow assignment changes unless given a custom responder, and always retain their server-grant dependency. Independently approved rooms remain independently authorized, whether their responder is explicit or default-following. Assignment changes interrupt outstanding inherited work and do not silently rewrite explicit overrides.

In the selected bot's chat Change editor (or Topic exceptions / Channel and thread exceptions), selecting an enabled goblin saves immediately and redirects subsequent messages for that explicit route. Failed changes remain visible and retryable; there is no normal Save chat action. The route-derived session ID does not change merely because the agent changes; Core owns session/history behavior. Disabling an explicit override blocks that room even if its group/server would otherwise provide inherited access.

Deleting a Telegram root mapping removes inherited access while retaining explicit topic overrides. Deleting a Discord inherited route does not revoke its approved server; revoke or pause server access to stop inheritance instead of relying on generated-route deletion. Deletion interrupts outstanding replies for the affected inherited route(s), but does not recall provider messages or cancel Core work already submitted.

Limits and duplicate handling​

Per connection, there are at most 250 stored mappings, 100 pending admissions and 200 recent delivery records (inbound and outbound together). Discord stores at most 250 authorized servers and 250 observed guilds. Telegram delivery entries can evict older entries except an unresolved frozen submission; if no entry can be removed, telegram_backlog_full stops ingestion until the backlog is resolved. Discord protects unresolved/unknown deliveries from eviction and reports discord_backlog_full if its 200-record ledger or 32,000,000-byte bound cannot admit work. These bounded settings collections are not an unlimited queue or audit ledger.

The default connection preserves Core idempotency key telegram-update-<update_id>; new connections use telegram-<connectionId>-update-<update_id>. Discord uses discord-<connectionId>-message-<messageId>. Gateway resume/heartbeat, Telegram offsets and durable delivery state reduce duplicates but do not provide unconditional exactly-once messaging. See operations.

Shared group and channel conversation context​

Enabled Telegram group routes in the same chat and topic share a bounded conversation record across managed bot connections. Root authorization does not merge topic records. Switchboard records delivered human text or image captions (or a descriptive marker when captionless) before recipient selection, records bot-authored messages as passive context, and adds successfully posted agent reply chunks with bot, connection and agent attribution.

Visibility is not a trigger. Telegram's known-target rules above decide recipients; bot messages remain context only. Discord turns still require a human mention/reply to that bot. Two bots selected simultaneously can answer concurrently, and neither is promised visibility of an answer not yet posted when its turn was submitted. Wait for one answer before asking another to react.

Quoted replies include original speaker, message ID and available original text or caption, plus any selected quote excerpt. Context is labeled as quoted conversation data, not new operator instructions.

Telegram shared history is persisted in mod settings, deduplicated by message ID and ordered by that ID. Limits are 100 recently active rooms, 50 messages per room, 4,000 UTF-16 units per message without splitting surrogate pairs, 512,000 serialized UTF-8 bytes overall, and 16,000 UTF-8 bytes of room-history JSON per submission. The current message is separate and later messages are not added retroactively.

Only approved, enabled routes contribute inbound history. Disabling/deleting access stops new input through it but does not erase retained room history or Core session history. Direct chats, different chat IDs and different topic IDs never share that record. Messages Telegram did not deliver cannot be recovered.

Discord independently persists bounded history per guild+channel across approved bots; a thread ID is its own room. DMs are connection-isolated. On authorized or explicitly approved guild routes, human text and observed bot/webhook text can be context while only a human mention/reply starts a turn. Discord uses the same 100-room, 50-message, 4,000-UTF-16-unit, 512,000-byte total and 16,000-byte submission-context limits.

Only text/markers are shared in room history, not image bytes or file URLs. The complete submission, including the downloaded image bytes and caption, is frozen in private settings before Core submission so an uncertain submission can replay the same input after restart even if room history changes. These pending inputs are internal state and omitted from public delivery diagnostics. The 200-record connection limit still bounds recovery.

When a route's agent is deleted​

The 2026.11.26 Development mod requires Core 2026.11.26.2 or later. When an identity is deleted, Switchboard removes its Telegram and Discord routes and clears a connection's saved default target if it points to that identity. Other routes and the connection itself are preserved. Verify or reassign affected routing in Settings; hiding or disabling the agent does not trigger deletion cleanup.