0

webhook to slack - 400 no_text
Moderators: adafruit_support_bill, adafruit

Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
Please be positive and constructive with your questions and comments.

webhook to slack - 400 no_text

by esquagga on Thu Dec 05, 2019 6:18 pm

Looked like it would be super-easy to connect Adafruit IO to Slack, posting a simple messages to a channel. Almost anyway. Slack responds with 400 no_text. This is because there is no text. Not sure if this is the only thing preventing this from working, but it would be nice to add keyword and value pairs to the webhook, for example, "text": "The whatsit has frazzled."

esquagga
 
Posts: 12
Joined: Sat Apr 08, 2017 5:17 pm

Re: webhook to slack - 400 no_text

by brubell on Mon Dec 09, 2019 11:47 am

Hey esquagga,

I'm interested in this too - could you explain your setup in a reply post? Specifically, how you connected IO to slack and what you're sending to slack.

- brent r.

brubell
 
Posts: 696
Joined: Fri Jul 17, 2015 10:33 pm

Re: webhook to slack - 400 no_text

by esquagga on Mon Dec 09, 2019 12:35 pm

I don't think I can do better than the documentation that's available online. It was pretty easy for me to follow the doc that's at api.slack.com/messaging/webhooks, since I have done it before. The result is a URI that corresponds to a new Slack application. One pastes that URI into AIO when creating a new trigger. Unfortunately it does not work.

Slack allows one to do some pretty cool stuff with webhooks. For example, I send status messages and images from my 3D printer. But to do something useful from Adafruit IO, there would have to be a feature added that allows specifying keyword/value pairs to be sent in the webhook message. At a minimum, there must be a "text" field, as that appears to be necessary for Slack to process the webhook. I suppose this could be hard-coded to be the name of the trigger or similar, which would be better than nothing.

Again, I'm not sure the suggested change above would make it work. It's just the first obstacle.

Of course, I could just code my IOT device to talk to Slack directly, which I probably will do, but that is much more cumbersome. Besides the added communication code, I'll have to hard-code in the alert thresholds.

esquagga
 
Posts: 12
Joined: Sat Apr 08, 2017 5:17 pm

Re: webhook to slack - 400 no_text

by esquagga on Sat Dec 14, 2019 2:45 pm

I ended up solving my issue by use of ifttt.com. By connecting to both Adafruit IO and Slack, it was a very simple matter to have a message sent to a Slack channel when a threshold is reached on an AIO feed. I wasn't aware of this IFTTT service prior; the possibilities are awesome.

esquagga
 
Posts: 12
Joined: Sat Apr 08, 2017 5:17 pm

Re: webhook to slack - 400 no_text

by brubell on Wed Dec 18, 2019 5:06 pm

esquagga wrote:I ended up solving my issue by use of ifttt.com. By connecting to both Adafruit IO and Slack, it was a very simple matter to have a message sent to a Slack channel when a threshold is reached on an AIO feed. I wasn't aware of this IFTTT service prior; the possibilities are awesome.

Yep - we also have a Zapier Integration (IFTTT sometimes takes upwards of 15 minutes per action)

brubell
 
Posts: 696
Joined: Fri Jul 17, 2015 10:33 pm

Please be positive and constructive with your questions and comments.


cron