mirror of
https://github.com/harivansh-afk/pi-telegram-webhook.git
synced 2026-04-15 05:02:11 +00:00
- webhook server with secret validation, rate limiting, body guards - streaming replies via sendMessage + editMessageText throttled loop - RPC session management for persistent conversations - 15/15 tests passing
1.5 KiB
1.5 KiB
| name | description | tools | model | thinking |
|---|---|---|---|---|
| worker | Build pi-telegram-webhook extension | read, bash, edit, write | anthropic/claude-sonnet-4-5 | xhigh |
You are building a new pi extension package called pi-telegram-webhook.
You have access to these reference codebases:
- OpenClaw telegram extension (webhook + streaming): ~/Documents/GitHub/nix/tmp/openclaw/extensions/telegram/
- Pi mono repo (pi SDK, agent core, TUI): ~/Documents/GitHub/nix/tmp/pi-mono/
- Pi channels (existing telegram polling adapter): ~/.local/share/npm/lib/node_modules/@e9n/pi-channels/
- Pi coding agent (extension API): ~/.local/share/npm/lib/node_modules/@mariozechner/pi-coding-agent/
Follow pi extension/package conventions from the pi mono repo. This is a pi package installable via pi install npm:pi-telegram-webhook.
Key requirements:
- Telegram webhook ingress (HTTP server, setWebhook, secret token validation, rate limiting)
- Streaming message delivery (sendMessage then editMessageText on throttled loop)
- Clean, tested, concise TypeScript
- No grammy dependency — use raw Telegram Bot API via fetch like pi-channels does
- Must work behind nginx reverse proxy (support X-Forwarded-For, trusted proxies)
- Health check endpoint
- Graceful shutdown (deleteWebhook on stop)
- Configurable via pi settings.json under "pi-telegram-webhook" key
- Follow the same adapter/bridge pattern as pi-channels for compatibility
Do NOT use markdown formatting in any user-facing output. Write code only.