Description:

The PostSlack processor sends messages on Slack, a team-oriented messaging service. The message can be a simple text message, furthermore Slack attachments can also be specified or the FlowFile content (e.g. an image) can be uploaded and attached to the message too.

Slack App setup

This processor uses Slack Web API methods to post messages to a specific channel. Before using PostSlack, you need to create a Slack App, to add a Bot User to the app, and to install the app in your Slack workspace. After the app installed, you can get the Bot User's OAuth Access Token that will be needed to authenticate and authorize your PostSlack processor to Slack.

Message types

You can send the following types of messages with PostSlack:

Text-only message
A simple text message. In this case you must specify the <Text> property, while <Upload FlowFile> is 'No' and no attachments defined through dynamic properties. File related properties will be ignored in this case.
Text message with attachment
Besides the <Text> property, one or more attachments are also defined through dynamic properties (for more details see the Slack attachments section below). The <Upload FlowFile> property needs to be set to 'No'. File related properties will be ignored.
Attachment-only message
The same as the previous one, but the <Text> property is not specified (so no text section will be displayed at the beginning of the message, only the attachment(s)).
Text message with file upload
You need to specify the <Text> property and set <Upload FlowFile> to 'Yes'. The content of the FlowFile will be uploaded with the message and it will be displayed below the text. You should specify <File Name> and <File Mime Type> properties too (otherwise some fallback values will be set), and optionally <File Title>. The dynamic properties will be ignored in this case.
File upload message without text
The same as the previous one, but the <Text> property is not specified (so no text section will be displayed at the beginning of the message, only the uploaded file).

Slack attachments

Slack content and link attachments can be added to the message through dynamic properties. Please note that this kind of Slack message attachments does not involve the file upload itself, but rather contain links to external resources (or internal resources already uploaded to Slack). Please also note that this functionality does not work together with file upload (so it can only be used when 'Upload FlowFile' has been set to 'No').

The Dynamic Properties can be used to specify these Slack message attachments as JSON snippets. Each property value will be converted to JSON and will be added to the array of attachments in the JSON payload being sent to Slack.

Example JSON snippets to define Slack attachments:

            {
                "text": "Text that appears within the attachment",
                "image_url": "http://some-website.com/path/to/image.jpg"
            }
        
            {
                "title": "Title of the attachment",
                "image_url": "http://some-website.com/path/to/image.jpg"
            }