Skip to main content

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:
  • QQ
  • WeChat
  • Line
  • WhatsApp
  • 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:
  1. Connects to AIRI’s server runtime via WebSocket
  2. Connects to a Satori server via WebSocket
  3. Translates messages between AIRI and Satori formats
  4. 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

This starts the bot with hot reload enabled.

4. Verify Connection

Check the logs for successful connections:

Message Flow

Incoming Messages (User → AIRI)

  1. User sends message on platform (e.g., QQ)
  2. Satori adapter captures message
  3. Satori server forwards to Satori bot
  4. Satori bot translates to AIRI format
  5. Message sent to AIRI server runtime
  6. AIRI processes and generates response

Outgoing Messages (AIRI → User)

  1. AIRI generates response
  2. Server runtime sends to Satori bot
  3. Satori bot translates to Satori format
  4. Message sent to Satori server
  5. Satori adapter forwards to platform
  6. User receives message

Configuration Options

Adapter Configuration

Edit src/adapter/config.ts to customize:

Capabilities

The Satori bot supports various message capabilities:
Basic text messages with formatting support.
User mentions are automatically translated.
Image attachments are forwarded with URL or base64 data.
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

Check:
  • Satori server is running and accessible
  • SATORI_WS_URL is correct
  • Firewall allows WebSocket connections
  • Token is valid and has required permissions
Debug:
Check:
  • Bot has joined the target group/channel
  • Bot has read permissions
  • Message filters are not blocking content
  • Adapter is properly configured
Debug: Enable verbose logging:
Check:
  • Bot has send permissions
  • Message format is valid for platform
  • Rate limits not exceeded
  • AIRI server runtime is reachable
Debug: Check message queue:
Check:
  • Adapter version supports the feature
  • Platform API version is compatible
  • Feature flag is enabled in config
Solution: Update Satori adapters:

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

Keep your Satori token and platform credentials secure. Never commit them to version control.
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