Add Telegram QR onboarding to dashboard
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user