You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
848 B
32 lines
848 B
2 months ago
|
const NotificationProvider = require("./notification-provider");
|
||
|
const axios = require("axios");
|
||
|
|
||
|
class Bale extends NotificationProvider {
|
||
|
name = "bale";
|
||
|
|
||
|
/**
|
||
|
* @inheritdoc
|
||
|
*/
|
||
|
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
|
||
|
const okMsg = "Sent Successfully.";
|
||
|
const url = "https://tapi.bale.ai";
|
||
|
|
||
|
try {
|
||
|
await axios.post(
|
||
|
`${url}/bot${notification.baleBotToken}/sendMessage`,
|
||
|
{ chat_id: notification.baleChatID, text: msg },
|
||
|
{
|
||
|
headers: {
|
||
|
"content-type": "application/json",
|
||
|
},
|
||
|
}
|
||
|
);
|
||
|
return okMsg;
|
||
|
} catch (error) {
|
||
|
this.throwGeneralAxiosError(error);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports = Bale;
|