Skip to content

Comments

Add Slack messaging provider#324

Merged
239573049 merged 1 commit intoAIDotNet:mainfrom
keboola:upstream/slack-provider
Feb 21, 2026
Merged

Add Slack messaging provider#324
239573049 merged 1 commit intoAIDotNet:mainfrom
keboola:upstream/slack-provider

Conversation

@manana2520
Copy link
Contributor

Summary

Adds Slack as a new messaging provider alongside the existing Feishu, QQ, and WeChat providers. This enables users to interact with OpenDeepWiki documentation through Slack DMs and channel @mentions.

What's included

Slack Provider (Chat/Providers/Slack/)

  • SlackProvider.cs - Full provider implementation extending BaseMessageProvider
    • Events API webhook with HMAC-SHA256 request signature verification
    • Handles app_mention (channels) and message (DMs) events
    • Threaded replies to reduce channel noise
    • Automatic deduplication of channel events (Slack sends both app_mention and message)
  • SlackModels.cs - Slack API DTOs (Events API, Block Kit, Web API requests/responses)
  • SlackProviderOptions.cs - Configuration (BotToken, SigningSecret, threading, timeouts)

User Identity Mapping (Chat/Execution/ChatUserResolver.cs)

  • Maps Slack user IDs to OpenDeepWiki users via email matching
  • Calls Slack users.info API to resolve email, then looks up in Users table
  • Singleton with 30-minute in-memory cache
  • Enables permission-aware access: mapped users see public + department-assigned private repos

Multi-Repo Documentation Tool (Agents/Tools/ChatMultiRepoDocTool.cs)

  • New AI tool for messaging providers to query documentation across all accessible repositories
  • Permission-aware: filters repos based on user's department assignments
  • Three tools: ListRepositories, ListDocuments, ReadDoc

Enhanced Agent Executor

  • Updated AgentExecutor to use DeepWiki documentation tools and system prompt
  • Resolves user identity before creating tools for permission scoping

Registration & Endpoints

  • Slack webhook endpoint at POST /api/chat/webhook/slack
  • DI registration in ChatServiceExtensions.cs
  • Default configuration in appsettings.json

Slack App Setup

Required bot event subscriptions: message.channels, message.groups, message.im, app_mention
Required OAuth scopes: chat:write, channels:history, groups:history, im:history, users:read.email

* Add Slack messaging provider

Implements Slack as a new chat provider following the existing provider
pattern (Feishu, QQ, WeChat). Includes Events API webhook handling with
HMAC-SHA256 signature verification, message parsing, and chat.postMessage
sending with thread support and retry logic.

New files:
- SlackProviderOptions.cs - Provider configuration
- SlackModels.cs - Slack API DTOs (Events API, Block Kit, Web API)
- SlackProvider.cs - Main provider implementation

Modified files:
- ChatServiceExtensions.cs - Register Slack in DI container
- ChatEndpoints.cs - Add /api/chat/webhook/slack endpoint
- ChatWebhookApiService.cs - Add Slack webhook handler
- appsettings.json - Default Slack configuration (disabled)

* Fix messaging agent: DeepWiki context, reply routing, and DI issues

- Add ChatMultiRepoDocTool for multi-repo documentation queries from
  messaging providers (ListRepositories, ListDocuments, ReadDoc)
- Enhance AgentExecutor to use DeepWiki system prompt and doc tools
  instead of plain "helpful assistant" with no context
- Fix reply destination: respond in channel (ReceiverId) instead of
  always sending to user DM (SenderId)
- Propagate thread metadata (thread_ts) to response messages for
  proper Slack threading
- Fix MessageRouter singleton/scoped DI: use IServiceScopeFactory to
  resolve scoped services (SessionManager, MessageQueue)
- Change all error messages from Chinese to English

* Fix duplicate Slack responses and redundant session handling

- Filter out message events in channels (only process app_mention)
  to prevent double processing when Slack sends both event types
- Strip session management from MessageRouter.RouteIncomingAsync
  (was redundant with worker's ProcessIncomingMessageAsync)
- Only process DM message events (im/mpim channel types)

* Add permission filtering and fix status filter for messaging tools

- Only show public repos (IsPublic=true) to Slack users since there's
  no Slack-to-DeepWiki user identity mapping
- Include Processing repos (not just Completed) so partially indexed
  repos are visible
- Add IsPublic check to ListDocuments and ReadDoc tools
- Show indexing status in ListRepositories output

* Add Slack-to-DeepWiki user identity mapping for permission-aware access

Resolve Slack user IDs to DeepWiki users via email matching (Slack
users.info API -> email -> Users table). Private repositories are now
only visible to users with matching department assignments, while
public repos remain accessible to all.
@239573049 239573049 merged commit 170f9f6 into AIDotNet:main Feb 21, 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.

2 participants