NiFi 1.10: PostSlack - Easy Image Upload


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. Go to Tester tab, pick your app, mine is Nifi. then click test. At the bottom will be a URL with the token=? Grab that token.

Notes:

You also must login with slack admin role

files:write
files:write:user

under YOURSLACK /apps/manage .  then dive into app

https://api.slack.com/messaging/files/setup

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



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: