Slack Messages
PushMetrics comes with a Slack integration that makes it easy to send files and messages to any public or private Slack channel, as well as to individual users.
Learn more
Creating Slack Messages
The Slack task has the following inputs:
- Connection: If you have multiple Slack integrations configured, you can choose which one to use here.
- Channel Name (App only): Defines to which channel or user the message will be sent.
- Attachments (App only): Attachments generated by other tasks that will be uploaded to the Slack channel as files
- Text Editor or JSON: You can design your message using a simple WYSIWYG editor or, for more advanced styling use a JSON with Slack Block Kit elements.
It is generally recommended to use the PushMetrics Slack App, as it allows
a) sending messages to any channel in your workspace and
b) uploading files.
Webhooks are limited to sending messages only and are tied to one channel exclusively.
Selecting a Channel to send to
You can send to any public or private channel of a Slack workspace, as well as individual users.
Public Channels
- Simply provide the channel name (e.g.
general
orrandom
) with or without#
. - You can also provide the channel ID (e.g.
C05V6CVV893
)
Individual Users
- Simply provide the username with an
@
(e.g.@richard
) - You can also provide the member ID (e.g.
C05V6CVV893
), to be found on the user's profile.
Private Channels
- In order to send to a private channel, the PushMetrics App needs to be invited to it.
- To do that, go to the private channel, type
/invite
and select "Add apps to this channel". Then, select the PushMetrics app from the list. - Please note: This will not allow the PushMetrics app to read any of the messages in the channel.
- Once the app is part of the private channel, you can send to it using the channel name (e.g.
my-private-channel
) or channel ID (e.g.C05V6CVV893
).
Attachments
You can attach files generated by other tasks (e.g. SQL queries or charts) and upload them to Slack using the .export()
function.
Once you send the attachment, your designated channel will receive a message containing the attachment.
Text Editor
The Text Editor allows you to create simple, formatted text messages.
It supports Jinja, allowing dynamic content with data from upstream tasks. You can incorporate variables and results from SQL queries to create personalized and data-driven messages.
JSON - Slack Block Kit
The JSON editor allows you to create more advanced Slack messages using Slack Block Kit UI elements.
It also supports adding Jinja for dynamic messages.
Slack Block Kit is a UI framework for designing and building rich, interactive messages in Slack. The Block Kit consists of "blocks", which are essentially building blocks you can stack vertically to create complex layouts. These blocks can be used to present information, capture user input, and more.
There are several types of blocks available, such as
- Section Blocks: Display text alongside things like images.
- Divider Blocks: Create visual breaks between different blocks.
- Image Blocks: Display an image.
- Actions Blocks: Add interactive elements like buttons or select menus.
Link to Block Kit Builder
Slack provides an online tool called the Block Kit Builder. This tool allows you to design, preview, and prototype your Block Kit layouts. It's especially helpful for visualizing how your blocks will look and behave in Slack.
PushMetrics provides a link below the JSON input that opens your current message in the Block Kit Builder: