const config = require('config');
const Slack = require('node-slack');

class SlackNotifier{
	constructor(){
		try{
			this.slack = new Slack(config.get('slack_url'));
		}catch(e){
			console.error('Could not initialize Slack', e);
			this.slack = null;
		}
	}

	notify(item){
		if(!this.slack){
			return;
		}

		return this.slack.send({
			text: item.text,
			attachments: [item],
		}).then(() => {
			console.log('Slack message sent');
		}, (e) => {
			console.error(e);
		});
	}
}

module.exports = SlackNotifier;
@@ -350,16 +350,46 @@
 tem.text
+ %7C%7C %22Kubernetes Notification:%22
 ,%0A%09%09%09att
@@ -540,8 +540,9 @@
 otifier;
+%0A

set default text