mirror of
https://github.com/nttgin/BGPalerter.git
synced 2024-05-19 06:50:08 +00:00
added color to reportSlack
This commit is contained in:
@@ -66,6 +66,10 @@ reports:
|
|||||||
# - newprefix
|
# - newprefix
|
||||||
# - visibility
|
# - visibility
|
||||||
# params:
|
# params:
|
||||||
|
# colors:
|
||||||
|
# hijack: #d60b1c
|
||||||
|
# newprefix: #fa9548
|
||||||
|
# visibility: #fad648
|
||||||
# hooks:
|
# hooks:
|
||||||
# default: _YOUR_SLACK_WEBHOOK_URL_
|
# default: _YOUR_SLACK_WEBHOOK_URL_
|
||||||
|
|
||||||
|
@@ -50,14 +50,19 @@ export default class ReportSlack extends Report {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_sendSlackMessage = (url, content) => {
|
_sendSlackMessage = (url, message, content) => {
|
||||||
console.log("sending to", url);
|
|
||||||
axios({
|
axios({
|
||||||
url: url,
|
url: url,
|
||||||
method: "POST",
|
method: "POST",
|
||||||
resposnseType: "json",
|
resposnseType: "json",
|
||||||
data: {
|
data: {
|
||||||
text: content.message
|
text: content.message,
|
||||||
|
attachments: [
|
||||||
|
{
|
||||||
|
color: this.params.colors[message],
|
||||||
|
title: message
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
@@ -74,7 +79,7 @@ export default class ReportSlack extends Report {
|
|||||||
|
|
||||||
for (let group of groups) {
|
for (let group of groups) {
|
||||||
if (this.params.hooks[group]) {
|
if (this.params.hooks[group]) {
|
||||||
this._sendSlackMessage(this.params.hooks[group], content);
|
this._sendSlackMessage(this.params.hooks[group], message, content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user