Skip to content

Conversation

@misscoded
Copy link
Contributor

@misscoded misscoded commented Dec 8, 2025

Summary

Adds missing SocketModeOptions to App init. Resolves #2292.

New options are made available as seen below:

/** Initialization */
const app = new App({
  token: process.env.SLACK_BOT_TOKEN,
  socketMode: true,
  appToken: process.env.SLACK_APP_TOKEN,
  logLevel: LogLevel.DEBUG,
  // New SocketModeOptions 
  socketModeOptions: {
    autoReconnectEnabled: true,
    clientPingTimeout: 420,
    pingPongLoggingEnabled: true,
    serverPingTimeout: 150,
  },
});

To test:

  • Spin up TS-friendly Bolt project (https://github.com/slack-samples/bolt-ts-starter-template)
  • Symlink @slack/bolt-js to this branch in project
  • Verify that types exist
  • Verify that changing these values reflects the same changes when logging the SocketMode receiver after initialization (i.e., autoReconnectEnabled, serverPingTimeoutMS, clientPingTimeoutMS, pingPongLoggingEnabled).

Requirements (place an x in each [ ])

@misscoded misscoded self-assigned this Dec 8, 2025
@misscoded misscoded requested a review from a team as a code owner December 8, 2025 22:21
@misscoded misscoded added enhancement M-T: A feature request for new functionality semver:minor labels Dec 8, 2025

/** App initialization options */
export interface AppOptions {
signingSecret?: HTTPReceiverOptions['signingSecret'];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These all still exist, just made them alphabetical order bc it was driving me nuts 🫠 (but a sanity check is very welcome!).

private attachFunctionToken: boolean;

public constructor({
signingSecret = undefined,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. All still exist, just alphabetized.

clientId?: string;
clientPingTimeout?: number;
clientSecret?: string;
stateSecret?: InstallProviderOptions['stateSecret']; // required when using default stateStore
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And again 😉 (alphabetized)

@codecov
Copy link

codecov bot commented Dec 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.46%. Comparing base (d6f9ce7) to head (ea3b4b8).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2735      +/-   ##
==========================================
+ Coverage   93.44%   93.46%   +0.01%     
==========================================
  Files          37       37              
  Lines        7675     7693      +18     
  Branches      669      669              
==========================================
+ Hits         7172     7190      +18     
  Misses        498      498              
  Partials        5        5              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@mwbrooks mwbrooks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙇🏻 Nice, thanks for exposing these options through Bolt!

❓ I'll start to test the PR soon, but I was curious whether there's a reason why we don't organize the socket mode options into a separate object (there is probably a reason)? Something like:

/** Initialization */
const app = new App({
  token: process.env.SLACK_BOT_TOKEN,
  socketMode: true,
  appToken: process.env.SLACK_APP_TOKEN,
  logLevel: LogLevel.DEBUG,
  // New SocketModeOptions
  socketModeOptions: { 
    autoReconnectEnabled: true,
    clientPingTimeout: 42,
    pingPongLoggingEnabled: true,
    serverPingTimeout: 15,
  },
});

@WilliamBergamin
Copy link
Contributor

Nice 💯
I also have the same question as @mwbrooks 🤔 having it in its own object could also help us with the separation of concern

receiver?: Receiver;
redirectUri?: HTTPReceiverOptions['redirectUri'];
scopes?: HTTPReceiverOptions['scopes'];
socketModeOptions?: Omit<SocketModeOptions, 'appToken'>;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mwbrooks @WilliamBergamin Bundled!

The caveat here is that SocketModeOptions (from the socket-mode pkg) requires appToken; we derive that from the root level initialization here. I've leveraged Omit to appease the type expectation, but open to alternatives (though it seems preferable at first blush to avoid the creation of a near-identical type).

installerOptions: this.installerOptions,
installationStore,
redirectUri,
...socketModeOptions,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mwbrooks @WilliamBergamin

installerOptions is made public on the instance. I'm not sure why, exactly, but we can do the same for socketModeOptions if we think there's a use case for exposing it.

@zimeg zimeg changed the title Add missing SocketMode options feat: add missing SocketMode options Dec 10, 2025
@zimeg
Copy link
Member

zimeg commented Dec 10, 2025

📚 Quick question if the new options might be nice to reference from this page?

🔗 https://docs.slack.dev/tools/bolt-js/concepts/socket-mode

@misscoded misscoded requested a review from mwbrooks December 10, 2025 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement M-T: A feature request for new functionality semver:minor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: expose @slack/socket-mode options to bolt apps

5 participants