Zsihovszki Krisztina created NIFI-13554:
-------------------------------------------
Summary: GetSlackReaction processor to fetch reactions for Slack
message
Key: NIFI-13554
URL: https://issues.apache.org/jira/browse/NIFI-13554
Project: Apache NiFi
Issue Type: New Feature
Reporter: Zsihovszki Krisztina
The intention of this processor is to capture reactions for a message which was
published to a Slack channel earlier.
Users of NiFi can use ConsumeSlack or ListenSlack to capture Slack messages.
These currently do not include reactions which are at times helpful for a user
to understand value of a given message.
ConsumeSlack/ListenSlack's output JSON contains several messages, while
reactions are only useful when understood in the context of an individual
message.
Also reactions might occur over a period of time.
Another possible use case is to fetch reactions for a message which was
published by PublishSlack and collect the reactions for the published messages
over a given period of time. It helps users getting feedback for individual
messages they published in Slack.
The aim of this Jira to create GetSlackReaction processor which will wait for a
user configurable period of time and gather reactions for a message
or it can optionally release messages as soon as a single reaction is found for
it.
For each reaction found the name will be stored as a flowfile attribute as well
the count of that reaction type found.
The channel id, message timestamp will be set for each outgoing flow file, the
flow file content will be the original Slack message text.
During the waiting period, the flow file is sent to WAIT relationship and it
stays here for the configured penalty time period before the processor looks
for available reactions again.
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 would require an upstream processor
(ConsumeSlack, ListenSlack or PublishSlack) 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.
ConsumeSlack, ListenSlack provide JSON output containing several messages. The
channel id, message timestamp, message text are included in the JSON content.
Users can configure GetSlackReaction to look for attributes or JSON path to
obtain the values of message timestamp and channel id.
The 'Attributes' mode should be used if PublishSlack precedes GetSlackReaction,
the 'JSON path' mode should be used if ConsumeSlack or ListenSlack precedes the
GetSlackReaction processor.
In case of ConsumeSlack/ListenSlack processor precedes GetSlackReaction ('JSON
path' mode), the user has to configure JSON path for channel id,
message timestamp and message text. The default values of these properties are
set to the path used in ConsumeSlack/ListenSlack output.
GetSlackReaction processor will split the incoming JSON array content to
separate JSONs including only one Slack message and will create a separate flow
file for each message.
The original flow file will go to ORIGINAL relationship.
The slack.channel.id, slack.ts attributes will be set for each outgoing flow
file, the flow file content will be the message text (extracted from the JSON
using the provided message text JSON path).
In case of PublishSlack processor precedes GetSlackReaction, the
slack.channel.id and slack.ts attributes are already set, the flow file content
is the published Slack message's text.
The flow file will be cloned, it will keep the attributes, content, the
original flow file will be sent to Original relationship (to be in synch with
the ConsumeSlack/ListenSlack case).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)