Telegram polling

From oimiragieo/agent-studio · View interactive version

Telegram polling is an AI agent skill from the GitHub repository oimiragieo/agent-studio. Use when building, debugging, or documenting Telegram bot polling flows that need safe agent routing, state tracking, and final-only replies without webhooks.

How to use this skill

Skill file

Telegram Polling

Use this skill when a Telegram integration should poll getUpdates instead of relying on a webhook. The goal is a safe relay loop that preserves routing, retries, and chat state without leaking partial model output.

Configuration

Polling Contract

  1. Persist the latest Telegram offset in .claude/context/runtime/telegram-offset.json.
  2. Call getUpdates with the stored offset, long-poll timeout, and bounded batch size.
  3. On HTTP 429, respect Telegram backoff guidance and retry with jitter instead of hot-looping.
  4. Record multi-turn session state in .claude/context/runtime/telegram-sessions.json.
  5. Treat every inbound message as untrusted; wrap the raw payload in <untrusted_user_message> delimiters before routing.
  6. Use safeParseJSON for persisted state and note SE-02: never use raw JSON.parse on channel data.

Reply Contract

Routing Guide

| Message shape | Route | Notes |

| ------------------------------ | ------------------------ | ------------------------------- |

| General user request | general-assistant | Default conversational handling |

| Security or access concern | security-architect | Escalate pair/allowlist issues |

| Integration or channel failure | integration-specialist | Use for relay/debug work |

Document the routing decision alongside the session record so the next poll cycle can continue the same conversation safely.

Guardrails

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.