Overview
The Satori protocol integration (@proj-airi/satori-bot) provides a universal adapter that allows AIRI to connect to multiple chat platforms through a single, unified interface. Instead of creating separate bots for each platform, you can use Satori adapters to support:
- Line
- Discord (via Satori)
- Telegram (via Satori)
- And any other platform with a Satori adapter
What is Satori?
Satori is a cross-platform messaging protocol that provides a unified API for interacting with different chat platforms. It acts as a bridge between AIRI and various messaging services, translating platform-specific APIs into a common format.Architecture
The Satori bot:- Connects to AIRI’s server runtime via WebSocket
- Connects to a Satori server via WebSocket
- Translates messages between AIRI and Satori formats
- Handles multi-platform message routing
Prerequisites
- AIRI server runtime running
- Satori server set up and running
- Satori adapters configured for your target platforms
- Node.js 18+ and pnpm installed
Setup
1. Install Dependencies
2. Configure Environment
Create a.env.local file:
3. Start the Bot
- Development
- Production
4. Verify Connection
Check the logs for successful connections:Message Flow
Incoming Messages (User → AIRI)
- User sends message on platform (e.g., QQ)
- Satori adapter captures message
- Satori server forwards to Satori bot
- Satori bot translates to AIRI format
- Message sent to AIRI server runtime
- AIRI processes and generates response
Outgoing Messages (AIRI → User)
- AIRI generates response
- Server runtime sends to Satori bot
- Satori bot translates to Satori format
- Message sent to Satori server
- Satori adapter forwards to platform
- User receives message
Configuration Options
Adapter Configuration
Editsrc/adapter/config.ts to customize:
Capabilities
The Satori bot supports various message capabilities:Text Messages
Text Messages
Basic text messages with formatting support.
Mentions (@)
Mentions (@)
User mentions are automatically translated.
Images
Images
Image attachments are forwarded with URL or base64 data.
Replies
Replies
Reply context is preserved across platforms.
Platform-Specific Features
QQ Integration
QQ-specific features supported:- Text messages with CQ codes
- Image and file sharing
- Group @mentions
- Red packet notifications
- Group member join/leave events
WeChat Integration
WeChat-specific features:- Text and rich media messages
- Contact cards
- Mini-program messages (view only)
- Moments/timeline posts (if adapter supports)
Line Integration
Line-specific features:- Stickers and emojis
- Image carousels
- Quick reply buttons
- Flex messages (template support)
Event Handling
The Satori bot listens for various events:Troubleshooting
Bot not connecting to Satori server
Bot not connecting to Satori server
Check:
- Satori server is running and accessible
SATORI_WS_URLis correct- Firewall allows WebSocket connections
- Token is valid and has required permissions
Messages not being received
Messages not being received
Check:
- Bot has joined the target group/channel
- Bot has read permissions
- Message filters are not blocking content
- Adapter is properly configured
Messages not being sent
Messages not being sent
Check:
- Bot has send permissions
- Message format is valid for platform
- Rate limits not exceeded
- AIRI server runtime is reachable
Platform-specific features not working
Platform-specific features not working
Check:
- Adapter version supports the feature
- Platform API version is compatible
- Feature flag is enabled in config
Advanced Usage
Custom Message Processors
Add custom message processing:Multi-Bot Setup
Run multiple Satori bots for different accounts:Custom Adapters
Create platform-specific adapters:Performance Considerations
- Connection pooling: Reuse WebSocket connections
- Message batching: Combine rapid messages when possible
- Rate limiting: Respect platform limits to avoid blocks
- Memory management: Clear old message cache periodically
Security
Best practices:- Use environment variables for sensitive data
- Rotate tokens periodically
- Limit bot permissions to minimum required
- Monitor for suspicious activity
- Use HTTPS/WSS for production deployments
Next Steps
Satori Documentation
Learn more about the Satori protocol
Server Runtime API
Understand AIRI’s integration architecture
Discord Integration
Alternative Discord-specific integration
Telegram Integration
Alternative Telegram-specific integration
