mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-25 07:00:48 +09:00
feat(platform): add slack platform support (#385)
* feat(platform): add slack platform support * docs: add slack channel setup guide * feat: normalize slack unicode reactions * chore(docs): remove unsupport feature * fix(slack): harden adapter stream and identity handling - ignore reaction and speech stream events in Slack outbound streams - normalize Slack conversation types to framework-standard values - route DiscoverSelf through the adapter API factory - add config-scoped Slack user display-name caching - expand adapter interface assertions and add regression coverage - add ChannelTypeSlack to well-known channel constants
This commit is contained in:
@@ -175,6 +175,10 @@ export const en = [
|
||||
text: 'WeChat Official Account',
|
||||
link: '/channels/wechatoa.md'
|
||||
},
|
||||
{
|
||||
text: 'Slack',
|
||||
link: '/channels/slack.md'
|
||||
}
|
||||
]
|
||||
},
|
||||
]
|
||||
|
||||
@@ -4,6 +4,7 @@ Channels are the gateways that connect your Memoh Bots to the outside world. By
|
||||
|
||||
Memoh currently supports the following channels:
|
||||
|
||||
- **[Slack](./slack)**: Workspace messaging with Socket Mode, threads, files, and reactions.
|
||||
- **[Telegram](./telegram)**: Feature-rich integration with streaming and attachment support.
|
||||
- **[Feishu (Lark)](./feishu)**: Enterprise-ready integration for business workflows.
|
||||
- **[Discord](./discord)**: Community-focused integration for servers and direct messages.
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
# Slack Channel Configuration
|
||||
|
||||
Connecting your Memoh Bot to Slack allows it to receive direct messages, participate in channels and threads, read attachments, send files, and use streaming replies.
|
||||
|
||||
## Step 1: Create a Slack App
|
||||
|
||||
1. Go to the Slack API dashboard and create a new app.
|
||||
2. Choose the workspace where you want to install the bot.
|
||||
3. Open **Basic Information** and keep this app page open for the next steps.
|
||||
|
||||
## Step 2: Enable Socket Mode
|
||||
|
||||
Memoh's Slack adapter uses Socket Mode, so you need an app-level token in addition to the bot token.
|
||||
|
||||
1. In **Basic Information**, enable **Socket Mode**.
|
||||
2. Create an **App-Level Token** with the `connections:write` scope.
|
||||
3. Copy the generated token. It starts with `xapp-`.
|
||||
|
||||
## Step 3: Configure Bot Token Scopes
|
||||
|
||||
In **OAuth & Permissions**, add the bot token scopes required by the current Slack adapter:
|
||||
|
||||
- `app_mentions:read` - receive bot mentions in channels
|
||||
- `channels:history` - read messages in public channels
|
||||
- `groups:history` - read messages in private channels
|
||||
- `im:history` - read direct messages
|
||||
- `mpim:history` - read group direct messages
|
||||
- `chat:write` - send replies and thread messages
|
||||
- `files:read` - read uploaded files and images
|
||||
- `files:write` - upload outbound files
|
||||
- `reactions:write` - add and remove reactions
|
||||
|
||||
You should also add these recommended scopes if you want Slack conversation names and metadata to show up more completely in Memoh:
|
||||
|
||||
- `channels:read`
|
||||
- `groups:read`
|
||||
- `im:read`
|
||||
- `mpim:read`
|
||||
|
||||
## Step 4: Subscribe to Bot Events
|
||||
|
||||
In **Event Subscriptions**, enable bot events and add:
|
||||
|
||||
- `app_mention`
|
||||
- `message.channels`
|
||||
- `message.groups`
|
||||
- `message.im`
|
||||
- `message.mpim`
|
||||
|
||||
These are the inbound event types currently handled by the Slack adapter.
|
||||
|
||||
## Step 5: Install the App to Your Workspace
|
||||
|
||||
1. In **OAuth & Permissions**, click **Install to Workspace**.
|
||||
2. Review the permission screen.
|
||||
3. Authorize the app.
|
||||
4. Copy the **Bot User OAuth Token**. It starts with `xoxb-`.
|
||||
|
||||
Make sure the `xoxb-...` bot token and the `xapp-...` app-level token come from the same Slack app and workspace.
|
||||
|
||||
## Step 6: Configure Memoh
|
||||
|
||||
1. Open your Bot detail page in the Memoh Web UI.
|
||||
2. Go to the **Platforms** tab.
|
||||
3. Click **Add Channel** and select **Slack**.
|
||||
4. Fill in:
|
||||
- **Bot Token**: your `xoxb-...` token
|
||||
- **App-Level Token**: your `xapp-...` token
|
||||
5. Click **Save and Enable**.
|
||||
|
||||
## Step 7: Add the Bot to Conversations
|
||||
|
||||
After the channel is enabled, the Slack app still needs to be present in the conversations where you want it to work.
|
||||
|
||||
- For direct messages: open a DM with the app and send a message.
|
||||
- For public channels: invite the bot to the channel.
|
||||
- For private channels: invite the bot explicitly after installation.
|
||||
|
||||
If the bot can send messages but cannot read uploaded images or files, check that `files:read` is enabled. If it connects but receives no incoming messages, check the bot events and the matching history scopes again.
|
||||
|
||||
## Features Supported
|
||||
|
||||
- **Direct Messages and Channels**: Support for DMs, public channels, private channels, and threads.
|
||||
- **Attachments**: Read uploaded images and files from Slack, and send files back.
|
||||
@@ -26,6 +26,7 @@ Configure your bot's connections from the **Platforms** tab in the Bot Detail pa
|
||||
| WeCom (WeWork) | [WeCom Configuration](/channels/wecom) | Enterprise workspace integration |
|
||||
| WeChat | [WeChat Configuration](/channels/weixin) | Personal QR login flow |
|
||||
| WeChat Official Account | [WeChat Official Account Configuration](/channels/wechatoa) | Official account webhook flow |
|
||||
| Slack | [Slack Configuration](/channels/slack) | Replies, no streaming |
|
||||
|
||||
Two WeChat adapters exist on purpose:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user