Creating a Slack rule and messages

Tags: Flow

Overview

You can set-up numerous rules to send to your Slack workspace and all rules that are configured in your organization will appear in your rules table. 

Getting started

Step 1: Select New rule on the Slack integration page 


Step 2: Select Individual or Team rule type

  • Individual rules: analyze a single user within Flow 
  • Team rule: analyze one or more teams within Flow

Step 3: Configure Flow’s Scope for the rule then click Next.

The options available here will vary based on if you selected Individual Slack rule or Team Slack rule from the previous screen. Individual rules can only select a single user within Flow, while team rules can selected one or many teams as well as their children teams.

To select all teams, scroll to the bottom of the teams list and click Select all teams then click the Select button.

Both rule types allow you select one, many, or all repos to pull data from. To select all repos, scroll to the bottom of the repo list then click the Select button.


Step 4: Pick Delivery Settings for the rule then click Next.

Slack channels and members

  • Individual rules - you can only send the messages to a single DM Slack channel.
  • team rules - you can send the messages to multiple public channels or DM channels in your workspace.

Timezone

For both types of rules, you will select a timezone that determines when messages will send. Flow will only send messages to your Slack workspace between 9am and 5pm based on the timezone selected. 

Step 5: Add Messages to the rule.

Adding messages determines what types of messages will be sent for that rule and the conditions that must be met for them to send. There are three categories of messages, each of which have their own specific message types. 

Additionally, some messages are interactive and will send a first message with the option to receive additional information related to that message by clicking on a link in the message.

Message Categories:

A) Commit: Contains message relating to commit activity from the selected repos

B) PR: Contains messages relating to PR activity from the selected repos

C) Summary: Contains messages for weekly or monthly summaries of both Commit and PR activity for the period


Overview of message categories/types and descriptions:

Message Category

Message Type

Description

Interactive

Commit

Coding Streak

A % of the team committed code a specific number of days in a row. If team members are on coding streaks of different lengths, the highest common value will be shown.

Yes


Committed code every day this week

Every contributor on the team committed code every day that week.

No


% Gain in Fundamentals Metric

In a trailing period, a Code Fundamentals value increases by a specific percent.

No


% Gain in Fundamentals Metric w/ stats

In a trailing period, a Code Fundamentals value increases by a specific percent with a comparison against a previous period.

Yes

PR

Increase in PR’s created

In a trailing period, PR’s created increases by a specific percent.

No


Most active PR’s this week

In a trailing period, a specific number of merged PR’s have a threshold number of approvals or comments.

No


No open PR’s older than

No open PR’s are older than a specific number of days.

Yes


Decrease in old PR’s

In a trailing period, count of PR’s older than a number of days has decreased by a specific percent. The change is calculated as the first day of the trailing period vs. now.

No


Increase in PR’s merged with review

In a trailing period, the percent of PR’s merged with review increases by a specific percent vs. the previous period.

No


Decrease in PR Resolution metric

In a trailing period, a PR Resolution metric decreases by a specific percent versus the previous period.

No

Summary

Weekly Summary

Provides a weekly summary of raw commit, and PR activity.

No


Monthly Summary

Provides a monthly summary of raw commit and PR activity. 

No

Step 6: Select a message Category (1) and Message type (2)

Step 7: Select threshold limits and specific Flow metrics for the specific message type if available. Different messages will have various selectable and modifiable options, you will commonly see the below options though. 

  • Trailing date range: A whole number between 1 and 365, that is used to set the look back period for that rule.
  • Y%: A specific percent change threshold that must be met from 0 to 100.
  • Metric picker: Some messages allow you to pick between pre-selected metrics in a dropdown.
  • Count of “item”: A count of activity items (commits, PR’s, PR comments, etc.) that must be met. 

For example, in the below message Decrease in PR Resolution metric, you will see the following options. 


A) Input a value from 1 - 365 to use as the length of the “period / period” value Flow should compare. Flow will look at the trailing 14 days, vs the 14 day period prior to that. 

B) A metric from within Flow to be selected. In this case, we have defaulted to Time to Resolve from the PR Resolution report. The other option on this message is Time to First Comment from the PR Resolution report. 

C) A percent increase (or decrease) threshold that must be met Period 1 / Period 2  for the message to send.

Step 8: Customize message text.

For each message you will see a series of variable tags that can be inserted into the message text box that is pre-populated with a default message to be delivered. 

Raw text: You can free form input raw text into the box to match how you and your team like to communicate. The input does not natively support emojis, but when Slack receives the raw text, it will parse its native emoji language :star2: into the proper image.

This includes any :custom-emoji: that your Slack workspace has created, which will be rendered once delivered to the Slack workspace.

Variable tags: The variable tags contain pre-defined or calculated values from Flow such as a percent change or list of items such as PR’s. Hovering on a variable tag outside of the customization area, will show example data for that specific tag. Clicking on the tag will insert it into the customization area at the active location of the cursor. 

To delete a tag, simply delete the entire item as a single block of text. The toggle Show variable and Show data determines if the tags that are in the message preview show the variable name or example data that would display when the message is delivered. 

Step 9: Two part messages

Some messages contain two parts that can send additional information about the activity of the user/team. The second part of the message can be customized just like the first, but you need to be sure to include the variable tag {% @msg-part2-link %} in the body of the first message so you can request that information. 

When the tag is inserted into the body of the first message, you will see this format:

[Some default text] {% @msg-part2-link %} 

The text within the square brackets [] can be customize and is what the link for the second message will display, the variable tag in the curly brackets {} behaves just like any other variable tag and is customizable. When the link is clicked within your Slack workspace, it will trigger the second part of the message to be sent. Each link will only send additional information one time. 


Summary of interactive message types

Message Category

Message Type

Description

Interactive

Commit

Coding Streak

A % of the team committed code a specific number of days in a row. 

Yes


% Gain in Fundamentals Metric w/ stats

In a trailing period, a Code Fundamentals value increases by a specific percent with a comparison against a previous period.

Yes

PR

No open PR’s older than

No open PR’s are older than a specific number of days.

Yes

Testing Slack rules and messages

Once a rule has been set-up and messages have been added to it, you can test each message by sending them to any Slack channel you choose. To test a specific rules message(s), navigate to that rules details by clicking on the rules name in the rules table. 

Step 1: Click on the rule name.

Step 2: Navigate to the Messages on the rules details screen.

Step 3: Click Test message next to one of the messages you would like to test.

Step 4: This will open a modal allowing you to pick a Slack channel to send the test message.

  1. Select the Slack channel or indivdual you want to send the test to.
  2. Click Select
  3. Click Test Message next to the rule/s you want to test.


When sent, each message will send with the text supplied in its template as well as the variable tags where the calculated values would be displayed. Success and Error banners will be shown next to each message upon testing. 


Slack rules and messages: summary of selectable and customizable items


Individual Rule

Team Rule

Flow Scope: User(s) / Team(s)

Analyzes a single user from Flow only. Cannot analyze multiple users at once or a User and a Team

Can analyze a single or multiple teams in Flow with or without their nested teams. 

Flow Scope: Repo(s)

Can analyze one or more repos that have been imported into Flow.

Can analyze one or more repos that have been imported into Flow.

Delivery Settings: Slack channel

Can be sent to a single personal (DM) Slack channel within the connected workspace. Cannot be send to multiple personal channels or public/private group channels.

Can be sent to one or more public slack channels or individual (dm) channels.

Delivery Settings: Timezone

Can be send to any timezone available, should match the timezone that the selected recipient from the delivery settings is predominantly located in. 

Can be send to any timezone available, messages will only be delivered between 9-5 based on that timezone. 

Messages

Any type of message can be added to the rule. Only the selected Flow user from the Scope selection will be analyzed when generating messages.

Any type of message can be added to the rule. Any contributors on the selected teams will be analyzed when generating messages. If All teams is selected, then all users in your organization that are included in metrics will be analyzed. 

back to top


If you need help, please email support@pluralsight.com for 24/7 assistance.