New notification provider: CallMeBot API (#4605)

Co-authored-by: Frank Elsinga <frank@elsinga.de>
This commit is contained in:
Merlin 2024-04-02 21:39:45 +02:00 committed by GitHub
parent effd0197ac
commit 937c8a9a7b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 42 additions and 0 deletions

View file

@ -0,0 +1,23 @@
const NotificationProvider = require("./notification-provider");
const axios = require("axios");
class CallMeBot extends NotificationProvider {
name = "CallMeBot";
/**
* @inheritdoc
*/
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
const okMsg = "Sent Successfully.";
try {
const url = new URL(notification.callMeBotEndpoint);
url.searchParams.set("text", msg);
await axios.get(url.toString());
return okMsg;
} catch (error) {
this.throwGeneralAxiosError(error);
}
}
}
module.exports = CallMeBot;