Slack alert formatting

I’m trying to get the slack alerts to look “better” and be slightly more functional. The first thing is I’d like to be able to use the built-in slack markdown codes to format the text of the message. The second thing would a way to include a link to the device page for the device being alerted on displayed as a short name.

I know that the first should be fairly easy with just a modification of the transport.slack.php to include ‘mrkdwn_in’ => [‘text’] in the data array but don’t want to have the daily.sh updater yell at me for a modified file.

The second I’m not really sure how to get around with the $slack_msg = strip_tags($obj[‘msg’]); line in the code since the format for doing named URLs in slack is <http://<site>|<shortname>>.

2 Likes

An easy way to fix the modified files warning is to submit a PR: http://docs.librenms.org/Developing/Using-Git/

We now include http://htmlpurifier.org/, so feel free to use that over strip_tags.