Skip to content

Enables interactions in your Bonita processes with Slack.

License

Notifications You must be signed in to change notification settings

bonitasoft/bonita-connector-slack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bonita connector Slack

Build Release Maven Central License

This connector offers the possibility to send messages to a Slack channel.
To be used, a dedicated Slack application with write permissions must be installed on the target Slack organization.

The connector has four mandatory inputs:

  • OAuth Access Token: The OAuth access token of the installed slack application. See Your slack applications to find it.

  • Channel or Conversation ID: Defines in with channel / conversation the message is to be sent. To retrieve it, right click on the channel, copy the link of the channel and keep the last segment of the URL (something like CJC9BH4A9)

  • Notification: The text that appears on the notification received by users if they are notified. It is supposed to be a short summary of the message content.

  • Blocks: The real message to post on slack. More details in the section bellow.

The documentation of this SDK can be found here.
You can also use the block kit builder to get an idea of what is possible, but it doesn’t generate Java code.

⚠️

Bonita connector scripts are written with Groovy, thus the syntax to use the sdk differs a bit from the examples of the Slack documentation.

The input blocks expected by the connector is of type org.bonitasoft.connectors.model.SlackConnectorBlocks, an internal class that wraps a list of com.slack.api.model.block.LayoutBlock.

Here is an example of a script that build a message using the Slack SDK:

import org.bonitasoft.connectors.model.SlackConnectorBlocks

import com.slack.api.model.block.Blocks

import static com.slack.api.model.block.composition.BlockCompositions.plainText
import static com.slack.api.model.block.composition.BlockCompositions.markdownText

def header = Blocks.header{ it.text(plainText("Hello world!")) }
def divider = Blocks.divider()

def section = Blocks.section{
    it.text(markdownText("Hope your are having a wonderful day :smiley:")
}

return new SlackConnectorBlocks(header, divider, section)

To build this project, run the following command at the root of the project:

./mvnw clean package

To create a release:

  • Push a release commit on the main branch. This commit should update the pom version (remove -SNAPSHOT), and eventually the definition / implementation versions.

  • Start the Github action create release. You’ll have to define the release version, which should match the pom.xml version.

  • When the release is done, push a new commit on the next branch to prepare the next dev version (e.g 1.0.0 → 1.0.1-SNAPSHOT)

  • Do not forget to close and release the corresponding staging repository on sonartype.