GetSlackReaction 2.3.0.4.10.0.0-147

Bundle
com.cloudera | nifi-cdf-slack-nar
Description
Retrieves reactions for (a) given message(s). The reactions are written as Flow File attributes.PublishSlack processor should be used before GetSlackReaction.
Tags
conversation, emoji, reactions.get, slack, social media
Input Requirement
REQUIRED
Supports Sensitive Dynamic Properties
false
  • Additional Details for GetSlackReaction 2.3.0.4.10.0.0-147

    GetSlackReaction

    Description:

    GetSlackReaction allows for the ability to fetch reactions for a previously published Slack message using Slack’s reactions.get API. This Processor fetches reactions for messages published by PublishSlack processor. The reactions are written as Flow File attributes in the format of: slack.reaction.emoji_name = number_of_reactions.

    It is configurable by ‘Wait Period’ property how long the GetSlackReaction processor waits for feedbacks. The ‘Wait Period’ is calculated from the timestamp of the Slack message (the time when the message was created). In case the Slack message was created e.g. 10 minutes ago and ‘Wait Period’ is set to 5 minutes, the Processor won’t wait for additional 5 minutes, since 10 minutes already has been elapsed since the message was created. User can configure whether only the first reaction(s) are fetched or all the reactions are collected during the ‘Wait Period’. The ‘Release Per Reaction’ property can be used for this purpose. During the waiting period, the flow file is sent to “wait” relationship, and it stays there for the configured penalty time period before the processor looks for available reactions again. The default penalty period set for GetSlackReaction is 5 minutes. The “wait” relationship must be looped back to the processor by the flow designer. In case no reaction is found for a message in the configured time period, the flow file goes to “no_reaction” relationship.

    GetSlackReaction identifies a message by the id of the channel the message was published to and the message Slack timestamp. The GetSlackReaction processor requires an upstream processor, PublishSlack processor to obtain these values from flow file attributes or JSON flow file content.

    PublishSlack processor adds the “slack.channel.id” and “slack.ts” attributes to the outgoing flow file and flow file content contains the message text.

    Slack Setup

    In order use this Processor, it requires that a Slack App be created and installed in your Slack workspace. An OAuth User or Bot Token must be created for the App. The token must have the reactions:read Token Scope. Please see Slack’s documentation for the latest information on how to create an Application and install it into your workspace.

    At the time of this writing, the following steps may be used to create a Slack App with the necessary scope of reactions.read scope. However, these instructions are subject to change at any time, so it is best to read through Slack’s Quickstart Guide.

    • Create a Slack App. Click here to get started. From here, click the “Create New App” button and choose “From scratch.” Give your App a name and choose the workspace that you want to use for developing the app.
    • Creating your app will take you to the configuration page for your application. For example, https://api.slack.com/apps/<APP_IDENTIFIER>. From here, click on “OAuth & Permissions” in the left-hand menu. Scroll down to the “Scopes” section and click the “Add an OAuth Scope” button under ‘Bot Token Scopes’. Choose the reactions.read scope.
    • Scroll back to the top, and under the “OAuth Tokens for Your Workspace” section, click the “Install to Workspace” button. This will prompt you to allow the application to be added to your workspace, if you have the appropriate permissions. Otherwise, it will generate a notification for a Workspace Owner to approve the installation. Additionally, it will generate a “Bot User OAuth Token”.
    • Copy the value of the “Bot User OAuth Token.” This will be used as the value for the GetSlackReaction Processor’s Access Token property.
    • The Bot must then be enabled for each Channel that you would like to fetch reactions from. In order to do that, in the Slack application, go to the Channel that you would like to fetch the reactions from and press /. Choose the Add apps to this channel option, and add the Application that you created as a Bot to the channel.
Properties
Relationships
Name Description
no_reaction Messages are routed to this relationship if no reaction arrived for the message in the given waiting period.
wait Further reactions may occur and the waiting period has not elapsed. Consider self-looping.
success Messages are routed to this relationship when reactions are found and either the wait period has elapsed or releasing per reaction is configured.
failure Messages are routed to this relationship if an unrecoverable error occurred when fetching reactions, e.g. the message was not found.
Reads Attributes
Name Description
slack.channel.id If set, the ID of the channel where the message was sent is taken from this attribute.
slack.ts If set, the message timestamp is taken from this attribute.
Writes Attributes
Name Description
slack.reaction.<emoji name> The name of the reaction (emoji) and the reaction count that was provided for the message.
error.message The error message on fetching reactions.
slack.ts The ID of the Slack Channel where the message the reactions are fetched from.
slack.channel.id The timestamp of the Slack message the reactions are fetched for.
reaction.polling.seconds The time in seconds the processor waited for reactions.