Update webhooks

This commit is contained in:
Stefan080106
2023-11-18 12:26:17 +01:00
parent 7c7186657e
commit fccbf89399

View File

@@ -34,9 +34,15 @@ const credentials = {
cert: certificate, cert: certificate,
}; };
const callWebhooks = () => {
config?.triggerWebhooks?.forEach((webhook) => {
axios.get(webhook);
});
}
let bot = null; let bot = null;
const messageIDs = [1034133487, 6745312374]; const messageIDs = config.telegrammessageIDs || [];
function sendMessage(msg, idList) { function sendMessage(msg, idList) {
idList.forEach((id) => { idList.forEach((id) => {
@@ -44,6 +50,7 @@ function sendMessage(msg, idList) {
}); });
} }
if (config.activate_telegram) { if (config.activate_telegram) {
const token = "6150769224:AAGhBagPEi23QtBJl65YNuwEBBXwHguDV0E"; const token = "6150769224:AAGhBagPEi23QtBJl65YNuwEBBXwHguDV0E";
@@ -145,8 +152,9 @@ async function main(data) {
if (config.activate_telegram) { if (config.activate_telegram) {
sendMessage("[INFO]: Einsatdepesche wird Gedruckt - " + data.title, messageIDs); sendMessage("[INFO]: Einsatdepesche wird Gedruckt - " + data.title, messageIDs);
} }
axios.get("https://maker.ifttt.com/trigger/Einsatz/with/key/f4QUHDvvWTG9dOdTyBDDRMc2jxUCM-AUPpm7TkyKwQ_")
axios.get("https://maker.ifttt.com/trigger/Alarm/with/key/mDrKtS60Xz-BNP_XfBLFH5hZU_vGiBW6KlPSe6iP61f") callWebhooks();
const filePath = cacheFolder + data.foreign_id + ".pdf"; const filePath = cacheFolder + data.foreign_id + ".pdf";
await createPDF({ filePath, ...data }); await createPDF({ filePath, ...data });
console.log("PDF created, printing now"); console.log("PDF created, printing now");