Slack adapter: expose the installation a delivery was resolved through to handlers
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- Half a day
- Newbie friendliness
- 45/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- api
Research direction
Start with the requestContext AsyncLocalStorage field on SlackAdapter and where the installation is resolved per delivery from installationProvider. Add a public getter that returns the current store's installation id and bot token, and check that it is only non-empty inside handler execution. Done means a handler such as onNewMention can read the installation through thread.adapter, with a test covering that path and no subclassing needed. Confirm with maintainers first whether exposing the bot token is acceptable.
Written by the indexing model from the issue text.
Description
Package: @chat-adapter/[email protected]
Problem
With an installationProvider, the adapter resolves an installation for each delivery (from authorizations[0].team_id / team_id, or the enterprise id for org-wide installs) and keeps it, with its bot token, in the adapter's own per-delivery store: the protected readonly requestContext: AsyncLocalStorage<{ token, installationId, teamId, enterpriseId, isEnterpriseInstall, botUserId, ... }> field on SlackAdapter. Handlers (onNewMention, onSubscribedMessage, onAction, ...) cannot read it.
A multi-workspace app usually needs exactly that inside a handler: which installation (tenant) this message came through, and that installation's bot token for its own Slack Web API calls. The alternatives available to handlers are wrong or costly:
message.raw.teamis the sender's team. In a Slack Connect channel it is another company's workspace, not the one the app is installed in.- Looking the installation up again by team id means another
getInstallationround trip per message, and still needs the right team id first.
Ask: a public way for a handler to get the current delivery's installation (id and bot token), for example a getter on the adapter.
Related: #874 (the suggestedPrompts resolver missing teamId on one path), the same gap in a different place.
Workaround today
Subclass SlackAdapter and add a public getter over that field (this.requestContext.getStore()), then reach the adapter through thread.adapter in handlers. It depends on a protected field and its shape, so a test has to guard it against adapter upgrades.
- Dominant language
- TypeScript
- Stars
- 2.4k
- Forks
- 329
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 62
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from vercel/chat
-
Difficulty 3/5 1-2 days Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 38/100
Maintainers usually reply within 1 day
-
Slack adapter: dispatch `app_uninstalled` / `tokens_revoked` to `onUninstalled`Possibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 3/5 1-2 days Newbie friendliness 42/100
Maintainers usually reply within 1 day
-
Proposal: list zoom-chat-adapter as community adapter for Zoom Team ChatPossibly taken @aradhyacp claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
Maintainers usually reply within 1 day
Similar issues
-
createAI: the ai peer range allows ai@6, which the provider cannot work withPossibly taken @akhil9tiet claimed this today. Openbug
Difficulty 1/5 Under an hour Newbie friendliness 83/100
cloudflare/agents#2690 · 3 comments ·
Maintainers usually reply within 1 day
-
[fullsend] E2E: theme — global-header ignores app.branding.fullLogo (RHDHBUGS-3670)Possibly taken @fullsend-ai-coder claimed this today. Opene2e-failure ready-to-code
Difficulty 1/5 Under an hour Newbie friendliness 78/100
redhat-developer/rhdh-plugin-export-overlays#4503 · 1 comment ·
Maintainers usually reply within 1 day
-
needs triage 📥
Difficulty 1/5 Under an hour Newbie friendliness 86/100
ethereum/ethereum-org-website#19601 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
cloudscape-design/components#5184 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
agilepathway/label-checker#805 ·
Maintainers usually reply within 1 day