[GH-ISSUE #6235] [Feature]: Add built in support chatbot integration #4231

Open
opened 2026-10-31 20:38:09 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @LORD07Sson on GitHub (Aug 17, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6235

X-UI currently does not have a built in support chat system. It would be useful to have an integrated chatbot that allows users to contact the administrator/support directly, without needing to manually find and contact the administrator through another service.
For example, a user could open the support bot, send a message or describe their problem, and the message would be forwarded to the administrator. The administrator could then reply to the user through the bot

Describe the solution you'd like

Add a built in support chatbot to X-UI, for example through Telegram. The bot should primarily work as a support chat between users and the administrator

Alternatives you've considered

For your consideration

Concrete use case

For example, I manage a server with many users who connect through x-ui. When a user has a problem with their connection, subscription or configuration, they currently have to contact the administrator through a separate messenger

Mockups, screenshots, or examples

No response

Which parts of the panel would this affect?

Telegram bot, Backend (API endpoints, login, settings)

Are you willing to help?

  • I'd like to implement this feature myself and open a PR.
  • I can help test once a PR is open.

Before submitting

  • I searched existing issues and this feature has not been requested.
  • This feature request is written in English.
Originally created by @LORD07Sson on GitHub (Aug 17, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6235 ### Is your feature request related to a problem? X-UI currently does not have a built in support chat system. It would be useful to have an integrated chatbot that allows users to contact the administrator/support directly, without needing to manually find and contact the administrator through another service. For example, a user could open the support bot, send a message or describe their problem, and the message would be forwarded to the administrator. The administrator could then reply to the user through the bot ### Describe the solution you'd like Add a built in support chatbot to X-UI, for example through Telegram. The bot should primarily work as a support chat between users and the administrator ### Alternatives you've considered For your consideration ### Concrete use case For example, I manage a server with many users who connect through x-ui. When a user has a problem with their connection, subscription or configuration, they currently have to contact the administrator through a separate messenger ### Mockups, screenshots, or examples _No response_ ### Which parts of the panel would this affect? Telegram bot, Backend (API endpoints, login, settings) ### Are you willing to help? - [ ] I'd like to implement this feature myself and open a PR. - [ ] I can help test once a PR is open. ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this feature has not been requested. - [x] This feature request is written in English.
Author
Owner

@github-actions[bot] commented on GitHub (Aug 17, 2026):

There is no built-in support-chat relay in the panel today, so this is a valid feature request rather than something already available under a different name. I checked the Telegram bot code and confirmed what exists and what is missing.

What the bot already does for non-admin users:

  • Users linked by Telegram ID (the client's tgId field, internal/database/model/model.go:923) get a reduced inline keyboard built in internal/web/service/tgbot/tgbot_send.go:57 — own traffic usage, /usage and /id help, subscription links, individual links, and QR codes.
  • internal/web/service/inbound_traffic.go:948 (GetClientTrafficTgBot) already resolves a Telegram user ID to that user's clients, so the identity plumbing your idea needs is in place.
  • Documented at operations/telegram-bot.

What is missing for a support chat:

  • Free-form text from a user goes nowhere. In internal/web/service/tgbot/tgbot_router.go:144-166, a plain message is only acted on when a multi-step wizard state is active or when it carries a shared-user payload; anything else is silently dropped with no reply.
  • Callbacks are default-deny for non-admins: isClientSelfCallback (internal/web/service/tgbot/tgbot_router.go:1483) allowlists exactly five client actions, and everything else returns early at line 1077.
  • The pieces for the user-to-admin direction do exist — SendMsgToTgbotAdmins (internal/web/service/tgbot/tgbot_send.go:161) fans a message out to every configured admin ID, and userStateMgr is the existing pattern for holding conversation state.

The admin-to-user direction is the harder half, and worth flagging for whoever picks this up: replying to a specific user requires persisting a mapping from an admin-side message to the originating chat, and nothing in the schema stores that today, so it would need a new model plus a migration in internal/database/db.go. Two further constraints: the bot has no per-user rate limiting, so an open relay is reachable by any Telegram account that finds the bot unless it is restricted to users with a linked tgId; and any new user-facing string has to be added to all 13 locale files in internal/web/translation/.

As a partial workaround right now, the subSupportUrl setting (Subscription settings) is served both on the subscription info page and as the Support-Url header (internal/sub/controller.go:822), which several clients render as a support button. Pointing it at your Telegram account gives users a one-tap route to you without leaving their client app.

I am not able to say whether or when this gets implemented — that is the maintainers' call. You left both help checkboxes unchecked; if you or anyone else wants to attempt it, the file list above is the surface area involved.

This reply was generated automatically. A maintainer may follow up.

<!-- gh-comment-id:5311924605 --> @github-actions[bot] commented on GitHub (Aug 17, 2026): There is no built-in support-chat relay in the panel today, so this is a valid feature request rather than something already available under a different name. I checked the Telegram bot code and confirmed what exists and what is missing. What the bot already does for non-admin users: - Users linked by Telegram ID (the client's `tgId` field, `internal/database/model/model.go:923`) get a reduced inline keyboard built in `internal/web/service/tgbot/tgbot_send.go:57` — own traffic usage, `/usage` and `/id` help, subscription links, individual links, and QR codes. - `internal/web/service/inbound_traffic.go:948` (`GetClientTrafficTgBot`) already resolves a Telegram user ID to that user's clients, so the identity plumbing your idea needs is in place. - Documented at [operations/telegram-bot](https://github.com/MHSanaei/3x-ui/blob/main/docs/content/docs/en/operations/telegram-bot.mdx). What is missing for a support chat: - Free-form text from a user goes nowhere. In `internal/web/service/tgbot/tgbot_router.go:144-166`, a plain message is only acted on when a multi-step wizard state is active or when it carries a shared-user payload; anything else is silently dropped with no reply. - Callbacks are default-deny for non-admins: `isClientSelfCallback` (`internal/web/service/tgbot/tgbot_router.go:1483`) allowlists exactly five client actions, and everything else returns early at line 1077. - The pieces for the user-to-admin direction do exist — `SendMsgToTgbotAdmins` (`internal/web/service/tgbot/tgbot_send.go:161`) fans a message out to every configured admin ID, and `userStateMgr` is the existing pattern for holding conversation state. The admin-to-user direction is the harder half, and worth flagging for whoever picks this up: replying to a specific user requires persisting a mapping from an admin-side message to the originating chat, and nothing in the schema stores that today, so it would need a new model plus a migration in `internal/database/db.go`. Two further constraints: the bot has no per-user rate limiting, so an open relay is reachable by any Telegram account that finds the bot unless it is restricted to users with a linked `tgId`; and any new user-facing string has to be added to all 13 locale files in `internal/web/translation/`. As a partial workaround right now, the `subSupportUrl` setting (Subscription settings) is served both on the subscription info page and as the `Support-Url` header (`internal/sub/controller.go:822`), which several clients render as a support button. Pointing it at your Telegram account gives users a one-tap route to you without leaving their client app. I am not able to say whether or when this gets implemented — that is the maintainers' call. You left both help checkboxes unchecked; if you or anyone else wants to attempt it, the file list above is the surface area involved. *This reply was generated automatically. A maintainer may follow up.*
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#4231
No description provided.