Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 51 additions & 7 deletions docs/features/slack-rich-messages/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ surface. It accepts two inputs and nothing else:
- **Markdown** the agent already writes. A `#` or `##` heading becomes a header block, `---` a divider, a Markdown
table a real table block, an image line a picture (only from this deployment's own address, see Safety).
- **Components**: a small vocabulary OpenWork defines and validates (`header`, `text`, `divider`, `context`, `fields`,
`table`, `image`, `buttons`, `choices`). An agent passes them to `slack_send_as_bot`, or writes them as JSON in one
`table`, `chart`, `image`, `buttons`, `choices`). An agent passes them to `slack_send_as_bot`, or writes them as JSON in one
fenced block with the language `slack` in a Slack answer. Raw Block Kit is never accepted.

Pictures and the exact input for each: [example use cases](./examples.md). Every picture is drawn by the sample
Expand All @@ -28,16 +28,47 @@ renderer (the sandbox's sample Slack), not by Slack.
| Surface | Feature off (unchanged) | Feature on |
| --- | --- | --- |
| Slack assistant, live reply | Streamed Markdown text and task updates | Unchanged. Components belong to the final answer |
| Slack assistant, final answer | One `markdown` block, 300 character notification | Header, real table, divider, context, fields, link buttons, picture, and one question with choice buttons |
| Slack assistant, final answer | One `markdown` block, 300 character notification | Header, real table, chart, divider, context, fields, link buttons, picture, and one question with choice buttons |
| Background task report | Mention, then a `markdown` block | Same components as an answer |
| `slack_send_as_bot` (chats, Automations) | `text` only | `text` plus validated `components` |
| Your agent's message | Text | The same words in sections, a header on the first check of the day, a line naming what was read |
| Your agent's source notices | A sentence with a link | The sentence and a button to the fix |
| Desktop result posted in the thread | mrkdwn sections, tables as code blocks | Header, real table, divider, picture. No choices |
| Desktop result posted in the thread | mrkdwn sections, tables as code blocks | Header, real table, divider, picture, and a chart or other component the desktop wrote in a `slack` block. Choices stay text |
| Check-ins, done and failure lines, connect card | Text (connect card already had a button) | Unchanged: one line reads faster as one line |

Internal webhooks to our own workspace (harness feedback, support triage) and CI alerts are out of scope.

## Charts

A `chart` component becomes Slack's `data_visualization` block: a line, area or bar chart from `categories` and
`series` (one value per category in every series), or a pie from `segments`. It ships under this same flag, not one of
its own: it is one more component of a rollout that is still off by default, a chart Slack refuses arrives as a table
without anyone doing anything, and turning the flag off returns every surface to text. A second flag would double the
states of every surface and every prompt to guard one block.

```json
{ "type": "chart", "kind": "line", "title": "Weekly active users",
"categories": ["Nov 9", "Nov 16", "Nov 23"], "series": [{ "name": "Users", "values": [1240, 1315, 1402] }] }
```

![Weekly active users as a line chart, flag on, drawn by the sample renderer](./chart-weekly-active-users.png)

- **The numbers always travel as text.** The message's `text` holds the title and one line per category or slice with
every value (a pie adds each share), so a notification, a screen reader and the plain retry all give the data.
- **A chart Slack would not draw is never sent as a chart.** A title over 50 characters, a name or label over 20, more
than 20 categories, more than 12 series or slices, repeated series names or categories, or a pie value of 0 or less:
the title and the same numbers arrive as a table. So does a third chart in one message. Slack shows one table a
message here, so when the message already has a table (the agent's own, or an earlier chart's) the numbers arrive as
text lines instead.
- **If Slack refuses a chart it was sent** (a block error, or `invalid_arguments`), the same message is posted once
more with each chart as a table, before the plain retry described under Limits.
- **What is refused outright** is only what cannot be read as data: a series whose values do not match the categories
one for one, a pie with no segments, a line with no series. The agent gets the reason back and nothing is posted.
- Agents are told when a chart helps (a trend over time, a share of a whole, a comparison of a few categories) and
when it does not (exact figures people will copy, more than about 20 points, a single number).

In a Slack answer a chart comes only from the fenced `slack` block; there is no Markdown syntax for one.

## Choices: buttons that answer a question

`choices` is the only interactive component, because it is the only one with a handler. The question is posted as its
Expand All @@ -59,7 +90,7 @@ acknowledges every signed interaction.

## Limits enforced before anything is sent

From Slack's reference, checked 27 Nov 2026. The composer splits or degrades instead of sending something Slack refuses.
From Slack's reference, checked 27 Nov 2026 (charts: 28 Nov 2026). The composer splits or degrades instead of sending something Slack refuses.

| Limit | Value | What OpenWork does | Source |
| --- | --- | --- | --- |
Expand All @@ -71,13 +102,15 @@ From Slack's reference, checked 27 Nov 2026. The composer splits or degrades ins
| Context | 10 elements | One element per line | [Context block](https://docs.slack.dev/reference/block-kit/blocks/context-block) |
| Image | URL 3,000; alt text and title 2,000 | Clips text; alt text is required | [Image block](https://docs.slack.dev/reference/block-kit/blocks/image-block) |
| Actions and buttons | 25 elements; text 75; `action_id` 255; URL 3,000; value 2,000 | At most five buttons, ids set by OpenWork | [Actions block](https://docs.slack.dev/reference/block-kit/blocks/actions-block), [Button](https://docs.slack.dev/reference/block-kit/block-elements/button-element) |
| Chart | 2 a message; title 50; pie 1 to 12 segments, label 20, value above 0; line, area and bar 1 to 12 series with unique names of 20, 1 to 20 points each, exactly one point per category, category labels 20, axis labels 50 | Checks every limit before sending. Outside them, or a third chart, becomes a table, or text when the message already has a table | [Data visualization block](https://docs.slack.dev/reference/block-kit/blocks/data-visualization-block) |
| Top-level `text` | Aim for 4,000 | A full text version of the message, up to 3,900, for notifications and screen readers. Table links are kept, and when it must be cut the buttons or the question stay at the end | [chat.postMessage](https://docs.slack.dev/reference/methods/chat.postMessage) |
| Stream | 12,000 Markdown characters and 10 minutes | Starts a new stream at 11,000 characters or 4 minutes, and when Slack answers `msg_too_long` | [chat.startStream](https://docs.slack.dev/reference/methods/chat.startStream) |
| Interactions | Acknowledge within 3 seconds, link buttons included | The route queues a press and answers 200 without calling Slack; the worker does the rest | [Handling user interaction](https://docs.slack.dev/interactivity/handling-user-interaction) |

The stream limit is a fix that ships without the flag: the code rotated at 30,000 characters, past Slack's limit.

If Slack still refuses the blocks (`invalid_blocks`, `msg_blocks_too_long` and similar), the same content is posted once
If Slack still refuses the blocks (`invalid_blocks`, `msg_blocks_too_long` and similar), a message with a chart is first
posted again with each chart as a table. After that, or at once when there was no chart, the same content is posted once
as plain mrkdwn sections, counted together with the caller's own blocks (attribution, mention, feedback) so the retry
stays inside 50. If Slack refuses that too, it is posted as text alone. `slack_rich_message_rejected` is logged each
time with the surface and Slack's error code.
Expand Down Expand Up @@ -106,6 +139,7 @@ time with the surface and Slack's error code.

1. In `/admin` › organization › Features, turn on **Slack: tables, buttons and sections in messages from OpenWork**.
2. In a chat: "Send me my open issues on Slack as a table." The agent's `slack_send_as_bot` call now lists `components`.
Then: "Send me weekly active users for the last eight weeks on Slack as a chart."
3. In Slack: mention the app and ask for something tabular ("pipeline by stage"), or for a draft it should ask before
sending.

Expand Down Expand Up @@ -137,14 +171,24 @@ client sends the press, or that the queued request then runs to an answer. Befor
in a real workspace: the table block next to other blocks, a multi-message answer, a choice press through to the
assistant's reply, and the fallback text in a notification.

Charts have never been sent to a real Slack workspace. The block is built from Slack's reference page alone, so these
are open until someone tries them: that `chat.postMessage` accepts `data_visualization` from our app with `chat:write`
and no other setting or plan, that Slack accepts the exact shape we send (each point repeating its category label),
how Slack draws it (the pictures here are the sample renderer's own drawing), whether a chart may sit in a thread
reply and next to a table, which error code a refused chart returns (the table retry runs on Slack's block errors and
on `invalid_arguments`; any other code fails the send like any other Slack error), and what a notification shows for
a message that is mostly a chart.

## What Slack still does not allow, or we chose not to use

- A streamed reply cannot carry these components reliably. Slack documents a `blocks` chunk but no list of which
blocks it accepts, so streams stay text and task updates.
- `table` is not available in modals, and `markdown` blocks only in messages.
- The docs no longer state a one-table-per-message rule, only 10,000 characters across tables. We keep one table a
message until that is confirmed in a real workspace.
- Newer blocks (`card`, `carousel`, `container`, `data_table`, `data_visualization`, `layout`, `plan`, `task_card`)
are documented but not used here.
- Newer blocks (`card`, `carousel`, `container`, `data_table`, `layout`, `plan`, `task_card`) are documented but
not used here.
- Charts in Home tabs: Slack allows them there, and OpenWork has no Home tab.
- Stacked bars, colors, and a second axis: the block has no fields for them.
- Pictures from other sites, for the reason under Safety. Uploaded Slack files (`slack_file`) are not wired.
- Menus, date pickers and inputs in messages: no handler, so not offered.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading