mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-07-21 22:19:07 -04:00
New notification provider: CallMeBot API (#4605)
Co-authored-by: Frank Elsinga <frank@elsinga.de>
This commit is contained in:
parent
effd0197ac
commit
937c8a9a7b
6 changed files with 42 additions and 0 deletions
23
server/notification-providers/call-me-bot.js
Normal file
23
server/notification-providers/call-me-bot.js
Normal 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;
|
Loading…
Add table
Add a link
Reference in a new issue