INNER CODE UNIT · TypeScript
syncConnectionsFromBackend
Beever-AI/beever-atlas · bot/src/index.ts:608
async function syncConnectionsFromBackend(chatManager: ChatManager, label: string): Promise<boolean> {
const BRIDGE_API_KEY = process.env.BRIDGE_API_KEY || "";
const headers: Record<string, string> = {};
if (BRIDGE_API_KEY) {
headers["Authorization"] = `Bearer ${BRIDGE_API_KEY}`;
}
const response = await fetch(`${BACKEND_URL}/api/internal/connections/credentials`, { headers });
if (!response.ok) {
throw new Error(`Backend returned ${response.status}`);
}
const connections = await response.json() as Array<{
connection_id?: string;
platform: string;
credentials: Record<string, string>;
status: string;
// Mongo-persisted AAD group ids for Teams connections; empty for other