summaryrefslogtreecommitdiffstats
path: root/server/notification-providers/call-me-bot.js
blob: daa9ccdeb5a387fef36b0a7bfca07eef819b4c97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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;