Slack Channel
Connect your Moxxy agent to Slack as a workspace app.
WARNING
Slack integration is currently in Beta. Some features may change.
Prerequisites
- A Slack workspace with admin access
- Access to Slack API
Setup
Step 1: Create a Slack App
- Go to Slack API
- Click Create New App
- Choose From scratch
- Name your app (e.g., "Moxxy")
- Select your workspace
Step 2: Configure Bot User
- Go to App Home
- Click Edit next to "Display Information"
- Set bot name and icon
- 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 @mentionschat:write- Send messagesim:history- Read direct messagesim:read- View direct messagesim:write- Send direct messageschannels: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 modeauthorizations:read- Read authorizations
Step 4: Enable Socket Mode
- Go to Socket Mode
- Enable Socket Mode
- Generate an app-level token
- Save the token (starts with
xapp-)
Step 5: Install to Workspace
- Go to Install App
- Click Install to Workspace
- Authorize the app
- 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-tokenOr 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 restartUsage
Mentioning the App
The app responds when mentioned:
@Moxxy What can you help me with?Direct Messages
DM the app directly:
- Open Slack
- Click the app in the sidebar
- Send a message
App Home
The app has a home tab that users can access:
- Click on the app in Slack
- View the Home tab
Configuration
Vault Keys
| Key | Description |
|---|---|
slack_bot_token | Bot OAuth token (xoxb-...) |
slack_app_token | App-level token (xapp-...) |
slack_allowed_channels | Allowed channel IDs |
slack_allowed_users | Allowed 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/interactiveChannel 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:
| Tier | Limit |
|---|---|
| Tier 1 | 1/minute |
| Tier 2 | 20/minute |
| Tier 3 | 100/minute |
| Tier 4 | 100+/minute |
Most chat:write operations are Tier 3.
Troubleshooting
App Not Responding
- Check app is installed: Look for app in workspace
- Verify tokens:bash
moxxy run --agent default --prompt "Check slack_bot_token" - Check Socket Mode is enabled
- Review gateway logs:bash
moxxy logs | grep -i slack
Permission Errors
Error: missing_scope- Go to Slack App settings
- Add required OAuth scopes
- Reinstall app to workspace
- Restart gateway
Socket Mode Issues
Error: Socket connection failed- Verify app-level token has
connections:write - Check network connectivity
- Ensure Socket Mode is enabled
Message Not Sent
Error: channel_not_found- Verify channel ID is correct
- Check bot is in the channel
- Verify bot has
chat:writescope
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/channelsGet User Info
bash
curl http://localhost:17890/api/agents/default/slack/users/U1234567890Security Best Practices
- Rotate tokens regularly
- Use minimal scopes needed
- Restrict channels where possible
- Monitor usage via logs
- 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 resolvedIncident 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]