Skip to main content
Space Monkey makes it easy to deploy your Slide agents as Slack agents. In this guide, you’ll learn how to create a Slack agent that can respond to messages, handle events, and interact with your workspace.

Prerequisites

Before starting, you’ll need:
  1. A Slack workspace where you can install apps
  2. Slack app credentials (we’ll create these)

Quick start

Step 1: Install Space Monkey

Step 2: Create Your Agent

Setting Up Slack App

1. Create a Slack App

  1. Go to api.slack.com/apps
  2. Click “Create New App” → “From scratch”
  3. Name your app and select your workspace

2. Configure Agent User

  1. Go to “OAuth & Permissions”
  2. Add these Bot Token Scopes:
    • app_mentions:read - Read mentions
    • chat:write - Send messages
    • channels:history - Read channel messages
    • groups:history - Read private channel messages
    • im:history - Read direct messages
    • mpim:history - Read group DMs
    • files:read - Read files (if using file tools)
    • files:write - Upload files (if creating files)

3. Install to Workspace

  1. Click “Install to Workspace”
  2. Authorize the app
  3. Copy the Bot User OAuth Token (starts with xoxb-)

4. Enable Socket Mode

  1. Go to “Socket Mode” in the sidebar
  2. Enable Socket Mode
  3. Create an app-level token with connections:write scope
  4. Copy the token (starts with xapp-)

5. Enable Events

  1. Go to “Event Subscriptions”
  2. Turn on “Enable Events”
  3. Subscribe to agent events:
    • app_mention
    • message.channels
    • message.groups
    • message.im
    • message.mpim

6. Set Environment Variables

Set these environment variables before running your agent:

Advanced Agent Features

Conversation Persistence

Give your agent persistence across conversations:

Message Routing

SlackApp automatically handles:
  • Direct messages
  • App mentions in channels
  • Thread replies
  • File uploads
  • Intelligent routing based on context
The agent will respond to:
  1. All direct messages
  2. Messages where the agent is @mentioned
  3. Replies in threads where the agent has participated
  4. Messages matching the configured response_topics

File Handling

SlackApp automatically processes files shared in Slack when the agent has file tools:
Users can share files directly with the agent, and it will automatically download and process them.

Production Deployment

Environment Variables

Docker Deployment

Space Monkey includes Docker support for easy deployment:

Using Docker Compose

For easier local development:
To use PostgreSQL for persistence:

Health Checks

SlackApp includes built-in health monitoring:
The app also provides a built-in health endpoint at /health.

Real-World Example: Team Assistant Agent

Monitoring and Logging

SlackApp includes built-in logging. To configure logging levels:
For production monitoring, you can also set up Weave tracing:

Troubleshooting

  1. Check your agent is online: Look for green dot in Slack
  2. Verify tokens are correct
  3. Check ngrok is running (for development)
  4. Ensure agent is invited to channel
  5. Check logs for errors
  1. Verify request URL is correct
  2. Check signing secret matches
  3. Ensure your server is accessible from internet
  4. Try re-verifying the URL in Slack settings
Review OAuth scopes - you may need additional permissions:
  • channels:read for channel info
  • users:read for user info
  • chat:write.public for posting to channels agent isn’t in

Next steps

Space Monkey Docs

Deep dive into Space Monkey

Examples

More Slack agent examples