feat: add App Home step to Slack guide, default groupPolicy to mention

This commit is contained in:
Re-bin 2026-02-09 16:49:13 +00:00
parent 4f928e9d2a
commit ec4340d0d8
2 changed files with 18 additions and 11 deletions

View File

@ -428,13 +428,17 @@ nanobot gateway
Uses **Socket Mode** — no public URL required. Uses **Socket Mode** — no public URL required.
**1. Create a Slack app** **1. Create a Slack app**
- Go to [Slack API](https://api.slack.com/apps) → Create New App - Go to [Slack API](https://api.slack.com/apps) → **Create New App** → "From scratch"
- **OAuth & Permissions**: Add bot scopes: `chat:write`, `reactions:write`, `app_mentions:read` - Pick a name and select your workspace
- Install to your workspace and copy the **Bot Token** (`xoxb-...`)
- **Socket Mode**: Enable it and generate an **App-Level Token** (`xapp-...`) with `connections:write` scope
- **Event Subscriptions**: Subscribe to `message.im`, `message.channels`, `app_mention`
**2. Configure** **2. Configure the app**
- **Socket Mode**: Toggle ON → Generate an **App-Level Token** with `connections:write` scope → copy it (`xapp-...`)
- **OAuth & Permissions**: Add bot scopes: `chat:write`, `reactions:write`, `app_mentions:read`
- **Event Subscriptions**: Toggle ON → Subscribe to bot events: `message.im`, `message.channels`, `app_mention` → Save Changes
- **App Home**: Scroll to **Show Tabs** → Enable **Messages Tab** → Check **"Allow users to send Slash commands and messages from the messages tab"**
- **Install App**: Click **Install to Workspace** → Authorize → copy the **Bot Token** (`xoxb-...`)
**3. Configure nanobot**
```json ```json
{ {
@ -449,15 +453,18 @@ Uses **Socket Mode** — no public URL required.
} }
``` ```
> `groupPolicy`: `"mention"` (respond only when @mentioned), `"open"` (respond to all messages), or `"allowlist"` (restrict to specific channels). **4. Run**
> DM policy defaults to open. Set `"dm": {"enabled": false}` to disable DMs.
**3. Run**
```bash ```bash
nanobot gateway nanobot gateway
``` ```
DM the bot directly or @mention it in a channel — it should respond!
> [!TIP]
> - `groupPolicy`: `"mention"` (default — respond only when @mentioned), `"open"` (respond to all channel messages), or `"allowlist"` (restrict to specific channels).
> - DM policy defaults to open. Set `"dm": {"enabled": false}` to disable DMs.
</details> </details>
<details> <details>

View File

@ -92,7 +92,7 @@ class SlackConfig(BaseModel):
bot_token: str = "" # xoxb-... bot_token: str = "" # xoxb-...
app_token: str = "" # xapp-... app_token: str = "" # xapp-...
user_token_read_only: bool = True user_token_read_only: bool = True
group_policy: str = "open" # "open", "mention", "allowlist" group_policy: str = "mention" # "mention", "open", "allowlist"
group_allow_from: list[str] = Field(default_factory=list) # Allowed channel IDs if allowlist group_allow_from: list[str] = Field(default_factory=list) # Allowed channel IDs if allowlist
dm: SlackDMConfig = Field(default_factory=SlackDMConfig) dm: SlackDMConfig = Field(default_factory=SlackDMConfig)