PublishSlack 2.0.0

Bundle
org.apache.nifi | nifi-slack-nar
Description
Posts a message to the specified Slack channel. The content of the message can be either a user-defined message that makes use of Expression Language or the contents of the FlowFile can be sent as the message. If sending a user-defined message, the contents of the FlowFile may also be optionally uploaded as a file attachment.
Tags
chat.postMessage, conversation, publish, send, slack, social media, team, text, unstructured, upload, write
Input Requirement
REQUIRED
Supports Sensitive Dynamic Properties
false
Properties
Relationships
Name Description
rate limited FlowFiles are routed to 'rate limited' if the Rate Limit has been exceeded
success FlowFiles are routed to success after being successfully sent to Slack
failure FlowFiles are routed to 'failure' if unable to be sent to Slack for any other reason
Writes Attributes
Name Description
slack.channel.id The ID of the Slack Channel from which the messages were retrieved
slack.ts The timestamp of the slack messages that was sent; this is used by Slack as a unique identifier
Use Cases
  • Send specific text as a message to Slack, optionally including the FlowFile's contents as an attached file.
    Description
    Send specific text as a message to Slack, optionally including the FlowFile's contents as an attached file.
    Configuration
    Set "Access Token" to the value of your Slack OAuth Access Token.
    Set "Channel" to the ID of the channel or the name of the channel prefixed with the # symbol. For example, "C0123456789" or "#general".
    Set "Publish Strategy" to "Use 'Message Text' Property".
    Set "Message Text" to the text that you would like to send as the Slack message.
    Set "Include FlowFile Content as Attachment" to "true" if the FlowFile's contents should be attached as a file, or "false" to send just the message text without an attachment.
    
  • Send the contents of the FlowFile as a message to Slack.
    Description
    Send the contents of the FlowFile as a message to Slack.
    Configuration
    Set "Access Token" to the value of your Slack OAuth Access Token.
    Set "Channel" to the ID of the channel or the name of the channel prefixed with the # symbol. For example, "C0123456789" or "#general".
    Set "Publish Strategy" to "Send FlowFile Content as Message".
    
Use Cases Involving Other Components
  • Respond to a Slack message in a thread.
    Description
    Respond to a Slack message in a thread.
    Keywords
    slack, respond, reply, thread
    Processor Configurations
    org.apache.nifi.processors.standard.EvaluateJsonPath
    Set "Destination" to "flowfile-attribute"
    
    Add a new property named "thread.ts" with a value of `$.threadTs`
    Add a new property named "message.ts" with a value of `$.ts`
    Add a new property named "channel.id" with a value of `$.channel`
    Add a new property named "user.id" with a value of `$.user`
    
    Connect the "matched" Relationship to PublishSlack.
    
    org.apache.nifi.processors.slack.PublishSlack
    Set "Access Token" to the value of your Slack OAuth Access Token.
    Set "Channel" to `${'channel.id'}`
    Set "Publish Strategy" to "Use 'Message Text' Property".
    Set "Message Text" to the text that you would like to send as the response. If desired, you can reference the user of the original message by including the text `<@${'user.id'}>`.
        For example: `Hey, <@${'user.id'}>, thanks for asking...`
    Set "Include FlowFile Content as Attachment" to "false".
    Set "Thread Timestamp" to `${'thread.ts':replaceEmpty( ${'message.ts'} )}`
    
See Also