Send Slack alerts as pure json #3522

Merged
merged 1 commit into from May 17, 2016

Projects

None yet

4 participants

@tfgm-bud
Contributor

Now works with mattermost as well as slack
Set the Content-type header application/json
Removed extraneous code that was urlencoding some apparently unused data ($api)
Removed "payload=" from the alert messsage as it is not proper json

@tfgm-bud tfgm-bud Send Slack alerts as pure json
Now works with mattermost as well as slack
Set the Content-type header application/json
Removed extraneous code that was urlencoding some apparently unused data ($api)
Removed "payload=" from the alert messsage as it is not proper json
9e1cbff
@laf
Member
laf commented May 16, 2016

Is this backwards compatible or will users need to update anything?

@tfgm-bud
Contributor
tfgm-bud commented May 17, 2016 edited

@laf It is backwards compatible. I tested the transport with both Slack and Mattermost (http://www.mattermost.org). Slack says (https://api.slack.com/incoming-webhooks):

The preferred way to send Slack your JSON body is by sending a HTTP POST to your webhook URL, containing a request body with an explicit Content-type HTTP header set to application/json. This tells Slack how to interpret the data you're sending us.

So I think this should be a good way to handle the data.

@murrant murrant merged commit dacb9fa into librenms:master May 17, 2016

2 checks passed

Auto-Deploy Build finished. No test results found.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@laf
Member
laf commented May 17, 2016

Thanks @tfgm-bud.

Just as an FYI you'll need to the contributors agreement for future PRs :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment