Repository navigation
Description
When Orbit posts a notification into Slack, the only thing you can do with it is read it and go somewhere else. Every notification is a dead end that costs a context switch.
Add actions to the message.
What to build
Block Kit buttons on outbound notification messages, sized to the notification:
- Assign to me. The most common single action on a new issue in a channel.
- Change state. An overflow menu of the team's workflow states rather than a row of buttons, because a team can have many.
- Snooze. Pushes the notification out of the inbox until later. Orbit's inbox already has a notion of read state, so check what exists before adding a new concept.
- Open in Orbit. A link, always present.
After an action, the message updates in place to show what happened and who did it. Do not post a second message. A channel that fills with "Shashank assigned this to themselves" as separate messages is worse than no buttons.
The rules
The acting user is the Slack user, mapped to an Orbit user, and their permissions apply. Not the workspace's, not the bot's. If the mapping does not exist, or the person is not allowed to change that issue, the button responds with an ephemeral refusal and changes nothing. packages/shared/src/policy decides, and the check happens on the server, every time, even though the button was only rendered because it looked allowed.
Every mutation goes through packages/core. The same domain call the REST route uses, so the change bumps sync_id, publishes a SyncAction to Redis, and fans out to every open browser tab exactly as it would have. A Slack button that writes directly to Postgres would leave every open tab stale, which is the one thing Orbit is supposed to never do. See docs/architecture.md.
Acknowledge within three seconds, then act.
Stale messages. A notification from last week may have buttons for a state that has since been deleted, or an issue that has been archived. Handle it: respond with what happened rather than throwing.
Do not double notify. Acting from Slack generates activity, which generates a notification, which could come back to the same channel. Check the notification producers in packages/core/src/notifications/ and make sure the actor does not get told about their own action.
Files
packages/services/src/for the Slack client and message building- A Slack interactivity route under
apps/web/src/app/api/webhooks/slack/, shared with the shortcut and command issues packages/core/src/notifications/notify.tsfor where messages are producedpackages/core/src/work/for the mutations
Tests
The important ones are the refusals. A member of another team pressing "assign to me" must change nothing and say so. Put that in apps/web/tests/app/api/webhooks/slack/.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsBacklog
Activity