import { getTelegramSettings } from "./integration-settings"; export async function sendTelegram(chatId: string, text: string): Promise { const { botToken } = await getTelegramSettings(); if (!botToken) throw new Error("TELEGRAM_BOT_TOKEN fehlt"); const res = await fetch(`https://api.telegram.org/bot${botToken}/sendMessage`, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ chat_id: chatId, text }), }); if (!res.ok) throw new Error(`Telegram ${res.status}`); }