slackapi / slackapi/bolt-js

Overriding callbackOptions while keeping default behavior

Open
#1,766 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auto-triage-skip enhancement
Dominant language
TypeScript
Stars
2.9k
Forks
445
Avg merge
1d 3h
Merged PRs (30d)
28

Description

You can override the callbackOptions and provide additional logic to run before/after installing the Slack app.

We use it to send a welcome message to the installing user after a succesfull installation. However, you need to manually end the response using res.end:

callbackOptions: {
        success: (installation, _options, _req, res) => {
          app.client.chat.postMessage({
            token: installation.bot.token,
            channel: installation.user.id,
            text: 'Welcome to my app!'
          });

          res.end('Success!');
        }
      }

This example just displays a basic message, rather than the default Slack page that displays when no logic is provided, that also automatically redirects to the Slack app, along with a magic link:

image

Requirements

I want the callback to provide a default, that you can call after executing your custom logic, which will show the same page but will still allow me to run my logic. The Python SDK already has this; see this PR.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how callbackOptions and the success callback are handled during Slack app installation in bolt-js. Compare the desired behavior with the referenced bolt-python PR. Done means custom success logic can run while preserving the default success page, redirect, and magic link without requiring callers to end the response manually.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.