feat: add Telegram bot integration#283
Open
freddycodes23 wants to merge 1 commit intovxcontrol:mainfrom
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an initial Telegram bot implementation intended to let whitelisted Telegram users create/list/manage “flows” via bot commands.
Changes:
- Introduces
pkg/telegrampackage with bot polling loop, authorization, command handling, and message formatting. - Defines a
FlowServiceinterface andFlowDTO to decouple Telegram command handling from backend flow logic. - Adds Markdown-formatted responses for
/start,/help,/flows,/new,/status, and/stop.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 10 comments.
| File | Description |
|---|---|
| pkg/telegram/bot.go | Bot creation, polling loop, authorization check, start/stop lifecycle |
| pkg/telegram/handler.go | Command routing and service calls; message reply helper |
| pkg/telegram/formatter.go | Markdown response formatting for help/welcome/flow outputs |
| pkg/telegram/auth.go | Allowlist-based authorization helper |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Author
|
@copilot apply changes based on the comments in this thread |
396b56a to
8e04b01
Compare
8e04b01 to
63d094a
Compare
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.
Description of the Change
Problem
PentAGI has no mobile-friendly access method. Users must use a browser to access the web UI,
which is cumbersome on mobile devices and requires managing SSL certificate warnings.
The env vars
TELEGRAM_BOT_TOKEN,TELEGRAM_ENABLED,TELEGRAM_ALLOWED_USER_IDSandTELEGRAM_POLLINGexist in the installer but are never consumed by the application binary.Solution
Implements a Telegram bot integration in a new
pkg/telegrampackage that runs as a goroutinealongside the existing HTTP server. Users whitelisted by Telegram user ID can create flows,
check status, and control agents directly from the Telegram mobile app using simple commands.
Closes #
Type of Change
Areas Affected
Testing and Verification
Test Configuration
Test Steps
TELEGRAM_BOT_TOKEN,TELEGRAM_ENABLED=true,TELEGRAM_ALLOWED_USER_IDS,TELEGRAM_POLLING=trueto.envTELEGRAM_*vars to theenvironment:block indocker-compose.ymldocker compose up -d --force-recreate pentagi@Fr22dybot, send/start/helpto verify command list appears/new scan for open portsto verify flow creation/flowsto verify flow appears in list/status <flow_id>to verify status responseTest Results
Telegram bot authorized as @Fr22dybotSecurity Considerations
TELEGRAM_ALLOWED_USER_IDS—all other users are silently ignored and logged
auth.goPerformance Impact
Documentation Updates
Deployment Notes
Four new environment variables must be set to enable the bot. If
TELEGRAM_ENABLEDisfalseor unset, the bot goroutine does not start and there is zero overhead.
These must also be added to the
environment:block indocker-compose.yml:No database migrations required. No breaking changes to existing deployments.
Checklist
Code Quality
go fmtandgo vet(for Go code)npm run lint(for TypeScript/JavaScript code)Security
Compatibility
Documentation
Additional Notes
This PR activates env vars (
TELEGRAM_BOT_TOKENetc.) that the PentAGI installer alreadygenerates but the binary never consumed. The implementation uses the well-maintained
go-telegram-bot-api/telegram-bot-api/v5library. Unit tests will be added in a follow-upPR once the maintainers confirm the interface design aligns with internal service conventions.