Prerequisites
- QQ Bot Platform access
- QQ developer account
- App ID and App Secret
Creating a QQ Bot
-
Register for QQ Bot Platform
- Visit QQ Open Platform
- Log in with your QQ account
- Apply for bot development access
-
Create Bot Application
- Go to Bot Management Console
- Click “Create Bot”
- Fill in bot information:
- Bot Name
- Bot Description
- Bot Avatar
- Submit for review
-
Get Credentials
- After approval, go to bot settings
- Note your App ID (numeric)
- Generate and save App Secret
-
Configure Bot Permissions
- Enable required permissions:
- ✅ C2C Messages (Direct messages)
- ✅ Group AT Messages (Group mentions)
- Set bot visibility (public/private)
- Enable required permissions:
Configuration
Add the QQ channel to yourconfig.yaml:
Configuration Options
| Field | Type | Required | Description |
|---|---|---|---|
enabled | boolean | Yes | Enable QQ channel |
app_id | string | Yes | Bot application ID |
app_secret | string | Yes | Bot application secret |
allow_from | array | No | Allowed QQ user IDs |
User ID Format
QQ uses numeric user IDs (QQ numbers). Finding User IDs:- User’s QQ number is their user ID
- Check Weaver logs after receiving a message:
Supported Features
Message Types
Currently Supported:- Text messages (C2C and Group AT)
- Direct messages (C2C)
- Group mentions (requires @bot)
- Rich media (images, voice, files)
- Markdown formatting
- Embeds and cards
Message Handling
Direct Messages (C2C):- Bot responds to all direct messages
- No mention required
- Uses user ID as chat ID
- Bot only responds when @mentioned
- Mention is required in group chats
- Prevents spam in busy groups
Connection Mode
Weaver uses WebSocket for real-time communication:- Protocol: QQ Bot Gateway (WebSocket)
- Authentication: OAuth 2.0 with automatic token refresh
- Reconnection: Automatic on disconnect
- Sharding: Supported for high-traffic bots
Token Management
- Access tokens auto-refresh before expiration
- Token source maintains valid credentials
- No manual token management needed
Bot Behavior
Direct Messages
Group Messages
Message Deduplication
QQ channel implements automatic deduplication:- Tracks processed message IDs
- Prevents duplicate processing
- Automatic cleanup (maintains 10,000 recent IDs)
- Thread-safe implementation
Error Handling
Common Issues
Invalid Credentials- Verify App ID and App Secret in config
- Ensure credentials are from Bot Management Console
- Check App Secret is correct
- Verify bot is not suspended/deleted
- Ensure network connectivity to QQ API
- Check network connectivity
- Verify firewall allows outbound WebSocket
- Bot may be rate-limited (check QQ console)
- Add user ID to
allow_fromlist - Or remove
allow_fromto allow all users
- Message format issue (should not occur normally)
- Check QQ API changes or updates
Security Considerations
- Credential Security: Keep App ID and App Secret secure
- Token Storage: Tokens stored in memory only (not persisted)
- Allowlist: Use
allow_fromto restrict bot access - Rate Limiting: QQ enforces API rate limits
- Message Validation: All messages validated before processing
Metadata Captured
Each QQ message includes: C2C Messages:Example Configurations
Basic Setup
With Allowlist
Logging
Monitor QQ activity:API Version
Weaver uses the QQ Official Bot API:- Library:
github.com/tencent-connect/botgo - Protocol: QQ Bot Gateway (WebSocket)
- Authentication: OAuth 2.0
- API Version: Latest stable
Limitations
Current Limitations
- Text Only: Only text messages currently supported
- No Media: Image/voice/file support planned for future
- Group AT Only: Groups require @mention (by design)
- No Formatting: Plain text output only
QQ Platform Limits
- Rate Limits: Enforced by QQ (varies by bot type)
- Message Length: Limited by QQ API
- Bot Review: Bots must be approved by QQ
- Regional: Primarily for China region
Bot Approval Process
- Submit Bot: Create bot in console
- Provide Info: Name, description, use case
- Wait for Review: 1-7 days typical
- Get Approved: Receive credentials
- Test: Use sandbox environment first
- Go Live: Deploy production bot
Best Practices
- Test Credentials: Verify App ID/Secret before deployment
- Monitor Logs: Watch for authentication errors
- Handle Dedup: Bot automatically deduplicates messages
- Respond Quickly: QQ users expect fast responses
- Use Allowlist: Limit access during testing
- Check Shards: Monitor shard count for large bots
Troubleshooting
Bot Not Receiving Messages
- Check bot is started:
QQ bot started successfully - Verify WebSocket connected
- Ensure permissions enabled in QQ console
- Try sending direct message (C2C) first
- For groups, verify bot is @mentioned
Bot Not Sending Messages
- Check
QQ bot not runningerror - Verify access token is valid
- Check rate limiting in logs
- Ensure chat ID format is correct
Future Enhancements
Planned features:- Rich media support (images, voice, files)
- Markdown/HTML formatting
- Interactive buttons and cards
- Voice message transcription
- Improved group message handling
Next Steps
- Configure Agents to respond on QQ
- Set up Message Routing for multi-channel support
- Enable Logging for debugging