# Add a Message Shortcut to a Slack Bolt App

Yes. An agent adds a message shortcut to your Bolt for JavaScript app, with the manifest entry, the commands scope, a modal, and a view handler, and opens a PR.

[Run this on Rush](https://cloud.getrush.ai/run/add-message-shortcuts/slack-bolt/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent reads the app and its manifest together, because a shortcut lives in both. In an app laid out like slack-samples/bolt-js-getting-started-app, `app.js` is an ES module (`"type": "module"` in `package.json`, `@slack/bolt` at `^5.1.0`) that builds an `App` in Socket Mode from `SLACK_BOT_TOKEN` and `SLACK_APP_TOKEN`, registers one `app.message('hello', …)` listener that replies with a section block and a button, one `app.action('button_click', …)` handler that acknowledges and posts a line, and starts on `PORT` or 3000. `manifest.json` declares the bot user, `channels:history`, `chat:write` and `im:history` as bot scopes, `message.channels` and `message.im` as bot events, `interactivity.is_enabled: true` and `socket_mode_enabled: true`. There is no `features.shortcuts` array, no `commands` scope, no `app.shortcut` and no `app.view` handler, and `README.md` tells the reader to paste `manifest.json` into the app configuration and reinstall.

The shortcut needs three additions, and the agent makes them in the order Slack checks them. In `manifest.json` it adds `features.shortcuts` with one entry: `type: "message"`, a `name` in sentence case starting with a verb, a `description` under 150 characters and a `callback_id` such as `save_message`, and it adds `commands` to the bot scopes, because Slack serves shortcuts only to apps that hold that scope and an app installed without it must be reinstalled before the menu item appears. The README gains a line saying so. In `app.js` it adds `app.shortcut({ callback_id: 'save_message', type: 'message_action' }, …)`: the handler calls `ack()` first, inside the three-second window Slack gives every interaction, then `client.views.open` with the `shortcut.trigger_id` and a modal whose blocks show the message text from `shortcut.message.text`, the channel from `shortcut.channel.id`, and a plain-text input for a note, with `private_metadata` carrying the channel and message timestamp so the submission knows what it is about.

The submission is the second handler: `app.view('save_message_modal', …)` acknowledges, reads the note from `view.state.values`, parses `private_metadata`, and posts a confirmation with `client.chat.postMessage` to the channel the shortcut came from, which `chat:write` already allows. Both handlers wrap the Web API calls in try/catch and log through `app.logger`, matching the existing style of the file. Socket Mode means no request URL changes: the shortcut and view payloads arrive on the same WebSocket the message events use, so nothing in `settings` other than the scopes array changes.

The check is a test the sample never had. The agent adds `node --test` tests that import the listener functions and call them with a fake `ack`, a fake `client.views.open` and a message-shortcut payload shaped like Slack's, asserting that `ack` is called before `views.open`, that the modal's `callback_id` matches the view handler, and that the view handler posts to the channel from `private_metadata`. It cannot sign in to a workspace from the sandbox, so it does not claim the shortcut was exercised live; the pull request says which steps the reader does by hand: paste the manifest, reinstall the app, pick the shortcut from a message's menu.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Add a message shortcut to this Bolt for JavaScript app. Read app.js, manifest.json, package.json and README.md first. In manifest.json add a features.shortcuts entry of type message with a verb-first name, a short description and the callback_id save_message, and add the commands scope to the bot scopes. In app.js add an app.shortcut handler for callback_id save_message and type message_action that acknowledges first, then opens a modal with client.views.open using the shortcut's trigger_id; the modal shows the message text and channel, takes a plain-text note, carries the channel id and message timestamp in private_metadata, and has callback_id save_message_modal. Add an app.view handler for save_message_modal that acknowledges, reads the note from view.state.values, and posts a confirmation to the originating channel with client.chat.postMessage. Keep Socket Mode and the existing listeners unchanged. Add node --test tests with fake ack and client objects that check the acknowledge-then-open order, the modal callback_id and the posted channel. Update README.md to say the app must be reinstalled for the commands scope. Open a pull request that quotes the test output and lists the manual steps.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

The pull request changes `app.js` (two handlers and the exported listener functions), `manifest.json` (one shortcut entry and one scope), `package.json` (a `test` script) and `README.md`, and adds a test file. Its description quotes the `node --test` output, shows the manifest diff, and lists the three manual steps in order: update the manifest in the app configuration, reinstall to grant `commands`, then choose the shortcut from a message's menu.

A reviewer checks that `ack()` precedes every Web API call, that the `callback_id` strings in the manifest, the shortcut handler and the modal agree, and that nothing posts anywhere except the channel the message came from. They may want the note stored somewhere rather than echoed back, which is a change inside the view handler only.

Once installed, a user in any channel the bot is in opens a message's menu, picks the shortcut, sees the message quoted in a modal, adds a note, and gets a confirmation in the channel.

## Run it on every Linear issue labelled slack-feature

An automation on the Project with a `linear` trigger on `linear.issue.labeled` and the label `slack-feature` starts a read-only run that reads the issue and posts its plan as a comment: which manifest fields, which scope, which handlers. The change itself starts from the reader's own server, which sends this body to `POST /o/{org}/sessions` with the issue's URL in `resources` beside the repository, so the issue text is in the prompt, and a `request_id` that is a UUID v5 of the issue id, so a retried call returns the run it already started.

Each run reads that app's own manifest, so an app that already holds `commands` for a slash command gets no scope change, an app over HTTP rather than Socket Mode gets a note about its request URL, and one written in TypeScript gets typed handlers.

## Why run it on Rush?

A Slack shortcut fails quietly: a missing scope hides the menu item, a late `ack()` shows the user a generic error, and a `callback_id` that differs by one character between the manifest and the handler means nothing happens at all. The agent reads all three places, keeps them consistent, and leaves tests that pin the order of calls, with the output in the pull request, so the reviewer checks the design rather than hunting for a typo.

Teams that run several Slack apps can send the same request to each repository at once, each in its own sandbox. Every pull request fits its app's manifest and transport, and every one says exactly which manual installation step remains, which is the part no automation can do for a workspace it cannot sign in to.

## Frequently asked questions

### Why does the manifest need the commands scope?

Slack shows shortcuts only for apps that hold `commands`, the same scope slash commands use. An app installed without it has to be reinstalled after the manifest changes, which is why the pull request lists that step and the README says it.

### Does Socket Mode change how shortcuts arrive?

No. The shortcut payload and the modal submission come over the app-level WebSocket like the message events, so no request URL is configured. An app that receives events over HTTP instead would need its interactivity request URL to end in `/slack/events`, which the agent notes when it sees that setup.

### What is in the modal?

A section quoting `shortcut.message.text`, a context line with the channel, and a plain-text input for a note. The channel id and message timestamp travel in the view's `private_metadata`, which is how the submission handler knows where to post.

### Can the shortcut be tested without a workspace?

The handler logic can. The tests call the listener functions with a fake `ack`, a fake `client` and a payload shaped like a `message_action` event, and assert the order of calls and the ids. The menu item itself appears only after the manifest is applied and the app reinstalled, which the pull request states plainly.

## More Slack Bolt jobs

- [Add a Modal to a Slack Bolt App](https://getrush.ai/run/add-modals/slack-bolt/)
- [Add an OAuth Install Flow to a Slack Bolt App](https://getrush.ai/run/add-oauth-install-flow/slack-bolt/)
- [Add Scheduled Messages to a Slack Bolt App](https://getrush.ai/run/add-scheduled-messages/slack-bolt/)

## More jobs like this: Turn a Linear label into a PR

- [Add Lock Timeouts to Alembic Migrations on PostgreSQL](https://getrush.ai/run/add-migration-lock-timeouts/alembic/)
- [Add Modals to a discord.js Bot](https://getrush.ai/run/add-modals/discord-js/)
- [Add Model Contracts to a dbt Project](https://getrush.ai/run/add-model-contracts/dbt/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
