Skip to content

feat(interface): add Microsoft Teams to the Channels settings UI#608

Draft
slvnlrt wants to merge 8 commits into
spacedriveapp:mainfrom
slvnlrt:pr/teams-channels-ui
Draft

feat(interface): add Microsoft Teams to the Channels settings UI#608
slvnlrt wants to merge 8 commits into
spacedriveapp:mainfrom
slvnlrt:pr/teams-channels-ui

Conversation

@slvnlrt

@slvnlrt slvnlrt commented Jun 29, 2026

Copy link
Copy Markdown

Draft — stacked on #607. This PR is opened for visibility. It is branched on top of #607 (the Teams adapter), so until #607 merges the diff below also shows #607's commits. Once #607 lands I will rebase this onto main so the diff is the UI changes only, then mark it ready. Review only the last commit (feat(interface): add Microsoft Teams to the Channels settings UI) for now.

What

Adds Microsoft Teams to the Channels settings UI, so a Teams bot can be connected, updated, and removed from Settings → Channels like the other single-instance adapters.

Changes

  • Frontend: a Teams credential form (App ID, Client Secret masked, Tenant ID), the platform catalog entry and Microsoft icon, and single-instance gating (one Teams bot, matching the adapter).
  • Messaging API: create / delete / status handlers for Teams. The create handler writes the [messaging.teams] config; the config watcher (added with the adapter in feat(messaging): add Microsoft Teams channel adapter #607) starts it. Regenerates the OpenAPI TypeScript bindings (schema.d.ts).
  • Docs: adds the Spacebot UI tab to the Teams setup guide.

Verification

  • just gate-pr passes (969 lib tests, cargo check --all-targets, clippy, fmt, and the typegen schema diff).
  • The connect → config-write → watcher-start → status flow was exercised end to end.

Notes

Note

Frontend and API handlers for Teams channel management in Settings. The UI adds a credential form (App ID, Client Secret, Tenant ID) with single-instance gating, while the backend provides create/delete/status endpoints that wire to the config and watcher. Also updates the Teams setup guide with Spacebot UI instructions.

Written by Tembo for commit 3aa699d. This will update automatically on new commits.

Add a Microsoft Teams channel adapter built on the Azure Bot Service /
Bot Framework Connector protocol.

Inbound: an axum webhook server (POST /api/messages) validates the
Azure-signed JWT (RS256, JWKS from login.botframework.com, iss/aud/exp),
parses Activities into InboundMessage, and enforces per-conversation
permissions (DM allowlist with a "*" wildcard; channels open on @mention).

Outbound: replies and proactive broadcasts go to the Bot Connector with an
Azure AD client-credentials token, guarded by a serviceUrl SSRF allowlist
(*.botframework.com / *.trafficmanager.net), with a per-conversation
serviceUrl sidecar so proactive sends survive restarts.

Capabilities: text and @mentions; Adaptive Cards and card buttons
(interactive_elements render as Action.Submit; a click returns as
MessageContent::Interaction); a typing indicator; inbound file and image
attachments (MessageContent::Media, with the download bearer gated to
allowlisted hosts).

Config: a [messaging.teams] section (shaped like the other adapters),
hot-reloadable permissions via the config watcher, and the client secret
sourced from the environment. Setup guide in docs/content/docs/(messaging).

Adds one dependency, jsonwebtoken (ring-based). One Teams bot per instance.
@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 70f8d5e1-0b1a-4ad8-86f9-561d837bba92

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

slvnlrt added 3 commits June 29, 2026 12:04
…ing, doc

- target.rs: Teams runs a single listener in v1, so broadcast/delivery target
  resolution always uses the adapter "teams" and keeps the full conversation id
  (colons preserved). Drop the instance-name heuristic that misread opaque ids
  like a DM "a:1-..." as a named instance "teams:a" and mis-routed proactive
  sends to a non-existent adapter. Update tests; add DM-id regressions.
- watcher.rs: warn on named [[messaging.teams.instances]] during hot reload,
  matching cold start (named instances are not started in v1).
- permissions.rs: correct the dm_allowed_users doc to match the actual compare
  target (the inbound activity.from.id MRI), not AAD object IDs.

Note: the hot-reload "fail-open on disable" raised in review is the shared
behavior of every adapter (removing config never stops a running adapter), not
Teams-specific; tightening only Teams would break cross-adapter parity, so it
is intentionally out of scope here.
Collapse a nested if in card_to_adaptive and annotate build_teams_adapter
with #[allow(clippy::too_many_arguments)] (discrete args mirror
TeamsAdapter::new). Keeps the clippy-all gate clean.
Connect, update, and remove a Teams bot from Settings -> Channels, matching
the other single-instance adapters.

- Frontend: a Teams credential form (App ID, Client Secret, Tenant ID),
  the platform catalog entry and icon, and single-instance gating.
- Messaging API: create / delete / status handlers for Teams. The create
  handler writes the [messaging.teams] config; the config watcher (added
  with the adapter) starts it. Regenerates the OpenAPI TypeScript bindings.
- Docs: adds the Spacebot UI tab to the Teams setup guide.
@slvnlrt slvnlrt force-pushed the pr/teams-channels-ui branch from 3aa699d to 3ed9334 Compare June 29, 2026 10:17
slvnlrt added a commit to slvnlrt/spacebot that referenced this pull request Jun 29, 2026
Mirror the fixes landed on the upstream PR branches (spacedriveapp#607/spacedriveapp#608):
- target.rs: single-instance broadcast/delivery routing — the adapter is
  always "teams" and the full conversation id is preserved; no instance is
  inferred from opaque ids (a DM "a:1-..." was misread as "teams:a"). Tests
  updated + DM-id regressions added.
- watcher.rs: warn on named [[messaging.teams.instances]] during hot reload.
- permissions.rs: dm_allowed_users doc now matches the actual compare target
  (the inbound activity.from.id MRI).
- teams.rs + api/messaging.rs: clippy cleanups (collapsible-if, too_many_arguments).
slvnlrt added a commit to slvnlrt/spacebot that referenced this pull request Jun 29, 2026
…acklog

Roadmap: add an 'Upstream delivery' block (spacedriveapp#605/spacedriveapp#607/spacedriveapp#608 + state) and a
single 'Deferred / out-of-scope — tracked backlog' table (outbound/inbound
reactions, select menus, streaming, multi-bot, v3 approval cards, the
cross-adapter hot-reload teardown follow-up from the spacedriveapp#607 review, richer
identity, facilitation). Handoff: refresh TL;DR/NEXT/branch-map for the
upstreaming state (HEADs, the three PR branches).
slvnlrt added a commit to slvnlrt/spacebot that referenced this pull request Jun 29, 2026
Plan for the Download-Teams-app-package feature (spacedriveapp#608): backend builder
(manifest + Spacebot icons via image crate + zip) + endpoint + UI button +
doc. Opus review applied: drop speculative permissions field, src/api.rs
module decl, mandatory Query import, ZipArchive reader, &instance_dir deref,
mdx-exists-on-spacedriveapp#608. Executes on pr/teams-channels-ui.
slvnlrt added a commit to slvnlrt/spacebot that referenced this pull request Jun 29, 2026
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.

1 participant