Skip to content

feat: add Slack connector plugin - #24

Open
mgd43b wants to merge 3 commits into
joungminsung:mainfrom
mgd43b:claude/github-issue-2-ffd914
Open

feat: add Slack connector plugin#24
mgd43b wants to merge 3 commits into
joungminsung:mainfrom
mgd43b:claude/github-issue-2-ffd914

Conversation

@mgd43b

@mgd43b mgd43b commented Aug 9, 2026

Copy link
Copy Markdown

Summary

Adds @opendocuments/connector-slack, which indexes public Slack channels as one document per channel, rendered as a chronological transcript with resolved author names, thread replies, and attachment text.

  • discover()conversations.list with cursor pagination, filtered by the configured channels (accepts #general, general, or C0123456789)
  • fetch()conversations.history + conversations.replies, with users.list resolving author IDs and <@U123> mentions to display names; <#C1|name>, <url|label>, <!here> and HTML entities are unwrapped too
  • Handles the two things Slack does differently from the other connectors here: failures arrive as HTTP 200 with ok: false, and throttling arrives as HTTP 429 with Retry-After (bounded retry, capped delay)
  • Membership join/leave noise is dropped; maxMessages caps history reads and logs when it truncates

Config is { token, channels?, syncInterval } as requested in the issue, plus optional maxMessages (default 1000) and includeThreads (default true). The token falls back to SLACK_TOKEN. Required scopes: channels:read and channels:history; users:read is optional and only improves author names — without it the transcript keeps raw user IDs rather than failing the sync.

Wired into the server bootstrap connector map, the admin connector allowlist, the CLI dependency set, and the Web UI connectors page (English + Korean strings).

Note on the previous removal

A Slack connector was deleted in 6358786, with packages/server/tests/unsupported-connectors.test.ts guarding its return. Per docs/superpowers/plans/2026-06-25-remove-unsupported-connectors.md, the rule was to remove "connector packages that exist in the workspace but are not supported by the product bootstrap, CLI presets, or official docs" — an orphan cleanup, not a decision against Slack. This connector is wired into all three, so it leaves that denylist (discord/jira/linear stay, and the test now carries a comment explaining the rule).

Type of Change

  • New feature
  • Documentation update

Related Issue

Closes #2

Checklist

  • Tests added/updated for changes
  • Documentation updated (if adding features)
  • npx changeset run for user-facing changes
  • npm run typecheck passes
  • npm run test passes
  • No new any types introduced
  • Error messages are actionable (include what went wrong + how to fix)

Breaking Changes

None.

Test Plan

18 new tests in plugins/connector-slack/tests/slack.test.ts, all against a routed vi.stubGlobal('fetch', ...) mock that dispatches by Slack method name — no network. They cover metadata, the missing-token and invalid_auth health paths, SLACK_TOKEN fallback, cursor pagination, channel filtering, revision reporting, transcript ordering, thread replies, join/leave filtering, markup unwrapping, attachment/file text, the users.list fallback, the maxMessages cap, 429 retry, and HTTP failures.

npm run build      # 27 tasks pass
npm run typecheck  # 52 tasks pass
npm run test       # 53 tasks pass, 666 tests (+18)

Connector plugin tests: 42 -> 60.

Index public Slack channels as one document per channel, rendered as a
chronological transcript with resolved author names, thread replies, and
attachment text.

- conversations.list/history/replies with cursor pagination
- users.list resolves author IDs and <@U...> mentions to display names
- retries on HTTP 429 honoring Retry-After, and surfaces Slack's
  HTTP 200 + ok:false failures as errors
- maxMessages caps history reads and logs when it truncates

Wires the connector into the server bootstrap map, the admin connector
allowlist, the CLI dependency set, and the Web UI connectors page (en/ko).
Slack was previously removed for not being wired into the supported
surface; that wiring now exists, so it leaves the unsupported-connector
guard list.

Closes joungminsung#2
Copilot AI lite review requested due to automatic review settings August 9, 2026 14:00
Adding a connector requires the type to appear in the bootstrap map, the
admin allowlist, and the CLI dependencies, and nothing checked those
against each other - a missed entry showed up as a 400 from the Web UI
or a connector that was silently invisible.

Export CONNECTOR_PLUGINS_MAP and CONFIGURABLE_CONNECTOR_TYPES, and assert
every configurable type is mapped, every mapped package is a CLI
dependency, and every mapped package resolves to a connector plugin.

Also record the Slack connector in the README improvement lists.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds a first-class Slack connector plugin to the OpenDocuments plugin ecosystem, wiring it through server bootstrap/configuration, CLI deps, Web UI configuration, and documentation so public Slack channels can be indexed as per-channel transcript documents.

Changes:

  • Introduce @opendocuments/connector-slack with Slack Web API pagination, transcript rendering (threads/mentions/attachments), and bounded 429 retry handling.
  • Wire the new connector into server bootstrap + admin allowlist, CLI dependency preset, and Web UI connector configuration + i18n.
  • Update README/docs/changeset to document Slack as a supported source and reflect updated package/test counts.

Reviewed changes

Copilot reviewed 23 out of 24 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
README.md Adds Slack to supported sources and updates connector plugin/test counts.
README.ko.md Adds Slack to supported sources and updates connector plugin/test counts (Korean).
plugins/connector-slack/vitest.config.ts Adds Vitest config for the new plugin’s test suite.
plugins/connector-slack/tsconfig.json Adds TS build/typecheck config for the new plugin.
plugins/connector-slack/tests/slack.test.ts Adds mocked-fetch integration tests covering Slack connector behavior.
plugins/connector-slack/src/index.ts Implements Slack connector (discover/fetch, transcript rendering, retry/throttle handling).
plugins/connector-slack/package.json Declares the new plugin package metadata, scripts, and dependencies.
packages/web/src/lib/i18n.ts Adds Slack connector name/help text and “channels” field labels (EN/KR).
packages/web/src/lib/api.ts Allows 'slack' as a configurable connector type for the admin connect API.
packages/web/src/components/connectors/ConnectorsPage.tsx Adds Slack connector fields (token + channels) and form-to-config parsing.
packages/server/tests/unsupported-connectors.test.ts Removes Slack from the “unsupported connector packages” denylist and documents the rule.
packages/server/src/http/routes/admin.ts Adds slack to the configurable connector allowlist.
packages/server/src/bootstrap.ts Registers slack -> @opendocuments/connector-slack in the connector bootstrap map.
packages/cli/package.json Adds Slack connector to the CLI’s bundled connector dependencies.
package-lock.json Updates lockfile to include the new workspace plugin.
docs/pipeline.ko.md Documents the Slack connector in the Korean pipeline docs.
docs-site/plugins/connector-api.md Includes Slack connector in connector API examples/listing.
docs-site/index.md Updates plugin ecosystem counts/listing on the docs-site home page.
docs-site/guide/deployment.md Adds SLACK_TOKEN to the deployment environment variable guidance.
docs-site/guide/configuration.md Adds Slack connector config example and SLACK_TOKEN env var entry.
CONTRIBUTING.md Lists the Slack connector in the repository structure overview.
AGENTS.md Updates plugin counts and test task/test totals for repo overview/checklists.
.changeset/slack-connector.md Adds a changeset bumping CLI/server for the new Slack connector feature.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread docs-site/index.md
Comment on lines 29 to 32
src: /icons/plugin.svg
title: Plugin Ecosystem
details: 21 installable packages — 8 parsers (PDF, DOCX, code, Jupyter), 8 connectors (GitHub, Notion, Drive), and 5 AI model providers.
details: 22 installable packages — 8 parsers (PDF, DOCX, code, Jupyter), 9 connectors (GitHub, Notion, Drive, Slack), and 5 AI model providers.
- icon:
- Skip channels the app has not joined. conversations.list returns every
  public channel, but conversations.history only works where the app is a
  member, so a workspace with 400 channels and a bot in 3 produced 397
  not_in_channel errors and wasted calls on every sync.
- Guard formatTimestamp against finite-but-out-of-range values. Number
  .isFinite passed them through to toISOString(), which throws RangeError
  and discarded the whole channel transcript.
- Retry the user directory after a cooldown instead of latching the
  failure. A single transient users.list error degraded author names to
  raw IDs for the lifetime of the process.
- Bound thread reply pagination with maxThreadReplies. maxMessages capped
  history only, so one 20k-reply thread ran unbounded past the limit.
- Split channel config on whitespace and report entries that match no
  channel, so a typo no longer looks like an empty workspace.
- Declare the connector packages as server devDependencies. The wiring
  test imported build output turbo never produced for that filter, so
  `turbo test --filter=opendocuments-server` failed on a clean tree.

Slack plugin tests 18 -> 25.
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.

Add Slack connector plugin

2 participants