Skip to content

Slack Channel

Connect your Moxxy agent to Slack as a workspace app.

WARNING

Slack integration is currently in Beta. Some features may change.

Prerequisites

  1. A Slack workspace with admin access
  2. Access to Slack API

Setup

Step 1: Create a Slack App

  1. Go to Slack API
  2. Click Create New App
  3. Choose From scratch
  4. Name your app (e.g., "Moxxy")
  5. Select your workspace

Step 2: Configure Bot User

  1. Go to App Home
  2. Click Edit next to "Display Information"
  3. Set bot name and icon
  4. Enable Always Show My Bot as Online

Step 3: Set OAuth Scopes

Go to OAuth & Permissions and add these scopes:

Bot Token Scopes:

  • app_mentions:read - Read @mentions
  • chat:write - Send messages
  • im:history - Read direct messages
  • im:read - View direct messages
  • im:write - Send direct messages
  • channels:history - Read channel messages (optional)
  • groups:history - Read private channels (optional)
  • users:read - Read user info (optional)

App-Level Token Scopes:

  • connections:write - For socket mode
  • authorizations:read - Read authorizations

Step 4: Enable Socket Mode

  1. Go to Socket Mode
  2. Enable Socket Mode
  3. Generate an app-level token
  4. Save the token (starts with xapp-)

Step 5: Install to Workspace

  1. Go to Install App
  2. Click Install to Workspace
  3. Authorize the app
  4. Save the Bot User OAuth Token (starts with xoxb-)

Step 6: Connect to Moxxy

bash
moxxy channel slack --agent default \
  --token xoxb-your-bot-token \
  --app-token xapp-your-app-token

Or via vault:

bash
moxxy run --agent default --prompt "Store 'xoxb-xxx' in vault as slack_bot_token"
moxxy run --agent default --prompt "Store 'xapp-xxx' in vault as slack_app_token"

Restart gateway:

bash
moxxy gateway restart

Usage

Mentioning the App

The app responds when mentioned:

@Moxxy What can you help me with?

Direct Messages

DM the app directly:

  1. Open Slack
  2. Click the app in the sidebar
  3. Send a message

App Home

The app has a home tab that users can access:

  1. Click on the app in Slack
  2. View the Home tab

Configuration

Vault Keys

KeyDescription
slack_bot_tokenBot OAuth token (xoxb-...)
slack_app_tokenApp-level token (xapp-...)
slack_allowed_channelsAllowed channel IDs
slack_allowed_usersAllowed user IDs

Environment Variables

bash
export SLACK_BOT_TOKEN="xoxb-xxx"
export SLACK_APP_TOKEN="xapp-xxx"

Slack Blocks

The app can send rich Block Kit messages:

User: @Moxxy Show me the system status

Bot: [Rich Block Message]
┌─────────────────────────────────────┐
│ 🟢 System Status                     │
│ ─────────────────────────────────── │
│ All services operational             │
│                                     │
│ ┌───────────┐ ┌───────────┐        │
│ │   CPU     │ │  Memory   │        │
│ │   23%     │ │  4.2 GB   │        │
│ └───────────┘ └───────────┘        │
│                                     │
│ [View Details] [Refresh]            │
└─────────────────────────────────────┘

Block Kit Example

bash
curl -X POST http://localhost:17890/api/agents/default/slack/send \
  -H "Content-Type: application/json" \
  -d '{
    "channel": "C1234567890",
    "blocks": [
      {
        "type": "header",
        "text": {"type": "plain_text", "text": "Status Report"}
      },
      {
        "type": "section",
        "fields": [
          {"type": "mrkdwn", "text": "*CPU:*\n23%"},
          {"type": "mrkdwn", "text": "*Memory:*\n4.2 GB"}
        ]
      }
    ]
  }'

Interactive Components

Buttons

json
{
  "type": "actions",
  "elements": [
    {
      "type": "button",
      "text": {"type": "plain_text", "text": "Approve"},
      "action_id": "approve"
    },
    {
      "type": "button",
      "text": {"type": "plain_text", "text": "Reject"},
      "action_id": "reject"
    }
  ]
}

Handling Interactions

Configure an interaction endpoint:

bash
# In Slack App settings, add Interactivity
# Request URL: https://your-server/api/webhooks/slack/interactive

Channel Restrictions

Limit to Specific Channels

bash
moxxy run --agent default --prompt "Store 'C1234567890,C0987654321' in vault as slack_allowed_channels"

Limit to Specific Users

bash
moxxy run --agent default --prompt "Store 'U1234567890' in vault as slack_allowed_users"

Rate Limits

Slack rate limits:

TierLimit
Tier 11/minute
Tier 220/minute
Tier 3100/minute
Tier 4100+/minute

Most chat:write operations are Tier 3.

Troubleshooting

App Not Responding

  1. Check app is installed: Look for app in workspace
  2. Verify tokens:
    bash
    moxxy run --agent default --prompt "Check slack_bot_token"
  3. Check Socket Mode is enabled
  4. Review gateway logs:
    bash
    moxxy logs | grep -i slack

Permission Errors

Error: missing_scope
  1. Go to Slack App settings
  2. Add required OAuth scopes
  3. Reinstall app to workspace
  4. Restart gateway

Socket Mode Issues

Error: Socket connection failed
  1. Verify app-level token has connections:write
  2. Check network connectivity
  3. Ensure Socket Mode is enabled

Message Not Sent

Error: channel_not_found
  1. Verify channel ID is correct
  2. Check bot is in the channel
  3. Verify bot has chat:write scope

API Reference

Send Message

bash
curl -X POST http://localhost:17890/api/agents/default/slack/send \
  -H "Content-Type: application/json" \
  -d '{
    "channel": "C1234567890",
    "text": "Hello from Moxxy!"
  }'

Send Ephemeral

bash
curl -X POST http://localhost:17890/api/agents/default/slack/ephemeral \
  -H "Content-Type: application/json" \
  -d '{
    "channel": "C1234567890",
    "user": "U1234567890",
    "text": "Only you can see this"
  }'

List Channels

bash
curl http://localhost:17890/api/agents/default/slack/channels

Get User Info

bash
curl http://localhost:17890/api/agents/default/slack/users/U1234567890

Security Best Practices

  1. Rotate tokens regularly
  2. Use minimal scopes needed
  3. Restrict channels where possible
  4. Monitor usage via logs
  5. Revoke tokens immediately if compromised

Examples

Daily Standup Bot

User: @Moxxy What did the team work on yesterday?

Bot: I'll gather yesterday's updates.
[Searches channels for standup messages]

Here's a summary of yesterday's activity:
- 23 commits merged
- 5 PRs opened
- 12 issues resolved
- 3 incidents resolved

Incident Alerts

[Automatic notification]

Bot: 🚨 Incident Alert

**Service:** API Gateway
**Status:** Degraded
**Impact:** 5% of requests failing
**Started:** 2 minutes ago

[View Dashboard] [Acknowledge]

Interactive Approval

Bot: 📋 Deployment Request

**Environment:** Production
**Version:** v2.3.1
**Changes:** 15 commits since last deploy
**Requested by:** @john

[Approve] [Reject] [View Changes]

Open source · Self-hosted · Data sovereign