Skip to content

feat(types): add the user_connection and user_connection_status_requested events - #2783

Merged
WilliamBergamin merged 3 commits into
mainfrom
feat-user-connection-status-requested-event
Oct 22, 2026
Merged

WilliamBergamin merged 3 commits into
mainfrom
feat-user-connection-status-requested-event

Conversation

@WilliamBergamin

@WilliamBergamin WilliamBergamin commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This pull request adds the user_connection and user_connection_status_requested events to @slack/types.

  • New UserConnectionEvent union of UserConnectionConnectEvent (subtype: 'connect', with trigger_id) and UserConnectionDisconnectEvent (subtype: 'disconnect', with an optional enterprise_id), added to SlackEvent. Checking subtype === 'connect' narrows trigger_id to a string, so apps can open the connection modal without a cast.
  • New UserConnectionStatusRequestedEvent interface (type, user, event_ts), added to SlackEvent. Bolt listeners for this event now type event.user, which apps pass to apps.user.connection.update.
  • Matches feat: add the user_connection and user_connection_status_requested event models java-slack-sdk#1660.

Testing

From an app with features.user_connections enabled and subscribed to both events:

app.event('user_connection', async ({ event, client }) => {
  if (event.subtype === 'connect') {
    await client.apps.user.connection.requestAuth({ trigger_id: event.trigger_id, primary_provider: provider });
  }
});

app.event('user_connection_status_requested', async ({ event, client }) => {
  await client.apps.user.connection.update({ user_id: event.user, status: 'disconnected' });
});
  1. Confirm event.subtype, event.trigger_id, and event.user type-check without casts.
  2. Click Connect on the app's profile and confirm the user_connection event arrives with subtype: 'connect' and opens the connection modal.
  3. Open the app as a user without a recorded connection status and confirm the user_connection_status_requested event arrives and the update succeeds.

Requirements

🤖 Generated with Claude Code

Slack sends this event when it has no connection status for a user, so
apps answer with apps.user.connection.update. Adding it to SlackEvent
types the event in Bolt listeners.
@changeset-bot

changeset-bot Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b9234ac

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@slack/types Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov

codecov Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.35%. Comparing base (8730b5e) to head (b9234ac).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2783   +/-   ##
=======================================
  Coverage   89.34%   89.35%           
=======================================
  Files          65       65           
  Lines       10548    10548           
  Branches      480      480           
=======================================
+ Hits         9424     9425    +1     
+ Misses       1092     1091    -1     
  Partials       32       32           
Flag Coverage Δ
cli-hooks 89.28% <ø> (ø)
cli-test 89.28% <ø> (ø)
logger 89.28% <ø> (ø)
oauth 89.28% <ø> (ø)
socket-mode 89.28% <ø> (ø)
web-api 89.28% <ø> (ø)
webhook 89.28% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Adds UserConnectionEvent, a union of the connect and disconnect
subtypes, to SlackEvent. Checking subtype === 'connect' narrows
trigger_id to a string, so Bolt listeners can open the connection
modal without a cast. Also adds event_ts to
UserConnectionStatusRequestedEvent, which every payload carries.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@WilliamBergamin WilliamBergamin changed the title feat(types): add the user_connection_status_requested event feat(types): add the user_connection and user_connection_status_requested events Oct 22, 2026
WilliamBergamin added a commit to slack-samples/bolt-js-examples that referenced this pull request Oct 22, 2026
The listener reads subtype, trigger_id, and user straight from the
event now that slackapi/node-slack-sdk#2783 types user_connection,
so the local typedef and cast are gone.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@WilliamBergamin WilliamBergamin self-assigned this Oct 22, 2026
@WilliamBergamin WilliamBergamin added semver:minor pkg:types applies to `@slack/types` labels Oct 22, 2026
@WilliamBergamin
WilliamBergamin marked this pull request as ready for review October 22, 2026 20:37
@WilliamBergamin
WilliamBergamin requested a review from a team as a code owner October 22, 2026 20:37

@zimeg zimeg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🎁 @WilliamBergamin These changes are great and a gift for next release I think!

@zimeg zimeg added this to the types@next milestone Oct 22, 2026
@zimeg zimeg added the enhancement M-T: A feature request for new functionality label Oct 22, 2026
@WilliamBergamin
WilliamBergamin merged commit 7c310ea into main Oct 22, 2026
18 checks passed
@WilliamBergamin
WilliamBergamin deleted the feat-user-connection-status-requested-event branch October 22, 2026 20:59
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 pkg:types applies to `@slack/types` semver:minor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants