Skip to content
Permalink
Browse files

Add Slack support to webhook

  • Loading branch information...
NEMS Linux
NEMS Linux committed Mar 14, 2019
1 parent 6f826b2 commit b2e7c99d7da3c1bd30b142c69d53dc7caf982b2a
Showing with 12 additions and 0 deletions.
  1. +12 −0 webhook
12 webhook
@@ -1,5 +1,10 @@
<?php

// For testing
$currentissueshead = "Test";
$state = "CRITICAL";


// this file is included from warninglight. Not run separately.

$webhook = trim(shell_exec('/usr/local/bin/nems-info webhook'));
@@ -121,6 +126,13 @@ if (strstr($webhook,'office.com')) { // MS Office 365 / Teams: https://docs.micr
$hookObject->body[0]['columns'][1]['items'][4]['spacing'] = 'small';
$hookObject->body[0]['columns'][1]['items'][4]['text'] = 'Powered by NEMS Linux ' . $nemsver;

} elseif (strstr($webhook,'slack.com')) { // Slack

$nemsstate = trim('NEMS ' . $currentissueshead);
$hookObject->username = $alias;
$hookObject->icon_url = $light_cdn . $color . '.png';
$hookObject->text = "*$nemsstate*\n\n$currentissueshead\n\n*Reporting Server:* $alias\n\n*Timestamp:* " . date('c') . "\n\nPowered by <https://nemslinux.com/|NEMS Linux $nemsver>";

} else { // Discord
$hookObject->content = strtoupper($state);
$hookObject->username = 'NEMS ' . strtoupper($state);

0 comments on commit b2e7c99

Please sign in to comment.
You can’t perform that action at this time.