Add Telegram QR onboarding to dashboard

This commit is contained in:
Shannon Sands
2026-06-04 16:55:27 -07:00
committed by Teknium
parent 5300727a08
commit 2f0c8e90e6
7 changed files with 1156 additions and 75 deletions
+54
View File
@@ -589,6 +589,36 @@ export const api = {
`/api/messaging/platforms/${encodeURIComponent(id)}/test`,
{ method: "POST" },
),
startTelegramOnboarding: (body: { bot_name?: string }) =>
fetchJSON<TelegramOnboardingStartResponse>(
"/api/messaging/telegram/onboarding/start",
{
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(body),
},
),
getTelegramOnboardingStatus: (pairingId: string) =>
fetchJSON<TelegramOnboardingStatusResponse>(
`/api/messaging/telegram/onboarding/${encodeURIComponent(pairingId)}`,
),
applyTelegramOnboarding: (
pairingId: string,
body: { allowed_user_ids: string[] },
) =>
fetchJSON<TelegramOnboardingApplyResponse>(
`/api/messaging/telegram/onboarding/${encodeURIComponent(pairingId)}/apply`,
{
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(body),
},
),
cancelTelegramOnboarding: (pairingId: string) =>
fetchJSON<{ ok: boolean }>(
`/api/messaging/telegram/onboarding/${encodeURIComponent(pairingId)}`,
{ method: "DELETE" },
),
// Gateway / update actions
restartGateway: () =>
@@ -1293,6 +1323,30 @@ export interface EnvVarInfo {
channel_managed?: boolean;
}
export interface TelegramOnboardingStartResponse {
pairing_id: string;
suggested_username: string;
deep_link: string;
qr_payload: string;
expires_at: string;
}
export type TelegramOnboardingStatusResponse =
| { status: "waiting"; expires_at: string }
| {
status: "ready";
bot_username: string;
owner_user_id?: string;
expires_at: string;
};
export interface TelegramOnboardingApplyResponse {
ok: boolean;
platform: "telegram";
bot_username?: string;
needs_restart: true;
}
export interface SessionMessage {
role: "user" | "assistant" | "system" | "tool";
content: string | null;