Slack Bot Token Storage & Installation Store Prompt
Design a secure installation store for a multi-workspace Slack app — encrypted token persistence, OAuth install/uninstall lifecycle, and token-rotation handling in Bolt.
- Target user
- Backend engineers operating a distributed Slack app
- Difficulty
- Advanced
- Tools
- Claude, Cursor
The prompt
You are a senior backend engineer who runs a distributed, multi-workspace Slack app and treats tokens as crown jewels. I will provide: - The Bolt runtime and current InstallationStore (if any) - The datastore available (Postgres, DynamoDB, Redis, secrets manager) - Whether token rotation is enabled on the app - The scopes requested and number of installed workspaces - Current pain (tokens in env vars, no uninstall cleanup, single-workspace assumptions) Your job: 1. **Installation model** — design the record per team and per enterprise (Enterprise Grid org installs), keyed by team id / enterprise id and storing bot token, bot user id, scopes, and install metadata. 2. **Encryption at rest** — encrypt tokens with envelope encryption (KMS/secrets manager data key); never store plaintext tokens or signing secrets in the app DB or logs. 3. **OAuth lifecycle** — implement `installationStore.storeInstallation` / `fetchInstallation` / `deleteInstallation`; handle the `app_uninstalled` and `tokens_revoked` events to purge records. 4. **Token rotation** — if rotation is enabled, persist refresh tokens, refresh before expiry, and handle the race where two requests refresh concurrently (single-flight). 5. **Per-tenant isolation** — ensure one workspace can never read another's token; scope all lookups by the verified team/enterprise id from the request. 6. **Operational concerns** — backup, key rotation, and an audit log of token reads. Output as: (a) the installation record schema, (b) InstallationStore method pseudocode including rotation, (c) the encryption and key-management design, (d) the uninstall/revoke cleanup flow. Default to least scope and short-lived tokens; if a token cannot be decrypted or refreshed, fail the request rather than fall back to a cached plaintext copy.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
Slack App Distribution & Multi-Workspace OAuth Prompt
Design a publicly distributable Slack app: OAuth v2 install flow, per-workspace token storage, App Directory submission readiness, and tenant isolation for a SaaS bot.
-
Slack OAuth Token Security & Rotation Prompt
Audit, secure, and rotate Slack OAuth tokens (bot, user, granular) across services — inventory, threat model, rotation cadence, secret manager integration, and dual-active migration.
-
Slack Bolt 3-Second Ack Timeout Discipline Prompt
Audit and redesign Bolt listeners so every interaction acks within 3 seconds and slow work moves off the request path, eliminating dispatch_failed and operation_timeout errors.
-
Slack Bolt Listener Concurrency & Work Queue Prompt
Design concurrency control and a work queue for Bolt listeners so a burst of interactions doesn't exhaust connections, blow rate limits, or starve the event loop.
More Slack prompts & error guides
Browse every Slack prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.