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,
};
const callWebhooks = () => {
config?.triggerWebhooks?.forEach((webhook) => {
axios.get(webhook);
});
}
let bot = null;
const messageIDs = [1034133487, 6745312374];
const messageIDs = config.telegrammessageIDs || [];
function sendMessage(msg, idList) {
idList.forEach((id) => {
@@ -44,6 +50,7 @@ function sendMessage(msg, idList) {
});
}
if (config.activate_telegram) {
const token = "6150769224:AAGhBagPEi23QtBJl65YNuwEBBXwHguDV0E";
@@ -71,7 +78,7 @@ if (config.activate_telegram) {
});
bot.sendMessage(chatId, "Drucker Liste:\n" + message);
case "/test":
case "/test":
axios.get("https://maker.ifttt.com/trigger/Alarm/with/key/mDrKtS60Xz-BNP_XfBLFH5hZU_vGiBW6KlPSe6iP61f")
break;
default:
@@ -145,8 +152,9 @@ async function main(data) {
if (config.activate_telegram) {
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";
await createPDF({ filePath, ...data });
console.log("PDF created, printing now");
@@ -238,4 +246,4 @@ const httpsServer = https.createServer(credentials, app);
httpsServer.listen(PORT, () => {
console.log(`PDF Printing Service listening on port ${PORT}`);
});
});