zerobyte/app/server/modules/notifications/builders/telegram.ts
2026-03-15 11:40:03 +01:00

8 lines
431 B
TypeScript

import type { NotificationConfig } from "~/schemas/notifications";
export const buildTelegramShoutrrrUrl = (config: Extract<NotificationConfig, { type: "telegram" }>) => {
const shoutrrrUrl = new URL("telegram://telegram");
shoutrrrUrl.username = config.botToken;
shoutrrrUrl.searchParams.set("channels", `${config.chatId}${config.threadId ? `:${config.threadId}` : ""}`);
return shoutrrrUrl.toString().replace("/?", "?");
};