npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@wopr-network/wopr-plugin-slack

v1.0.0

Published

Slack integration for WOPR - Socket Mode and HTTP webhook support

Readme

🔌 WOPR Slack Plugin

npm version License: MIT WOPR Socket Mode Bolt

🤖 Slack integration for WOPR - Self-sovereign AI session management over P2P

Bring your WOPR agent to Slack with real-time streaming, smart threading, and secure access controls.


✨ Features

| Feature | Description | Status | |---------|-------------|--------| | 🔌 Socket Mode | WebSocket-based connection, works through firewalls | ✅ Default | | 🌐 HTTP Webhooks | Traditional webhook mode for server deployments | ✅ Supported | | 💬 DM Support | Direct messages with pairing/allowlist security | ✅ With pairing | | #️⃣ Channel Support | Group channels with mention gating | ✅ Configurable | | 🧵 Threading | Automatic reply threading options | ✅ 3 modes | | ⚡ Streaming | Real-time response streaming with chunking | ✅ Live updates | | 👀 Reactions | Ack reactions and success/error indicators | ✅ Customizable | | 🎨 Block Kit | Rich Slack Block Kit responses | ✅ Supported | | 🔒 Security | Multiple DM and channel policies | ✅ Flexible | | 📝 Logging | Comprehensive Winston-based logging | ✅ Debug ready |


🚀 Quick Start

Installation

# Via WOPR CLI
wopr plugin install wopr-plugin-slack

# Or manually
cd ~/.wopr/plugins
npm install wopr-plugin-slack

Minimal Configuration

Create or edit your WOPR config file (~/.wopr/config.json):

{
  "channels": {
    "slack": {
      "enabled": true,
      "mode": "socket",
      "botToken": "xoxb-your-bot-token",
      "appToken": "xapp-your-app-token"
    }
  }
}

That's it! Start WOPR and your bot will connect to Slack.


📋 Setup Guide

1. Create a Slack App

  1. Go to api.slack.com/apps
  2. Click Create New App
  3. Choose From scratch
  4. Name your app (e.g., "WOPR Bot") and select your workspace

2. Configure Socket Mode (Recommended)

  1. In the left sidebar, click Socket Mode
  2. Toggle Enable Socket Mode to On
  3. Generate an App-Level Token:
    • Click Generate Token and Scopes
    • Add scope: connections:write
    • Copy the token (starts with xapp-)

3. Add Bot Token Scopes

  1. Go to OAuth & Permissions in the left sidebar
  2. Scroll to ScopesBot Token Scopes
  3. Add the following scopes:

| Scope | Purpose | Required | |-------|---------|----------| | app_mentions:read | Detect @mentions | Yes | | channels:history | Read public channel messages | Yes | | chat:write | Send messages | Yes | | im:history | Read DM history | Yes | | im:write | Send DMs | Yes | | reactions:write | Add emoji reactions | Yes | | channels:join | Auto-join public channels | Recommended | | groups:history | Read private channel messages | Recommended | | mpim:history | Read group DM history | Recommended | | users:read | Get user info for logging | Recommended |

4. Install to Workspace

  1. Go to Install App in the left sidebar
  2. Click Install to Workspace
  3. Copy the Bot User OAuth Token (starts with xoxb-)

5. Configure WOPR

Add the tokens to your WOPR configuration:

{
  "channels": {
    "slack": {
      "enabled": true,
      "mode": "socket",
      "botToken": "xoxb-your-bot-token",
      "appToken": "xapp-your-app-token"
    }
  }
}

⚙️ Configuration Options

Core Options

| Option | Type | Required | Default | Description | |--------|------|----------|---------|-------------| | enabled | boolean | No | true | Enable/disable the plugin | | mode | string | No | "socket" | Connection mode: "socket" or "http" | | botToken | string | Yes | - | Bot User OAuth Token (xoxb-...) | | appToken | string | For socket | - | App-Level Token (xapp-...) | | signingSecret | string | For HTTP | - | Signing secret for HTTP mode | | webhookPath | string | No | "/slack/events" | Webhook endpoint path (HTTP mode) | | ackReaction | string | No | "👀" | Reaction emoji while processing | | replyToMode | string | No | "off" | Threading: "off", "first", "all" | | groupPolicy | string | No | "allowlist" | Channel policy: "allowlist", "open", "disabled" |

DM Options (nested under dm)

| Option | Type | Required | Default | Description | |--------|------|----------|---------|-------------| | dm.enabled | boolean | No | true | Enable/disable DM handling | | dm.policy | string | No | "pairing" | DM policy: "pairing", "open", "closed" | | dm.allowFrom | array | No | [] | Allowed user IDs for DMs (use ["*"] for all) |

Full Configuration Example

{
  "channels": {
    "slack": {
      "enabled": true,
      "mode": "socket",
      "botToken": "xoxb-...",
      "appToken": "xapp-...",
      "ackReaction": "👀",
      "replyToMode": "all",
      "dm": {
        "enabled": true,
        "policy": "pairing",
        "allowFrom": ["U1234567890"]
      },
      "groupPolicy": "allowlist",
      "channels": {
        "C1234567890": {
          "allow": true,
          "requireMention": false
        },
        "C0987654321": {
          "allow": true,
          "requireMention": true
        }
      }
    }
  }
}

Note: Channel keys must be Slack channel IDs (e.g., C1234567890), not channel names. Find a channel's ID by viewing its details in Slack.


🔌 Socket Mode vs HTTP Mode

| Feature | Socket Mode | HTTP Mode | |---------|-------------|-----------| | Firewall | ✅ Works through firewalls | ❌ Requires public URL | | Setup | Simple, no server needed | Requires web server | | Scaling | Good for most use cases | Better for high-load | | Security | WebSocket TLS | Request signing | | Hosting | Local, VPN, anywhere | Server with public IP | | Reconnect | Automatic | Depends on server |

When to Use Socket Mode

  • 🔧 Development and testing
  • 🏠 Local or home deployments
  • 🔒 Behind corporate firewalls
  • ☁️ Cloud VMs without domain setup

When to Use HTTP Mode

  • 🌐 Production server deployments
  • 📊 High-traffic scenarios
  • 🏢 Enterprise with strict WebSocket policies
  • 🔄 Load balancing across multiple instances

🔐 Environment Variables

You can configure the plugin using environment variables:

# Required tokens (used as fallback if not in config file)
export SLACK_BOT_TOKEN="xoxb-your-bot-token"
export SLACK_APP_TOKEN="xapp-your-app-token"

# Optional: HTTP mode
export SLACK_SIGNING_SECRET="your-signing-secret"

# Optional: WOPR home directory (used for log file location)
export WOPR_HOME="/home/user/.wopr"

Environment variables are used as fallbacks when tokens are not specified in the config file.

Note: Log files are written to $WOPR_HOME/logs/slack-plugin.log and $WOPR_HOME/logs/slack-plugin-error.log. If WOPR_HOME is not set, logs default to /tmp/wopr-test/logs/.


🔒 Security Policies

DM Policies

Control how the bot handles direct messages:

| Policy | Behavior | Use Case | |--------|----------|----------| | pairing (default) | Unknown users must be approved | 🔒 Secure deployments | | open | Accept all DMs | 🌐 Public bots | | closed | Ignore all DMs | #️⃣ Channel-only mode |

Channel Policies

Control bot behavior in channels:

| Policy | Behavior | Use Case | |--------|----------|----------| | allowlist (default) | Only respond in configured channels | 🔒 Controlled access | | open | Respond in any channel (mention-gated) | 🌐 Organization-wide | | disabled | Ignore all channels | 💬 DM-only mode |

Mention Gating

Require @mention for responses:

{
  "channels": {
    "C1234567890": {
      "allow": true,
      "requireMention": true
    }
  }
}

Note: Use the Slack channel ID, not the channel name.


🧵 Reply Threading

Control how replies are organized:

| Mode | Behavior | Best For | |------|----------|----------| | off (default) | Reply in main channel | 💬 General chat | | first | First reply in thread, then main | 📋 Single response | | all | All replies in thread | 🧵 Organized conversations |


📚 Documentation


💻 Development

# Clone the repository
git clone https://github.com/TSavo/wopr-plugin-slack.git
cd wopr-plugin-slack

# Install dependencies
npm install

# Build the plugin
npm run build

# Watch for changes
npm run watch

# Run in development mode
npm run dev

🧪 Testing

# Run tests
npm test

# Run with debug logging
DEBUG=slack:* npm run dev

🐛 Troubleshooting

Common Issues

| Issue | Solution | |-------|----------| | Bot not responding | Check tokens, ensure app is installed to workspace | | Socket Mode fails | Verify appToken has connections:write scope | | HTTP mode 401 errors | Check signingSecret matches Slack app | | Missing messages | Ensure bot is invited to channel | | Reactions not working | Add reactions:write scope |

See TROUBLESHOOTING.md for detailed solutions.


🔗 Related Projects


🤝 Contributing

Contributions are welcome! Please read the WOPR Contributing Guide for details.


📄 License

MIT © TSavo