Slack
A Slack channel or DM: the slack destination, from the slack package. Declare the package once in dependencies.yml; DRE installs it on demand:
plugins: - slackProfile fields
Section titled “Profile fields”Set in profiles.yml, under destinations:, in a target with type: slack.
| Field | Default | Notes |
|---|---|---|
token (required) |
Bot token (xoxb-…) Secret: use env_var(). |
|
channel |
Default channel ID (C0123) or #name. | |
api_url |
Slack’s API URL, for a proxy. | |
connect_timeout |
30s |
How long to wait for a connection (30s, 2m, or seconds) A duration (30s, 2m) or seconds. |
timeout |
60s |
How long a read or write may make no progress before it fails. A duration (30s, 2m) or seconds. |
retries |
3 |
How many times to try again after a temporary error (0: never) |
retry_wait |
The first wait before trying again (30s), doubling each try; a server’s Retry-After wins. A duration (30s, 2m) or seconds. |
|
max_retry_wait |
10m |
The longest wait between tries (10m) A duration (30s, 2m) or seconds. |
Options
Section titled “Options”Set in the report’s output.destination entry.
| Option | Type | Default | Notes |
|---|---|---|---|
channel |
string | A channel ID (C0123) or #name. | |
user |
string | A user ID (U0123), for a direct message. | |
message |
string | The text posted with the files. | |
blocks |
list | Block Kit blocks and components, posted as one message (the message text stays the notification text) | |
files_in |
string | Where files go with blocks: thread (default, a reply under the message) or message (a separate message after it) One of thread, message. |
|
retries |
integer | How many times to try again after a temporary error such as a rate limit (0: never) | |
retry_wait |
string | The first wait before trying again (30s), doubling each try; a server’s Retry-After wins. |
|
max_retry_wait |
string | The longest wait between tries (10m) |
Uploads the output to a Slack channel, or to one person’s DM, as a single post with a message. If a report produces several files, they all go in the same post.
The profile holds token, a bot token (xoxb-...), which is never logged. It can also hold a
default channel, and api_url (default https://slack.com/api) for a proxy. Destination options:
| Option | Meaning |
|---|---|
channel |
A channel ID (C0123ABCD) or #name. A name is looked up among the channels the bot can see. |
user |
A user ID (U0123ABCD). The file goes to the bot’s DM with that person. |
message |
The post’s text. |
Give exactly one of channel or user. If you give neither, the profile’s channel is used.
One that’s given but empty (a per-row "{{ each.channel }}" whose row has none) fails that
delivery: it never falls back to the profile’s channel.
destination: - profile: team_slack channel: "#finance-reports" message: "Monthly report for {{ var('client') }} ({{ run.date.iso }})"Slack app setup: create an app, add a bot user, install it to the workspace, and use its bot token. Bot scopes:
files:write: always needed.channels:readandgroups:read: needed to post to a#name.im:writeandchat:write: needed foruser.
A DM also needs the app’s Messages tab turned on (App Home > Show Tabs > Messages Tab). With it off, Slack accepts a file for the DM and then silently drops it, so before uploading the plugin checks that the DM accepts messages. The check posts nothing, and if the tab is off the delivery fails and says what to change.
The bot must be a member of the channel. Invite it with /invite @your-bot.
Messages (slack 1.1.0): for a message output, the post is the
message itself: the title in bold, then the text in Slack’s formatting, sent with
chat.postMessage (scope chat:write) to the same channel or user. message: isn’t used.
Slack’s recommended maximum is 4,000 characters: a longer message is posted cut short, with a
note and the full message attached as its .md file (scope files:write). attach: [<output>]
on the entry uploads those outputs’ files in the same post, with the message as its text.
output: - name: workbook format: xlsx queries: [detail] - name: headline format: message queries: [headline] text: "Revenue yesterday: **{{ results.headline.value | currency('EUR') }}**" destination: - {profile: team_slack, channel: "#finance", attach: [workbook]}Block Kit
Section titled “Block Kit”With slack 1.4.0, blocks: on the entry posts the message as Block Kit with
chat.postMessage. Each blocks entry is an inline block ({type: divider}) or a
component: (a reusable .json file of Block Kit JSON that core renders with the query
results); keep: first | last on an entry chooses which points a chart over Slack’s limit keeps
(default first); files_in (thread or message) places the files. The message’s text (its title and text, or message: for a file output)
is sent along as the notification and fallback text. Files (attach:, a file output, or the
full .md of a cut message) go in a thread under the blocks message, or, with
files_in: message, as a separate message after it. Blocks and files are never sent in one call.
destination: - profile: team_slack channel: "#finance" attach: [workbook] files_in: thread # default; `message` = a separate message blocks: - component: header.json - {type: divider}The daily KPI demo uses reusable .json components for three KPI cards and a 14-day revenue
line chart. The Excel workbook and PDF use the same query results and are posted after the
Block Kit message with attach: [workbook, summary_pdf] and files_in: message.

Real Slack output from the daily KPI demo, using fictional data.
Slack’s limits never fail a delivery. The plugin fixes the blocks when it delivers and warns,
naming the component, the block’s position and the limit. --preview shows the blocks before
these fixes; the warnings appear in a real run’s output:
| Limit | What happens |
|---|---|
| a chart over 20 points | keeps 20 (first or last); the categories are trimmed to match |
| over 12 series or pie segments | keeps the first 12 |
| over 2 charts in a message | keeps the first 2 |
| over 50 blocks | keeps the first 50 |
| labels and series names over 20 characters, titles and axis labels over 50 | cut with … (category and point labels stay matched) |
| pie values of 0 or less, or not numbers | dropped (a numeric string such as a DECIMAL’s "12.50" is a number) |
| a series missing a category | the point is filled with 0 |
a point whose label isn’t in axis_config.categories |
left out |
| a chart with no points left (an empty query, no pie value over 0) | left out; with no block left, the plain message is posted |
The plugin uploads the files before posting the blocks. If sharing them fails after the message is posted, the delivery still counts as delivered and warns that the files weren’t shared, so a retry never posts the message twice.
Buttons, selects and inputs without a url are posted with one warning: DRE has no server to
answer them. If Slack rejects the blocks (invalid_blocks), the error says so; paste the
previewed JSON into Block Kit Builder. With blocks the delivered location is the message’s
permalink plus the files’ permalinks.
If Slack rate-limits a call or answers 503, the plugin tries again after Slack’s Retry-After
(at most 60 seconds), up to retries times (see Tries again). Errors such
as a rejected token, a missing scope, or the bot not being in the channel are reported with what
to fix. The delivered location is the uploaded files’ permalinks (with blocks, see above).
Try the headline project
Section titled “Try the headline project”Use the complete Slack headline example for a query, conditional message and dev target that posts nothing. The minimum Slack profile is:
destinations: team_slack: targets: dev: {deliver: false} prod: type: slack token: "{{ env_var('DRE_SECRET_SLACK_BOT_TOKEN') }}" channel: C0123ABCDRun a preview before selecting prod. A channel ID avoids the channel-name lookup; using a
#name also requires read scopes. invalid-destination-option can mean both channel and
user were supplied. delivery-failed with a missing scope needs the bot reauthorized;
an absent channel membership needs the bot invited. Increasing retries cannot fix either.
See message configuration, destination keys,
error codes and message.