mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Add support for using Markdown for the Ciscospark transport (#10442)
* Add support for using Markdown. Alert templates can be written using Webex Teams (i.e., Spark) Markdown, which makes for some richer alerts. This option defaults to false to maintain Principle of Least Astonishment. * Update Cisco Spark docs. * Mention that Cisco Spark is now called Webex Teams * Add support for Markdown * Refactor text. Do not exceed 80 characters per line. * Refactor code to meet style guidelines. * Remove errant tabs and use spaces instead * Correct type check * Remove use of 'else'
This commit is contained in:
@@ -31,10 +31,15 @@ class Ciscospark extends Transport
|
||||
{
|
||||
$text = strip_tags($obj['msg']);
|
||||
$data = array (
|
||||
'roomId' => $room_id,
|
||||
'text' => $text
|
||||
'roomId' => $room_id
|
||||
);
|
||||
|
||||
$akey = 'text';
|
||||
if ($this->config['use-markdown'] === 'on') {
|
||||
$akey = 'markdown';
|
||||
}
|
||||
$data[$akey] = $text;
|
||||
|
||||
$curl = curl_init();
|
||||
set_curl_proxy($curl);
|
||||
curl_setopt($curl, CURLOPT_URL, 'https://api.ciscospark.com/v1/messages');
|
||||
@@ -70,6 +75,13 @@ class Ciscospark extends Transport
|
||||
'name' => 'room-id',
|
||||
'descr' => 'CiscoSpark Room ID',
|
||||
'type' => 'text',
|
||||
],
|
||||
[
|
||||
'title' => 'Use Markdown?',
|
||||
'name' => 'use-markdown',
|
||||
'descr' => 'Use Markdown when sending the alert',
|
||||
'type' => 'checkbox',
|
||||
'default' => false,
|
||||
]
|
||||
],
|
||||
'validation' => [
|
||||
|
Reference in New Issue
Block a user