graylog-labs / graylog-plugin-slack

Graylog alarm callback for Slack
https://www.graylog.org
Apache License 2.0
117 stars 52 forks source link

Mattermost compatibility #19

Closed madchap closed 8 years ago

madchap commented 8 years ago

Hi,

Not really an "issue", but I don't think this is so far from working with Mattermost as well. Do you think it'd be possible to somehow have a version that satisfies both?

Thanks! Best, fred

joschi commented 8 years ago

@madchap If someone provided a pull request to make this plugin compatible with other Slack clones, we'd certainly be willing to merge it.

agateblue commented 8 years ago

I'd be glad to see this happen, since alerts fail on mattermost (despite the fact most slack plugins work out of the box with mattermost).

For the record, mattermost return this kind of errors:

 {"id":"web.incoming_webhook.parse.app_error","message":"Unable to parse incoming data","detailed_error":"","request_id":"uh78or6tjpf5uk7m3wgn7hraza","status_code":500,"is_oauth":false}

The payload sent by the plugin is as follows:

{"link_names":"0","channel":"#alerts","text":"*Alert for Graylog stream <https://mygraylog/streams/574d9ac4e4b0b8e97/messages?q=*&rangetype=relative&relative=3600|Celery - Succeeded tasks>*:\n> Dummy alert to test notifications","parse":"none","username":"Graylog"}

And the request metadata:

Content-Length: 297
User-Agent: Java/1.8.0_66
Content-Type: application/x-www-form-urlencoded

After messing a bit with the hook, it seems sending a Content-Type: application/json header and removing \n from the payload fix the issue. Since I'm not a Java guy, I really don't feel confident enough to write that code directly in the plugin.

dennisoelkers commented 8 years ago

Mattermost compatibility was introduced and verified with ef55ffd207d6c7f26449b092b2867d6de2e49446. I've released 2.2.1 of the plugin. Thanks for your help guys!