Skip to content

Conversation

@HamedMP
Copy link
Member

@HamedMP HamedMP commented Jan 26, 2026

Summary

  • Adds Discord adapter using discord.js with guild/channel configuration
  • Adds WhatsApp adapter using Baileys with QR-based authentication
  • Adds Slack adapter using Bolt SDK with socket mode support
  • Adds Signal adapter using signal-cli daemon with SSE
  • Comprehensive documentation for all channels in docs/channels/

All adapters implement:

  • Pairing flow for DM security
  • Group policy support
  • Message chunking per platform limits

Test plan

  • TypeScript compiles without errors
  • All 213 tests pass
  • Lint passes (warnings only for intentional console.log)
  • Manual test with real accounts (planned)

Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added Discord, Signal, Slack, and WhatsApp channel integrations for multi-platform messaging support.
  • Documentation

    • Added comprehensive integration guides for all supported channels, including configuration, features, and troubleshooting.
  • Updates

    • Updated project roadmap and implementation status to reflect expanded channel support completion.

✏️ Tip: You can customize this high-level summary in your review settings.

- Discord: discord.js with guild/channel config, pairing flow
- WhatsApp: Baileys with QR auth, session persistence
- Slack: Bolt SDK with socket mode, channel config
- Signal: signal-cli daemon with SSE, pairing flow

All adapters implement the ChannelAdapter interface with:
- Pairing flow for DM security
- Group policy support
- Message chunking per platform limits

Also adds comprehensive documentation in docs/channels/
@coderabbitai
Copy link

coderabbitai bot commented Jan 26, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

This pull request introduces comprehensive channel adapter implementations for Discord, Signal, Slack, and WhatsApp alongside existing Telegram support, along with extensive documentation, configuration schemas, and package exports. The adapters implement a unified ChannelAdapter interface for managing connections, sending/receiving messages, and pairing-based sender approval across different messaging platforms.

Changes

Cohort / File(s) Summary
Documentation: Channel Overview & Setup
docs/channels/overview.md
New overview page for channel integration with security model (pairing, allowlist, open, disabled), session routing, and multiple channel examples.
Channel Documentation: Telegram
docs/channels/telegram.md
New Telegram integration guide covering setup, configuration schema, feature matrix, access control policies, and troubleshooting.
Channel Documentation: Discord
docs/channels/discord.md
New Discord integration guide with quick setup, config schema (DiscordConfig, GuildConfig), feature support, intents, per-guild configuration, message chunking, and troubleshooting.
Channel Documentation: WhatsApp
docs/channels/whatsapp.md
New WhatsApp integration guide detailing setup, configuration, features, authentication flow, group behavior, pairing, and session persistence.
Channel Documentation: Slack
docs/channels/slack.md
New Slack integration guide with setup steps, configuration schema, supported features (DMs, channels, threads, reactions, commands), OAuth scopes, and Socket Mode guidance.
Channel Documentation: Signal
docs/channels/signal.md
New Signal integration guide covering signal-cli setup, TypeScript config schema, feature support, external daemon mode, access control, and troubleshooting.
Documentation Navigation & Development
docs/docs.json, CLAUDE.md
Added "Channels" navigation group with all six channel pages; updated CLAUDE.md with Channel Adapter Structure, implementation table, procedure for adding new channels, and status updates (Phase 1 MVP in progress).
Package Configuration & Exports
packages/channels/package.json, packages/channels/src/index.ts
Added new exports for discord, whatsapp, slack, signal adapters; changed build script from bun to tsc; added runtime dependencies (@slack/bolt, @whiskeysockets/baileys, discord.js).
Discord Adapter Implementation
packages/channels/src/adapters/discord/adapter.ts, ...discord/config.ts, ...discord/index.ts
New Discord adapter (423 lines) implementing ChannelAdapter with bot token configuration, allowlist-based sender verification, pairing flow (1-hour code expiry), message chunking for 2000-char limit, DM/guild/channel/thread support, and attachment extraction with type inference. Includes config interfaces DiscordConfig, DiscordGuildConfig with defaults and factory.
Signal Adapter Implementation
packages/channels/src/adapters/signal/adapter.ts, ...signal/config.ts, ...signal/index.ts
New Signal adapter (432 lines) with signal-cli daemon integration, SSE event streaming, message sending to HTTP API, inbound message handling with chat type detection, pairing-based access control, attachment support, and policy enforcement. Config includes SignalConfig interface with phoneNumber, daemon settings, and factory.
Slack Adapter Implementation
packages/channels/src/adapters/slack/adapter.ts, ...slack/config.ts, ...slack/index.ts
New Slack adapter (405 lines) using @slack/bolt with lifecycle management, message routing (handleMessage, handleMention), pairing-based sender approval, per-channel processing rules, socket/HTTP mode support, and inbound handler dispatch. Includes SlackConfig and SlackChannelConfig interfaces with defaults.
WhatsApp Adapter Implementation
packages/channels/src/adapters/whatsapp/adapter.ts, ...whatsapp/config.ts, ...whatsapp/index.ts
New WhatsApp adapter (366 lines) using Baileys with dynamic import, auth state management, QR print support, connection lifecycle handling, message filtering (self/non-message exclusion), chat type derivation, policy enforcement, pairing workflow with code expiry and request caps, and attachment handling. Includes WhatsAppConfig with sessionPath, policies, and factory.
Spec & Roadmap Updates
specs/003-channels/spec.md, specs/ROADMAP.md
Bumped 003-channels spec version 0.1.0→0.2.0, status Draft→Implemented; added implementation status table with test counts; moved 003-channels to DONE with all 5 adapters (Telegram, Discord, WhatsApp, Slack, Signal); updated ROADMAP next action priority from 004-tools-skills to 008-cli.
Housekeeping
packages/channels/src/manager.ts
Removed unused InboundMessage import.

Sequence Diagram(s)

sequenceDiagram
    actor App as Application
    participant CA as Channel Adapter<br/>(Discord/Signal/Slack/WhatsApp)
    participant Service as External Service<br/>(Platform API/Daemon)
    actor User as External User

    rect rgba(100, 150, 200, 0.5)
    Note over App,Service: Initialization & Connection
    App->>CA: initialize(config)
    CA->>CA: populate allowlist & config
    App->>CA: connect()
    CA->>Service: establish connection<br/>(token/daemon/socket)
    Service-->>CA: connection established
    CA->>App: ready
    end

    rect rgba(100, 200, 100, 0.5)
    Note over App,Service: Outbound Message Flow
    App->>CA: send(message)
    CA->>CA: validate recipient
    CA->>Service: post message<br/>(chunk if needed)
    Service-->>CA: messageId, timestamp
    CA->>App: SendResult
    end

    rect rgba(200, 150, 100, 0.5)
    Note over CA,User: Inbound Message Flow
    User->>Service: send message
    Service-->>CA: event/webhook/stream
    CA->>CA: parse & construct<br/>InboundMessage
    CA->>CA: validate sender<br/>(allowlist/policy)
    CA->>App: dispatch to handlers
    App-->>CA: handler response
    CA->>Service: send reply/ACK
    end

    rect rgba(200, 100, 150, 0.5)
    Note over CA,User: Pairing Flow (First-Time)
    User->>CA: request pairing<br/>(message to bot)
    CA->>CA: generate code<br/>(expires 1hr)
    CA->>User: send pairing code
    User->>App: admin approves code
    App->>CA: approvePairing(code)
    CA->>CA: add sender to allowlist
    CA-->>User: pairing confirmed
    end

    rect rgba(150, 100, 200, 0.5)
    Note over App,Service: Cleanup
    App->>CA: disconnect()
    CA->>Service: close connection
    CA->>App: disconnected
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

The review complexity is driven by four substantial, heterogeneous adapter implementations (~1,500 lines) across different platforms (Discord.js, signal-cli, Slack Bolt, Baileys) with diverse patterns (daemon spawning, SSE streaming, socket mode, dynamic imports). Each adapter requires separate reasoning for event handling, security (pairing, allowlist enforcement), attachment mapping, policy application, and error handling. Supporting documentation, configuration schemas, and package-level changes add additional breadth. The similar structure across adapters provides some consistency but does not reduce the need to verify each platform-specific implementation and its integration points.

Poem

🐰 Four new channels join the warren's call,
Discord, Signal, Slack, and WhatsApp's hall—
Each with pairing codes and safety's guard,
Messages chunked, allowlists charred,
A rabbit's dream of connectivity, complete! 🌟

✨ Finishing touches
  • 📝 Generate docstrings

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 and usage tips.

@HamedMP HamedMP merged commit ca809f3 into main Jan 26, 2026
8 of 9 checks passed
@claude
Copy link

claude bot commented Jan 26, 2026

Code Review

I found 3 instances where any type is used instead of proper types or unknown, which violates the CLAUDE.md TypeScript guidelines:

Avoid any - use proper types or unknown

Issues Found:

  1. packages/channels/src/adapters/slack/adapter.ts:93

    • app.message(async (args: any) => {
    • Should use proper type from @slack/bolt (e.g., SlackEventMiddlewareArgs<"message">) or at minimum unknown
  2. packages/channels/src/adapters/slack/adapter.ts:101

    • app.event('app_mention', async (args: any) => {
    • Should use proper type from @slack/bolt (e.g., SlackEventMiddlewareArgs<"app_mention">) or at minimum unknown
  3. packages/channels/src/adapters/whatsapp/adapter.ts:85

    • sock.ev.on('connection.update', (update: any) => {
    • Since you're immediately using type assertion, consider using unknown instead:
    sock.ev.on('connection.update', (update: unknown) => {
      const conn = update as { connection?: { state?: string } };
      // ...
    });

All three instances have ESLint disable comments, indicating awareness of the violation. Using proper types or unknown maintains type safety while following project guidelines.

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