Today, we will pick up two of “Slack: Post Chat (Incoming Webhook)” and “Slack: Post Chat (Bots)” from the Slack related automatic Steps of Questetra BPM Suite as the topic. Both are equipped as standard since Version 11.9.

Slack is…

Slack is a business-oriented chatting tool that is developed and managed by Slack Technologies, Inc. With Slack, in addition to being able to use different channels depending on topics, teams, etc. on it, you can link it with various applications and create bots on it using APIs.

For more information on Slack, please visit Slack’s official page.

Automatic Steps of Questetra

I will describe automatic Step features which are for posting messages to Slack. Although there are two types, the basic function is the same. The difference is the mechanism of receiving on Slack side and settings related to that.

Config. screen of “Slack: Post Chat (Incoming Webhook)”
Config. screen of “Slack: Post Chat (Bots)”

The above-left is the Incoming Webhook version, right is the Bots version. Respectively posts a message through them.

First, I will explain the config items common to both.

Item name (Item code represents Webhook/Bot)
Required Description
C2/C3: Sending TextNo
Enter texts you want to send. Expression Language (EL) is also available.
C3/C4: Attachment Summary (In notifications when no sending text) EL is also available.NoEnter the text used for notification from Slack when “C2: Sending Text” is empty. EL is also available.
C4/C5: Attachment ColorNoSets the color of the Attachment-sidebar. “good” “warning” “danger” and “hex color code” are available.
C5/C6: Attachment TitleNoEnter the text used for the title of the Attachment. EL is also available.
C6/C7: Attachment Title LinkNoWhen linking to the title of Attachment, enter the URL of the link destination. EL is also available.
C7/C8: Attachment TextNoEnter the text used for the body of the Attachment. EL is also available.

These above are settings concerning messages to be sent. In addition to text messages, you can also use a part of Attachment (described later). If all three of “Sending Text”, “Attachment Title”, and “Attachment Text” are blank, a script error will result. In addition, at this time, if “C6: Attachment Title” is not entered, “C7: Attachment Title Link” will be invalid. Please be aware of these matters.

Next, I will explain the config items specific to Incoming Webhook version.

Item name
RequiredDescription
C1: Incoming Webhook URLYesEnter the URL of the Incoming Webhook to which you want to send.

Next, I will explain the config items specific to Bots version.

Item name
RequiredDescription
C1: Slack Bot TokenYesEnter the token of the bot to be used.
C2: Slack Channel NameYesEnter the name of the channel to post. “#” is disregarded.

About “Attachment”

“Attachment” is the mechanism of expanding messages on Slack. In automatic Step of Questetra, “Title”, “Title Link”, “Text”, “Color”, “Attachment Summary (fallback message)” are supported.

The relation between settings on the message and the appearance of the message actually posted is like the image below. (Even though the image below is with the Incoming Webhook, it is the same with Bots.)

Relation of settings and appearance

“Attachment Summary” is not reflected in the message body, it will only be used for notification if the “Sending Text” is empty.

For information on Attachment, please see official documentation of Slack.

Which to use?

Concerning whether to use Incoming Webhook version or Bots version, if only one of them can be used for circumstances of the Slack side, use the one. If both are available, use Bots version if you want something else to do with. You should use the Incoming Webhook version if you want nothing to do except sending messages.

Settings of Slack

To use Incoming Webhook or Bots, you need to set up in Slack. Follow the procedure below to make the setting.

First, you open the setting screen of Slack workspace. Click on “Configure apps” on the left menu, then on the opened window, click “Custom integration”.

For Incoming Webhook

Click on “Incoming Webhook”, then click “Add configuration” on the opened window.

Specify the Post to channel. Besides a channel, you can specify a member to send direct messages.

Setting screen of Incoming Webhook Post to channel

On the next page, make various settings.

Item nameDescription
Post to ChannelSet the channel where messages will be posted to. If you want to change from you specified earlier, change this.
Webhook URLWebhook URL to be the send destination. Since it will be used in the setting on Questetra, so copy it by clicking “Copy URL”.
Descriptive LabelYou can change the description of Incoming Webhook displayed on Slack. Enter it as necessary.
Customize NameYou can change the name used for posting. By default, it is “incoming-webhook”. Let’s change it to a meaningful name.
Customize IconYou can change the icon used for posting. Let’s change it to an easy-to-understand icon. Click “Use default icon” to return to the standard icon.
Preview MessageYou can check the appearance of the actual appearance of a post.

When setting it actually, it looks as follows.

Example of Incoming Webhook settings

Click “Save Settings” and the setting on Slack side is complete.

For Bots

Click on “Bots”, then click “Add configuration” on the opened window.

First, set the username of the Bot.

Bot username setting screen

For a username of a Bot, there is a restriction that is “Equal or less than 21 characters and only lowercase letters, numbers, hyphens, and underscores“.

On the next page, make various settings.

Item nameDescription
API TokenToken to use this Bot. Since it will be used in the setting on Questetra, so copy it.
Customize NameUsername of the Bot. You can change it here.
Customize IconYou can change the icon used for posting. Let’s change it to an easy-to-understand icon.
Preview MessageYou can check the appearance of the actual appearance of a post.
Full NameYou can change the name displayed on Slack. By default, it is the same as the username.
What this bot doesExplanation of the purpose of Bot to other users.
ChannelsList of channels where this Bot joins.
Restrict API Token UsageYou can set the range of IP addresses that can access Slack using the token of this Bot.
Translate User IDsYou can set whether to use global ID converted to local ID. It has nothing to do with the content of this article.

Click “Save Integration” and the settings on this screen is completed.

Finally, Invite the created Bot to the Slack channels you want to post. You can invite by posting “/invite @[Full Name of the Bot]” on the channel you want to post. Incidentally, if you want to remove a bot from a channel for some reason, you can remove it with “/remove @[Full Name of the Bot]”.

This completes all the settings.


Example App

Examples of how to use these automatic Steps are as follows.

  • Notify the end of a Process on Slack
  • Notify occurrence of an error on Slack
  • Automatically report issues which should be reported to people other than being in charge through Slack

In this article, I will introduce you with a simple example App that would be basic. For actual use, utilize it by incorporating it into other App etc. according to the application.

Workflow diagram of the example App

This example App is for posting pre-set texts and Attachment. You can use it to see how a message is posted to Slack. You confirm the difference between the two by posting with Attachment at “Post Slack (1)”, and by only text at “Slack posting (2)”.

The Data Items are as follows.

Data Item
TypeRequiredInput Title TsakDescription
Title
NoEditableTitle of the Process

First, finish the “Input Title”, a human task. At this time, input the title of the Process.

Next, it posts a message at “Post to Slack (1)”. Here, we use the Incoming Webhook version. Its configuration is as follows.

Item name
Configuration
C1: Incoming Webhook URLhttps://hooks.slack.com/services/****/****/****” (URL of Incoming Webhook you have set up. The **** part is different for each setting.)
C2: Sending Text“Process started.
C3: Attachment Summary (In notifications when no sending text)This is not displayed even if it is set since “C2: Sending Text” is not empty. Leave blank.
C4: Attachment Color#00FF00” (Light green)
C5: Attachment Title#{processInstanceTitle}” (It will be the Title of the originating Process when posting.)
C6: Attachment Title Link${var[applicationRoot]}OR/ProcessInstance/listView?processInstanceId=#{processInstanceId}” (It will be the URL that shows the details of the originating Process when posting.)
C7: Attachment TextStart User:#{processInstanceInitQuserName}
Start Time:#{processInstanceStartDatetime}
” (The former will be the user who started the originating Process, the latter will be the Start time.)

Next, it posts a message at “Post to Slack (2)”. There, we use the Bots version. Include the URL of the Process details in the text for the sake to see how the appearance changes in the way you set the URL.

Item nameConfiguration
C1: Slack Bot Tokenxoxb-****-****-****” (Token of Bot you have set up. The **** part is different for each setting.)
C2: Slack Channel Name
Enter the name of the channel you want to use.
C3: Sending TextProcess of “#{processInstanceTitle}” has finished.
${var[applicationRoot]}OR/ProcessInstance/listView?processInstanceId=#{processInstanceId}
C4 to C8Leave all blank.

This completes configurations.

The actual execution results as follows.

Example of a message posted by the Example App

The string of “Sample” in the message posted with Incoming Webhook has become a hyperlink to the same URL in the one with Bot.


You can use Slack Posts to keep track of checking on important, so try to utilize them in a variety of scene. That’s all for today.