Bursting to a Slack Channel
In 5.3.3, we provided the ability to send a Burst directly to a Slack Channel. This article will show the basics required to perform this function.
- Find or create a Burst and obtain the URL id number
- Create the Dataset to fetch Burst data from MI database
- Create a Custom Script to run your Dataset (contact firstname.lastname@example.org for assistance)
- Assign the Custom Script to a Notification Schedule
- Security settings must allow a Slack Channel to access elements that are bursted to that Channel
- To learn more, click MI Slack App Security
- Bursting only works for public Channels
1. Obtain Burst id (Content > Bursts)
- Burst id is found in the URL as shown above
- Schedule specified on the Burst itself is ONLY used if the Burst is sent via delivery options specified in #3
- Send Burst via - uncheck all if only bursting to Slack
If you wish to create a new Burst instead, see details on Create New Burst (Version 5.1.2 and beyond)
As you will note in the following steps, "Burstig to Slack" ignores both fields in items 2 & 3 above
2. Create a Dataset to fetch stored Burst data from Metric Insights
- Data Source must be Dashboard DB (SQL)
- SQL statement example below with your Burst id included as marked
SELECT element_id, segment_value_id FROM notification_schedule_distribution_item WHERE notification_Schedule_distribution_id=131
To define the order in which bursted elements will appear in a Slack Channel, add ORDER BY (see example below)
ORDER BY element_id Desc;
3. When the Dataset is Enabled and Published, the values returned with be the Element IDs and Dimension Values specified in your Burst
3. Configure Automation Script for Bursting to Slack
3.1. Admin > Utilities > Custom Scripts
In Release 6.0 (beta) use the following path: Admin > System > Custom Scripts
Specify basic Script Information:
- Name of the Script
External Application Name will default
- Learn about configuring your Metric Insights instance for API access from Set up API Access
- Authentication User can be modified but must be an Admin
Save to display full Script Editor
3.2. Custom Scripts Editor > Editor Tab
- Go to the Editor tab
- Enter the code for your Script.
- Alternatively, contact email@example.com to get the code
3.3. Custom Scripts Editor > Info Tab
- Set Custom Script is to 'enabled'
- Are Parameters Required must be set to 'yes'
- Select [+ Add Parameter]
3.4. Add Script Parameter
Add the required Script Parameters. The following example is done for the "channel" parameter:
- Name set to: "channel"
- Type set to: "String"
- Default Value (optional): Name of default Slack Channel for this Burst
- Available Values: Names of all Slack Channels to receive this Burst (View in 3.3 below)
- Required: must be set to "yes"
Save to return to the full editor where the added Parameters and Parameter Sets will now appear
3.5. Verify the Parameters
Parameter names must be exactly the same as those specified in the Custom Script
You can enter the parameters for:
- Burst Description
- Burst Name
- Slack Channel
- Dataset Name
3.6. Add Parameter Sets
Multiple Parameter Sets can be added.
Each Set will allow the same Automation Script to be used to send various Content with separate Bursts to different Slack Channels.
On the Add Parameter Set pop-up indicate:
- Parameter Set Name
- channel: specify the name of the Channel where the Burst is to be delivered
- burstName: provide the exact Name of the Burst that you want to distribute via Slack
- burstDescription: additional text information that is sent alongside Tiles to a Slack Channel
- datasetName: enter the name of the Report that will fetch data for Bursting
- If set to Default, this Parameter set will be used by default during the Automation Script run.
4. Select or Add a Notification Schedule for Slack Distribution
Upon completing Script configuration, associate the Script with a Notification Schedule.
You can select from the list of already available schedules or create one.
Go to Admin > Notification Schedule
- Choose any of the existing Schedules
- Alternatively, click [+New Notification Schedule]
5. Add the Automation Script to your Notification Schedule
In Notification Schedule Editor
- Go to the Run Scripts tab
- Click [+Add Script]
- Choose Script to be added
- Click [Save]
6. Verify Slack Distribution
After Content Bursting is executed according to the Notification Schedule, the Slack Channel will contain the following information:
- Burst Name
- Burst Description
- Tile Name
- Last Measurement Value and Time (for Metrics)
- Tile Description
- Preview Image