Seamlessly sync Slack conversations to Supermemory for intelligent knowledge management
A production-ready Cloudflare Workers-based connector that integrates Slack workspaces with Supermemory, enabling real-time message synchronization and historical backfills with enterprise-grade security and scalability.
- Live message ingestion via Slack Events API
- Thread-aware processing with complete conversation context
- File attachment handling with secure URL management
- Multi-channel support with granular control
- Cursor-based pagination for efficient historical data retrieval
- Configurable document limits per channel to control costs
- Progress tracking and resumability for large workspaces
- Rate limit-aware processing (~50 req/min compliance)
- Token encryption using AES-GCM before database storage
- Request signature verification using Slack's HMAC-SHA256
- Automatic token rotation and revocation support
- GDPR compliance with user data deletion capabilities
- Multi-environment deployment (development, staging, production)
- Comprehensive observability with metrics and logging
- Rate limiting to prevent API abuse
- Error handling with exponential backoff retry logic
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Slack API βββββΆβ Cloudflare βββββΆβ Supermemory β
β β β Workers β β API β
β β’ Events API β β β β β
β β’ OAuth Flow β β β’ Rate Limiting β β β’ /v3/memories β
β β’ Web API β β β’ Encryption β β β’ Knowledge β
β β β β’ Transformationβ β Storage β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β
βΌ
βββββββββββββββββββ
β Cloudflare D1 β
β β
β β’ Teams/Tokens β
β β’ Channels β
β β’ Sync Logs β
βββββββββββββββββββ
src/
βββ index.tsx # Main Worker entry point
βββ auth.ts # Better Auth configuration
βββ api.ts # API route handlers
βββ slack/
β βββ index.ts # Slack router and main handlers
β βββ services/
β β βββ client.ts # Slack API client with rate limiting
β β βββ transformer.ts # Message transformation logic
β βββ utils/
β β βββ signature.ts # Request signature verification
β βββ types/ # TypeScript interfaces
β βββ handlers/ # Event-specific handlers
βββ db/
β βββ schema.ts # Database schema definitions
β βββ slackOperations.ts # Database operations
βββ middleware/
β βββ rateLimit.ts # General rate limiting
β βββ slackRateLimit.ts # Slack-specific rate limiting
βββ utils/
βββ cipher.ts # Encryption utilities
βββ key.ts # Key management
- Cloudflare Workers account
- Wrangler CLI installed
- Slack App created
- Supermemory API access
git clone https://github.com/supermemoryai/slack-connector.git
cd slack-connector
npm install# Copy environment template
cp .dev.vars.example .dev.vars
# Edit with your credentials
nano .dev.vars# Create D1 database
wrangler d1 create supermemory-slack
# Apply migrations
npm run drizzle:migrate# Development
npm run dev
# Production
npm run deployπ§ Create & Configure Slack App:
For experienced developers (10-15 min setup):
- Quick Start: Slack App Quick Reference
For detailed step-by-step instructions:
- Complete Guide: Slack App Setup Guide
Generate app manifest:
# Create manifest for your environment
npm run manifest:generate -- --env production
# Then follow the setup guide to create your Slack appFor comprehensive deployment instructions, including production configuration, security setup, and troubleshooting, see our documentation:
- π Slack App Setup: docs/SLACK_APP_SETUP.md
- β‘ Quick Reference: docs/SLACK_APP_QUICK_START.md
- π§ Deployment Guide: docs/DEPLOYMENT.md
- π‘ API Reference: docs/API.md
For automated setup, use our interactive configuration tool:
npm run setup:deployment# Start local development server
npm run dev
# Run tests
npm test
# Lint code
npm run lint
# Generate database migrations
npm run drizzle:generateSLACK_CLIENT_ID- From your Slack app's Basic InformationSLACK_CLIENT_SECRET- From your Slack app's Basic InformationSLACK_SIGNING_SECRET- From your Slack app's Basic InformationSUPERMEMORY_API_KEY- Your Supermemory API keySECRET- Encryption key for token storage (32+ characters)
SLACK_BOT_TOKEN- For testing (usually obtained via OAuth)SLACK_USER_TOKEN- For testing (usually obtained via OAuth)SUPERMEMORY_API_URL- API endpoint (default: https://api.supermemory.ai)
- All Slack tokens are encrypted using AES-GCM before database storage
- Tokens are automatically rotated and can be revoked on demand
- Encryption keys are managed through Cloudflare Workers Secrets
- All incoming Slack requests are verified using HMAC-SHA256 signatures
- Timestamp validation prevents replay attacks
- Request body integrity is maintained throughout processing
- Slack API rate limits are respected with intelligent backoff
- Per-team, per-method rate limiting prevents abuse
- Configurable thresholds for different API tiers
- Events received per workspace
- Memories created success/failure rates
- Latency tracking from event receipt to memory creation
- Rate limit monitoring and prevention
- Error rates with detailed categorization
- Structured JSON logging throughout the application
- Request tracing with correlation IDs
- Performance metrics and bottleneck identification
- Security event auditing
Access real-time metrics through:
- Cloudflare Workers Analytics Dashboard
- Custom metrics via Workers Observability
- Logs accessible via
wrangler tail
GET /auth/slack/install- Initiate Slack OAuth flowGET /auth/slack/callback- Handle OAuth callback
POST /slack/events- Receive Slack eventsPOST /slack/interactive- Handle interactive components
GET /health- Health check endpointGET /api/status- System status and metrics
message.channels- Public channel messagesmessage.groups- Private channel messagesmessage.im- Direct messagesmessage.mpim- Group direct messagesfile_shared- File attachments
# Deploy to staging
wrangler deploy --env staging
# Deploy to production
wrangler deploy --env production# Set production secrets
wrangler secret put SLACK_CLIENT_SECRET
wrangler secret put SUPERMEMORY_API_KEY
wrangler secret put SECRET# Apply to production
npm run drizzle:migrate:prod# Run all tests
npm test
# Run specific test files
npm test slackDatabase.spec.ts
npm test slackRateLimit.spec.ts# Test with local environment
npm run dev
# Test Slack webhook signature verification
curl -X POST http://localhost:8787/slack/events \
-H "Content-Type: application/json" \
-H "X-Slack-Signature: v0=..." \
-H "X-Slack-Request-Timestamp: ..." \
-d '{"type":"url_verification","challenge":"test"}'- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes and add tests
- Ensure tests pass:
npm test - Lint your code:
npm run lint - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
- Follow TypeScript best practices
- Use Biome for consistent formatting
- Add JSDoc comments for public APIs
- Write comprehensive tests for new features
When reporting issues, please include:
- Steps to reproduce the problem
- Expected behavior
- Actual behavior
- Environment details (Wrangler version, Node.js version)
- Relevant log output
# Check signing secret
wrangler secret list
# Verify webhook URL in Slack app settings# Verify D1 database ID in wrangler.jsonc
wrangler d1 info supermemory-slack# Monitor rate limit status
wrangler tail
# Adjust rate limiting configuration if needed# Enable verbose logging
export LOG_LEVEL=debug
npm run devFor more troubleshooting information, see the Deployment Guide.
This project is licensed under the MIT License - see the LICENSE file for details.
- Built on the Supermemory Backend API Kit template
- Powered by Cloudflare Workers
- Secured with Better Auth
- Database management via Drizzle ORM
- Documentation: docs/DEPLOYMENT.md
- Issues: GitHub Issues
- Community: Supermemory Discord
- Email: support@supermemory.ai
Made with β€οΈ by the Supermemory team