NiFi 1.10: PostSlack - Easy Image Upload
Published: 2019-11-27 17:09:49

---
title: NiFi 1.10:  PostSlack - Easy Image Upload
published: true
date: 2019-11-18 17:46:00 UTC
tags: 
canonical_url: 
---

[![](https://1.bp.blogspot.com/-ZDrS4MmaTNw/XdLTWU-KABI/AAAAAAAAYzw/kO_t3BIZKz406MiJN2BEPxQjFs9_gcaHACLcBGAsYHQ/s640/2019-11-08_17-36-17_419.jpeg)](https://1.bp.blogspot.com/-ZDrS4MmaTNw/XdLTWU-KABI/AAAAAAAAYzw/kO_t3BIZKz406MiJN2BEPxQjFs9_gcaHACLcBGAsYHQ/s1600/2019-11-08_17-36-17_419.jpeg)

  

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](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](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](https://github.com/tspannhw/nifi-1.10-templates)

  

  

**Our Example Flow:   Sending Webcam Images to Slack**

[![](https://1.bp.blogspot.com/-E2lq2sKRxXc/XdLXqiz0M8I/AAAAAAAAY0Y/d0EXSKDPAgEhqnAc5IwaLI4hx5fLtI5jACLcBGAsYHQ/s640/simplePostSlackFlow.png)](https://1.bp.blogspot.com/-E2lq2sKRxXc/XdLXqiz0M8I/AAAAAAAAY0Y/d0EXSKDPAgEhqnAc5IwaLI4hx5fLtI5jACLcBGAsYHQ/s1600/simplePostSlackFlow.png)

  

  

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**.

  

[![](https://1.bp.blogspot.com/-Qv77muC9tvw/XdLXqflG6QI/AAAAAAAAY0U/ewCv7gEkCxMTGfSIYgSg84CfiDcT9EZDQCLcBGAsYHQ/s640/setAMimeType.png)](https://1.bp.blogspot.com/-Qv77muC9tvw/XdLXqflG6QI/AAAAAAAAY0U/ewCv7gEkCxMTGfSIYgSg84CfiDcT9EZDQCLcBGAsYHQ/s1600/setAMimeType.png)

  

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

  

[![](https://1.bp.blogspot.com/-C7hb5AdrmnM/XdLXpyUPYbI/AAAAAAAAY0M/5kLwq5PM3rIN9rcO294Jbqu6lgrGLJbngCLcBGAsYHQ/s640/postSlackProperties.png)](https://1.bp.blogspot.com/-C7hb5AdrmnM/XdLXpyUPYbI/AAAAAAAAY0M/5kLwq5PM3rIN9rcO294Jbqu6lgrGLJbngCLcBGAsYHQ/s1600/postSlackProperties.png)
  
**The webcam image posted to slack.**  
  

[![](https://1.bp.blogspot.com/-rU3tqLvZbyg/XdLXpvTpTBI/AAAAAAAAY0I/05q0Ja_MZokvNCnd76JjXWuICOIqvsWzACLcBGAsYHQ/s640/nifichannel.png)](https://1.bp.blogspot.com/-rU3tqLvZbyg/XdLXpvTpTBI/AAAAAAAAY0I/05q0Ja_MZokvNCnd76JjXWuICOIqvsWzACLcBGAsYHQ/s1600/nifichannel.png)
  

  

  

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

  

  

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

  

[![](https://1.bp.blogspot.com/-McatmQJkzXA/XdLXpdF8CWI/AAAAAAAAY0g/J9QMywpcdt8izBH0PoECPfpSAtvJspeeACEwYBhgL/s1600/RulesEngineService.png)](https://1.bp.blogspot.com/-McatmQJkzXA/XdLXpdF8CWI/AAAAAAAAY0g/J9QMywpcdt8izBH0PoECPfpSAtvJspeeACEwYBhgL/s1600/RulesEngineService.png)

  

  

[![](https://1.bp.blogspot.com/-CGg3mDAJwnA/XdLXqLb0NmI/AAAAAAAAY0Q/6Uq0wNPs-OoWyI3vGJEYXsAUJTB8qyxQwCLcBGAsYHQ/s640/rulesProperties.png)](https://1.bp.blogspot.com/-CGg3mDAJwnA/XdLXqLb0NmI/AAAAAAAAY0Q/6Uq0wNPs-OoWyI3vGJEYXsAUJTB8qyxQwCLcBGAsYHQ/s1600/rulesProperties.png)

  

[![](https://1.bp.blogspot.com/-iahhKn2ade0/XdLXpZZr0OI/AAAAAAAAY0A/LijSB6qjh1IhDtoQvJFpIWAEsCYHIgROACLcBGAsYHQ/s640/easyrulesdoc2.png)](https://1.bp.blogspot.com/-iahhKn2ade0/XdLXpZZr0OI/AAAAAAAAY0A/LijSB6qjh1IhDtoQvJFpIWAEsCYHIgROACLcBGAsYHQ/s1600/easyrulesdoc2.png)
  

[![](https://1.bp.blogspot.com/-cnpddHxi0bs/XdLXpa_6n-I/AAAAAAAAY0E/gVI4YOtlHcgNNT52d5iRGy_oWQKyQrebQCLcBGAsYHQ/s640/easyRulesEngineService.png)](https://1.bp.blogspot.com/-cnpddHxi0bs/XdLXpa_6n-I/AAAAAAAAY0E/gVI4YOtlHcgNNT52d5iRGy_oWQKyQrebQCLcBGAsYHQ/s1600/easyRulesEngineService.png)