feat(telegram): add webhook mode as alternative to polling#3880
Merged
feat(telegram): add webhook mode as alternative to polling#3880
Conversation
When TELEGRAM_WEBHOOK_URL is set, the adapter starts an HTTP webhook server (via python-telegram-bot's start_webhook()) instead of long polling. This enables cloud platforms like Fly.io and Railway to auto-wake suspended machines on inbound HTTP traffic. Polling remains the default — no behavior change unless the env var is set. Env vars: TELEGRAM_WEBHOOK_URL Public HTTPS URL for Telegram to push to TELEGRAM_WEBHOOK_PORT Local listen port (default 8443) TELEGRAM_WEBHOOK_SECRET Secret token for update verification Cherry-picked and adapted from PR #2022 by SHL0MS. Preserved all current main enhancements (network error recovery, polling conflict detection, DM topics setup). Co-authored-by: SHL0MS <SHL0MS@users.noreply.github.com>
itsXactlY
pushed a commit
to itsXactlY/hermes-agent
that referenced
this pull request
Mar 30, 2026
…rch#3880) When TELEGRAM_WEBHOOK_URL is set, the adapter starts an HTTP webhook server (via python-telegram-bot's start_webhook()) instead of long polling. This enables cloud platforms like Fly.io and Railway to auto-wake suspended machines on inbound HTTP traffic. Polling remains the default — no behavior change unless the env var is set. Env vars: TELEGRAM_WEBHOOK_URL Public HTTPS URL for Telegram to push to TELEGRAM_WEBHOOK_PORT Local listen port (default 8443) TELEGRAM_WEBHOOK_SECRET Secret token for update verification Cherry-picked and adapted from PR NousResearch#2022 by SHL0MS. Preserved all current main enhancements (network error recovery, polling conflict detection, DM topics setup). Co-authored-by: SHL0MS <SHL0MS@users.noreply.github.com>
raulbcs
added a commit
to raulbcs/hermes-agent
that referenced
this pull request
Mar 30, 2026
13 tasks
teknium1
pushed a commit
that referenced
this pull request
Mar 31, 2026
Documents the Telegram webhook mode from #3880: - New 'Webhook Mode' section in telegram.md with polling vs webhook comparison, config table, Fly.io deployment example, troubleshooting - Add TELEGRAM_WEBHOOK_URL/PORT/SECRET to environment-variables.md - Add Telegram section to .env.example (existing + webhook vars) Co-authored-by: raulbcs <raulbcs@users.noreply.github.com>
teknium1
added a commit
that referenced
this pull request
Mar 31, 2026
Documents the Telegram webhook mode from #3880: - New 'Webhook Mode' section in telegram.md with polling vs webhook comparison, config table, Fly.io deployment example, troubleshooting - Add TELEGRAM_WEBHOOK_URL/PORT/SECRET to environment-variables.md - Add Telegram section to .env.example (existing + webhook vars) Co-authored-by: raulbcs <raulbcs@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds optional webhook mode to the Telegram adapter. Salvaged from PR #2022 by SHL0MS.
Motivation
Cloud platforms (Fly.io, Railway) auto-wake suspended machines on inbound HTTP, but not on outbound connections. Long polling is outbound, so the machine can never sleep. Webhook mode flips the direction — Telegram pushes updates to the bot's URL, enabling cost-efficient sleep-when-idle deployments.
Usage
Behavior
start_webhook()Integration notes
start_webhook()— no new dependenciesVerification
Closes #2022. Credit to SHL0MS for the feature.