Skip to content

feat(channel): add Slack Socket Mode channel plugin - #743

Open
mtxr wants to merge 8 commits into
iOfficeAI:mainfrom
mtxr:feat/slack-channel
Open

feat(channel): add Slack Socket Mode channel plugin#743
mtxr wants to merge 8 commits into
iOfficeAI:mainfrom
mtxr:feat/slack-channel

Conversation

@mtxr

@mtxr mtxr commented Aug 1, 2026

Copy link
Copy Markdown

Description

Adds a first-party Slack channel plugin using Socket Mode (WebSocket; no public URL).

Behavior

  • Credentials: bot token (xoxb-… via credentials.token) + app-level token (xapp-… via credentials.app_token, connections:write)
  • Config: optional allowed_channels (comma-separated C…/G…); empty = DM-only
  • Channels: only allowlisted IDs and only when @mentioned / app_mention
  • DMs: accepted after the shared pairing flow (same as Telegram/Lark/DingTalk)
  • Threads: each Slack thread is its own session (chat_id = channel:thread_root)
  • Formatting: outbound Markdown converted to Slack mrkdwn
  • Source: conversations tagged ConversationSource::Slack
  • Titles: composite chat IDs include a thread suffix so threads in the same DM do not collide in the sidebar

Types (types.rs)

Additive optional fields only (app_token, allowed_channels, skip_serializing_if). Other platforms continue to ignore them; no behavior change for Telegram/Lark/DingTalk/Weixin.

Feature flag

  • aionui-channel/slack and aionui-app default features include slack so desktop builds get the plugin without a separate flag dance.

Related Issues

  • N/A (feature addition)

Type of Change

  • feat — New feature (non-breaking change which adds functionality)

Atomic PR Checklist

  • This PR contains exactly one feature (Slack channel backend)
  • The PR title follows Conventional Commit format: feat(channel): …

Local Checks

  • Unit tests for conversation naming / platform source mapping exercised during development (aionui-channel message_service tests)
  • Manual E2E on macOS: Socket Mode connect, pairing, DM + thread isolation, mrkdwn replies

Runtime Verification

  • Verified on macOS
  • Verified on Windows
  • Verified on Linux
  • Self-review of code

Additional Context

  • Companion AionUi PR (settings form + setup guide) can follow once this lands or open in parallel noting this dependency.
  • No gitignore / personal tooling changes on this branch.

mtxr added 7 commits August 1, 2026 11:24
Hermes-style Slack integration for AionCore channels:
- credentials: bot token (xoxb) + app_token (xapp) for Socket Mode
- DM: always accept (pairing still enforced upstream)
- channels/groups: only when listed in config.allowed_channels and @mentioned
- empty allowlist means DM-only (safe default)
- outbound via chat.postMessage / chat.update for streaming edits
- chat_id is the Slack conversation id (same isolation model as Telegram)

Includes unit tests for allowlist/mention policy and test-config mapping.
Drop unread serde fields and unused accessors from the Slack adapter.
Surface every inbound Slack event and accept/drop decision at info level
so missing Event Subscriptions or allowlist drops are visible in aioncore
stdout when pairing does not appear.
Match Lark/DingTalk TLS setup so Socket Mode no longer panics on
rustls 0.23 CryptoProvider auto-detection.
Map each Slack thread to its own channel session:
- top-level message opens a new session (chat_id = channel:message_ts)
- replies in that thread continue the same session
- outbound posts always set thread_ts so the bot answers inside the thread
Slack does not render standard Markdown (** / ##). Format assistant
output to Slack mrkdwn (*bold*, header lines as bold, links as <url|label>)
via format_text_for_platform so stream_relay posts render correctly.
…::Slack

Composite chat_ids (channel:thread_root) now include a thread suffix in the
sidebar name so threads in the same DM no longer collide. Map Slack to its
own conversation source instead of the generic aionui fallback.
@mtxr

mtxr commented Aug 1, 2026

Copy link
Copy Markdown
Author

I can't verify myself on windows or linux, but I used all practices that were in use already.

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