uptime-kuma/server/notification-providers/call-me-bot.js
Merlin 937c8a9a7b
New notification provider: CallMeBot API (#4605)
Co-authored-by: Frank Elsinga <frank@elsinga.de>
2024-04-02 21:39:45 +02:00

24 lines
645 B
JavaScript

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;