Mattermost webhook integration

Hello,

I am having an issue in integrating Mattermost to the Kibana Alerting Destination. I couldn’t able to provide Body parameter in the Destination dashboard while configuring Mattermost, because of that i am getting error “400 Bad Request”. But when i pass the body using curl, response is success, i received msg in Mattermost.

Can someone pls advice me, how do i proceed further!? A Sample example is much appreciated :slight_smile:

Curl ex;
curl -i -X POST -H “Content-Type: application/json” -d “{"text": "Hello, this is some text\nThis is more text"}” http://{your-mattermost-site}/hooks/xxx-generatedkey-xxx

How can i pass -d “” in Kibana alerting ?

Hi @naveen_kumar

Could you provide information on how are you actually passing the body ?

Below are the steps you would need to set in-oder to setup custom webhook.

  1. You would need to setup custom Webhook in Destinations management page
  2. The body (-d) has to be set as part of the the action message.

let me know if you’re uanble to set it up.

@mihirsoni thank you for your input. It worked :slight_smile:

1 Like

Hi @mihirsoni and @naveen_kumar , can you provide an exemple ? It seem that i have the same problem with an other API. I get a 400 bad request.

@piellick Could you post an error you are getting ?

Also, could you ensure you’ve followed steps in Mattermost webhook integration - #2 by mihirsoni

Hi, I think I have a similar issue when integrating with JIRA REST API.

I need to send something like:

curl -X POST -H "Content-Type: application/json" -u admin:admin http://myhost:18080/rest/api/2/issue/ -d
'{
    "fields": {
       "project": { "key": "TEST" },
       "summary": "Test",
       "description": "Test",
       "issuetype": { "name": "Task" }
   }
}'

I tried to put exactly that JSON in the trigger action but I still get 400 as http response.
Can you please help me with this?

Edit: It was an authentication issue. I solved providing directly the required header in the destination config:

"header_params" : {
     "Content-Type" : "application/json",
     "authorization": "Basic YWRtaW46YWRtaW4="
   }

While this can be enough to make some tests, I’d expect to have a dedicated API for providing webhook credentials. Would this be a feasible enhancement?

Thanks

1 Like

Where is the 'destination config? Have you entered them as query parameters?