@runnerty/notificator-slack
Version:
Runnerty module: Slack notificator
32 lines (28 loc) • 733 B
JavaScript
var Notification = global.NotificationClass;
var IncomingWebhooks = require("@slack/client").IncomingWebhook;
class slackNotificator extends Notification {
constructor(notification) {
super(notification);
}
send(notification) {
var _this = this;
var wh = new IncomingWebhooks(notification.webhookurl);
var data = {
text: notification.title,
channel: notification.channel,
iconEmoji: notification.bot_emoji,
username: notification.bot_name,
attachments: [
{
text: notification.message,
color: notification.color
}
]
};
wh.send(data, function () {
_this.end();
});
}
}
module.exports = slackNotificator;
;