Skip to content

feat(integrations): move Telegram credentials into the hub - #329

Open
plombeer31 wants to merge 1 commit into
feat/integrations-hubfrom
feat/integrations-telegram
Open

feat(integrations): move Telegram credentials into the hub#329
plombeer31 wants to merge 1 commit into
feat/integrations-hubfrom
feat/integrations-telegram

Conversation

@plombeer31

Copy link
Copy Markdown
Collaborator

Stacked on #328 (which is stacked on #327). Base is feat/integrations-hub, so the diff here is just Telegram. Retarget down the stack as each lands.

What

Telegram becomes the hub's second tenant, so an operator setting up a new install has one place to paste every key rather than needing to know which service happens to own a tab.

Scope: the credential only

Pairing, the owner id, start/stop and the live chat view stay on the Telegram tab. Those act on a running channel rather than configuring one, and folding a pairing countdown into a credential list would make both surfaces worse.

The hub owns "what is my token"; the tab owns "what is the bot doing". The hub's summary line points at the tab, so the split is discoverable rather than something the operator has to work out.

Validation at entry

The token is checked against the BotFather shape the scrubber already keys off — <6..12 digits>:<≥30 [A-Za-z0-9_-] chars>. A truncated paste stops being a silent "channel won't start" and becomes an immediate, specific complaint about the paste.

Live status

IntegrationStatusContext gains channelStates alongside mcpServerStates, so three states that used to look identical now read differently:

channel badge detail
(none / disabled) configured token saved — pair and enable on the Telegram tab
up connected channel up
down error channel failed to start — see the Telegram tab

A merely disabled channel is deliberately not an error — that is a normal resting state, and badging it red would train operators to ignore the badge.

Telegram resolves its token at construction, so it declares appliesLive: false and the pane says a restart is needed rather than leaving the operator to guess why nothing happened.

Testing

npm run lint and npm test green (7211 tests). 6 new tests; every existing Telegram test still passes untouched.

Verified end-to-end against a real runtime:

  • hunter2 → refused: "Doesn't look like a bot token — expected digits, a colon, then a long string, as @Botfather issues it." Nothing written.
  • a well-formed token → saved, masked as ••••…+13, badge flips to configured with the "pair and enable" detail
  • it lands in <stateDir>/.env and is visible in process.env for the Telegram tab's own has-token check, without a restart

Telegram becomes the hub's second tenant, so an operator setting up a
new install has one place to paste every key rather than needing to
know which service happens to own a tab.

Only the credential moves. Pairing, the owner id, start/stop and the
live chat view stay on the Telegram tab: those act on a running
channel rather than configuring one, and folding a pairing countdown
into a credential list would make both surfaces worse. The hub owns
"what is my token", the tab owns "what is the bot doing" -- and the
hub's summary line points at the tab so the split is discoverable
rather than something to work out.

The bot token is validated at entry against the BotFather shape the
scrubber already keys off (<6..12 digits>:<>=30 chars>), which turns a
truncated paste from a silent "channel won't start" into an immediate,
specific complaint.

Status is live: `IntegrationStatusContext` gains `channelStates`
alongside `mcpServerStates`, so a saved-but-idle token reads
differently from a running channel and differently again from one that
failed to start. A channel that is merely disabled is reported as
configured, not as an error -- that is a normal resting state.

Telegram resolves its token at construction, so it declares
`appliesLive: false` and the pane says a restart is needed instead of
leaving the operator to guess why nothing happened.

Verified end-to-end: a malformed token is refused with a readable
message and nothing is written; a well-formed one saves, masks, shows
"token saved -- pair and enable on the Telegram tab", lands in
<stateDir>/.env, and is visible in process.env for the Telegram tab's
own has-token check without a restart.
@plombeer31
plombeer31 force-pushed the feat/integrations-telegram branch from de326ec to 3819f04 Compare September 4, 2026 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant