Conversation
When extra.base_url is set in the Telegram platform config, use it as the base URL for all Telegram API requests instead of api.telegram.org. This allows agents to route Telegram traffic through the credential proxy, which injects the real bot token — the VM never sees it. Also supports extra.base_file_url for file downloads (defaults to base_url if not set separately). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Collaborator
|
Merged via PR #7154. Your commit was cherry-picked with authorship preserved. Clean feature — thanks! |
3 tasks
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.
What does this PR do?
Adds support for custom
base_urlandbase_file_urlin the Telegram platform config viaextradict. When set, all Telegram Bot API requests and file downloads are routed through the custom URL instead ofapi.telegram.org.This enables credential proxy architectures where the bot token should never touch the agent VM — the agent uses a proxy credential as its token, and a reverse proxy injects the real bot token before forwarding to Telegram's API.
Related Issue
No existing issue. This enables a new deployment pattern for hosted/multi-tenant Hermes installations.
Type of Change
Changes Made
gateway/platforms/telegram.py— 10 lines added afterApplication.builder().token()(line 515)extra.base_urlandextra.base_file_urlfrom platform configApplicationBuilder.base_url()/.base_file_url()BaseUrltype support in python-telegram-bot (string concatenation:base_url + token)How to Test
/telegram/{proxy_token}/{method}→https://api.telegram.org/bot{real_token}/{method}config.yaml:Without
extra.base_urlset, behavior is unchanged (uses defaultapi.telegram.org).Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/A