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:
Joe Clarke
2019-07-14 17:34:22 -04:00
committed by Tony Murray
parent a6ecff380b
commit 8bbc69a878
2 changed files with 21 additions and 5 deletions

View File

@@ -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' => [