Skip to content

feat: refactor consumer routes to be provider-agnostic#16

Merged
kopahead merged 1 commit intomainfrom
feat/agnostic-consumer-routes
Apr 26, 2026
Merged

feat: refactor consumer routes to be provider-agnostic#16
kopahead merged 1 commit intomainfrom
feat/agnostic-consumer-routes

Conversation

@kopahead
Copy link
Copy Markdown
Contributor

Summary

  • Replace Slack-specific connector routes with generic consumer routes that accept a type parameter
  • Add consumer type registry pattern: new consumer types (WhatsApp, Discord, webhook) plug in without new routes
  • Replace hardcoded SECRET_KEYS list with pattern-based secret detection
  • Make ConsumerConfig generic instead of having explicit slack/api properties

Routes changed

Before After
POST /api/connectors/slack-channel POST /api/connectors/consumer/channel (with type field)
POST /api/connectors/slack POST /api/connectors/consumer (with type + credentials fields)
POST /api/org/integrations/slack/test POST /api/org/integrations/test (with type + credentials fields)

Files changed

  • src/routes/connectors.ts — consumer type registry, generic routes
  • src/routes/org.ts — generic integration test endpoint, pattern-based secret detection
  • src/shared/types.ts — generic ConsumerConfig type
  • src/core/workspace.ts — generic channel ownership check

Breaking change

This changes the API contract. SDK and dashboard will need updates to use the new route paths and request shapes.

Closes #13

Replace Slack-specific routes with generic consumer routes:
- POST /api/connectors/slack-channel -> POST /api/connectors/consumer/channel
- POST /api/connectors/slack -> POST /api/connectors/consumer
- POST /api/org/integrations/slack/test -> POST /api/org/integrations/test

All three routes now accept a `type` parameter. Consumer types register
handlers via a consumerTypes registry in connectors.ts and
integrationTesters registry in org.ts. New consumer types plug in
without new routes.

Replace hardcoded SECRET_KEYS list with pattern-based detection
(keys containing token, secret, api_key, or password).

Make ConsumerConfig generic (Record<string, ConsumerTypeConfig>)
instead of having explicit slack/api properties.

Update workspace.ts ownsChannel() and channel count logging to work
with the generic consumer config.

Closes #13

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@kopahead kopahead merged commit 76fbd8b into main Apr 26, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor consumer routes to be provider-agnostic

1 participant