Spaces:
Running
Running
File size: 567 Bytes
fc69895 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import { config } from "$lib/server/config";
import { logger } from "$lib/server/logger";
export async function sendSlack(text: string) {
if (!config.WEBHOOK_URL_REPORT_ASSISTANT) {
logger.warn("WEBHOOK_URL_REPORT_ASSISTANT is not set, tried to send a slack message.");
return;
}
const res = await fetch(config.WEBHOOK_URL_REPORT_ASSISTANT, {
method: "POST",
headers: {
"Content-type": "application/json",
},
body: JSON.stringify({
text,
}),
});
if (!res.ok) {
logger.error(`Webhook message failed. ${res.statusText} ${res.text}`);
}
}
|