Permalink
Browse files

Issue #146: Allow customizing Slack alert username & icon

  • Loading branch information...
kiwiz committed Oct 14, 2017
1 parent 8cdea9b commit eebbc19098ecb618c84fb7486926089eda5fd8a3
Showing with 12 additions and 2 deletions.
  1. +8 −0 config_example.php
  2. +4 −2 phplib/Target/Slack.php
View
@@ -197,4 +197,12 @@
* See https://api.slack.com/incoming-webhooks for details.
*/
'webhook_url' => null
/**
* The username to display on Alerts.
*/
'username' => null,
/**
* The icon to display on Alerts.
*/
'icon' => null,
];
View
@@ -62,10 +62,12 @@ public function process(Alert $alert, $date) {
)))
]);
$username = $scfg['username'] ? $scfg['username']:Util::getSiteName();
$icon = $scfg['icon'] ? $scfg['icon']:':warning:';
$message_data = [
'channel' => $this->obj['data']['channel'],
'username' => self::escape(Util::getSiteName()),
'icon_emoji' => ':warning:',
'username' => self::escape($username),
'icon_emoji' => self::escape($icon),
'text' => '',
'attachments' => [[
'pretext' => self::escape($message),

0 comments on commit eebbc19

Please sign in to comment.