NiFi 1.10: PostSlack - Easy Image Upload

Timothy Spann. 🇺🇦 - Nov 27 '19 - - Dev Community

In Apache NiFi 1.10, we now have a nice PostSlack processor to send images to slack channels. If you have read my blog I had a lesser processor that I wrote: https://www.datainmotion.dev/2019/03/posting-images-to-slack-from-apache.html.

Time to upgrade my friend.

To use the new processor you will need to have a Slack account, Slack administrator permissions and a Slack application created so you can have an application token. You can grab that token here:

https://api.slack.com/methods/files.upload/test

You can make this a parameter so you can make your PostSlack processor into a stateless module.

See example code here: https://github.com/tspannhw/nifi-1.10-templates

Our Example Flow: Sending Webcam Images to Slack

First we need a source, could be any picture source, I use my WebCam processor which grabs images from a webcamera attached to the NiFi server.

Then I add a mime.type, some sources will already set this for you. For me I manually set the image mimetype to image/jpeg.

Posting to Slack is easy, just add the channel and that token we grabbed from the slack admin site.

The webcam image posted to slack.

That's it, a new processor available for you.

In a future article I will talk about a new Rules Feature:

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .