Update webhooks
This commit is contained in:
18
src/index.js
18
src/index.js
@@ -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";
|
||||||
|
|
||||||
@@ -71,7 +78,7 @@ if (config.activate_telegram) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
bot.sendMessage(chatId, "Drucker Liste:\n" + message);
|
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")
|
axios.get("https://maker.ifttt.com/trigger/Alarm/with/key/mDrKtS60Xz-BNP_XfBLFH5hZU_vGiBW6KlPSe6iP61f")
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -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");
|
||||||
@@ -238,4 +246,4 @@ const httpsServer = https.createServer(credentials, app);
|
|||||||
|
|
||||||
httpsServer.listen(PORT, () => {
|
httpsServer.listen(PORT, () => {
|
||||||
console.log(`PDF Printing Service listening on port ${PORT}`);
|
console.log(`PDF Printing Service listening on port ${PORT}`);
|
||||||
});
|
});
|
||||||
Reference in New Issue
Block a user