Slack Webhook Integration

I’m trying to set up a slack integration to send Alerts to one of our slack channels.

I can’t get the ODS test to succeed.

I’ve got the host as hooks.slack.com
port: 443
type: https
Pipeline requests is checked
Authentication: None

Method Post
Options: {
“path”: “/services/xxx/xxx/xxx”,
“payload”: “Test”,
“headers”: {“Content-Encoding”: [“gzip”]}
}

When I hit test I get the following message.

HTTP/1.1 400 Bad Request Transfer-Encoding: chunked Access-Control-Allow-Origin: * Connection: keep-alive Content-Type: text/html Date: Tue, 14 Apr 2020 16:15:24 GMT Referrer-Policy: no-referrer Server: Apache Strict-Transport-Security: max-age=31536000; includeSubDomains; preload Vary: Accept-Encoding Via: 1.1 xxx.cloudfront.net (CloudFront) X-Amz-Cf-Id: xxx== X-Amz-Cf-Pop: ORD53-C2 X-Cache: Error from cloudfront X-Frame-Options: SAMEORIGIN X-Slack-Backend: r X-Via: haproxy-www-243e

Are you able to uncheck the “pipeline requests” checkbox? POST is a non-idempotent HTTP method, and Section 8.1.2.2 of RFC 2616 states:

Clients SHOULD NOT pipeline requests using non-idempotent methods or non-idempotent sequences of methods (see section 9.1.2). Otherwise, a premature termination of the transport connection could lead to indeterminate results. A client wishing to send a non-idempotent request SHOULD wait to send that request until it has received the response status for the previous request.

I notice you are using Cloudfront as a CDN. CDNs are finicky by design regarding RFC adherence (when you’re caching responses for the whole internet, it’s probably best to be very strict in compliance), so I’d rule out Cloudfront sending a 400 Bad Request upon seeing a pipelined POST first.

Late to the show here, but here is another post that may be of benefit.

Thank you both for your suggestions.

I was able to get this working. In the end I was sending in the Payload in an incorrect format and I had to remove the header section. For the payload only the “text” section is required, the others are optional.

{
“path”: “/services/xxx/xxx/xxx”,
“payload”: {
“text”: “Test Message.”,
“color”: “#cc1212”,
“channel”: “#ChannelName”,
“pretext”: “Pretext Message goes here”,
“username”: “ExtraHop”
}
}

I am also trying to get a webhook working with slack and none of the examples on here are working…nor does the test button work when setting up ODS… I assume things could have changed by now… I am able to do a simple curl command with no issues and get a message into slack.

Anybody got a new example that works?

I got the syntax finally… Blind squirrels find an acorn once in a while obviously.