mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Change slack format to attachment style
As documented here: https://api.slack.com/docs/message-attachments This change also makes things compatible with simple HTML templates by using strip_tags() on the template output.
This commit is contained in:
@@ -24,8 +24,17 @@
|
||||
foreach( $opts as $tmp_api ) {
|
||||
$host = $tmp_api['url'];
|
||||
$curl = curl_init();
|
||||
$slack_msg = strip_tags($obj['msg']);
|
||||
$color = ($obj['state'] == 0 ? '#00FF00' : '#FF0000');
|
||||
$data = array(
|
||||
'text' => $obj['msg'],
|
||||
'attachments' => array(
|
||||
0 => array(
|
||||
'fallback' => $slack_msg,
|
||||
'color' => $color,
|
||||
'title' => $obj['title'],
|
||||
'text' => $slack_msg,
|
||||
)
|
||||
),
|
||||
'channel' => $tmp_api['channel'],
|
||||
'username' => $tmp_api['username'],
|
||||
'icon_url' => $tmp_api['icon_url'],
|
||||
|
Reference in New Issue
Block a user