Xianyu Auto-Reply System: Multi-Account Management and Intelligent Trading Solution
“
This article is based entirely on the official documentation of the open-source project xianyu-auto-reply. For learning purposes only – commercial use is strictly prohibited. Full copyright terms appear at the end.
Why Businesses Need Xianyu Automation Tools
Managing multiple Xianyu accounts presents three core challenges:
- 
Delayed message responses causing lost customers  - 
Time-consuming repetitive shipping operations  - 
Inefficient multi-account switching  
This article details an open-source automation solution for Xianyu that provides:
- 
Intelligent message replies (keyword matching + AI responses)  - 
Fully automated shipping processes  - 
Unified multi-account management  - 
Smart product data analysis  
Core Feature Overview
🔐 Multi-User Security System
graph LR
A[User Registration] --> B[Email Verification]
B --> C[CAPTCHA Validation]
C --> D[JWT Authentication]
D --> E[Isolated Data Storage]
- 
Three-layer security: - 
Email + CAPTCHA dual verification at registration  - 
Token-based session management  - 
Physically isolated user data storage  
 - 
 
📱 Multi-Account Management Architecture
graph TB
ControlCenter --> Account1[Xianyu Account A]
ControlCenter --> Account2[Xianyu Account B]
ControlCenter --> Account3[Xianyu Account N]
Account1 --> IndependentEngine
Account2 --> IndependentEngine
Account3 --> IndependentEngine
- 
Key capabilities: - 
Unlimited account additions  - 
Real-time account status monitoring  - 
Batch start/stop operations  
 - 
 
🤖 Intelligent Reply Workflow
graph LR
ReceiveMessage --> CheckProductKeywords --> MatchFound? --> SendSpecificReply
CheckProductKeywords --> NoMatch? --> CheckGeneralKeywords --> MatchFound? --> SendGeneralReply
CheckGeneralKeywords --> NoMatch? --> GenerateAIResponse
Reply priority system:
- 
Product-specific keyword replies (highest priority)  - 
Global keyword replies  - 
AI-generated responses  
Dynamic variables support:
"Hello {username}, the {product_name} you inquired about is in stock. Orders ship within {delivery_time}!"
🚚 Automated Shipping Process
Shipping triggers:
- 
Buyer payment notifications  - 
Price negotiation messages (“small knife”)  - 
Custom trigger conditions  
Shipping mechanism:
sequenceDiagram
Buyer->>System: Completes payment
System->>Database: Queries product specs
Database-->>System: Returns specification data
System->>ShippingRules: Matches coupon/card
ShippingRules-->>System: Returns key data
System->>Buyer: Automatically sends key
System->>XianyuAPI: Confirms shipment
Error prevention:
- 
Duplicate shipment detection  - 
Automatic retries on failure  - 
Operation log tracking  
🛍️ Product Management System
Dual data channels:
- 
Automatic collection from messages  - 
Active retrieval via Xianyu API  
Multi-spec product handling:
| Product ID | Spec Name  | Stock | Price | Status  |
|------------|------------|-------|-------|---------|
| 1001       | Monthly    | 50    | 15    | Enabled |
| 1001       | Quarterly  | 20    | 40    | Disabled|
| 1002       | Standard   | 100   | 10    | Enabled |
🔍 Real Product Search Technology
Data collection process:
- 
Launch browser via Playwright  - 
Simulate user search behavior  - 
Parse actual page data  - 
Sort by “Want Count” metric  
Sample output:
{
  "Product Title": "NetEase Cloud Music Monthly Membership",
  "Price": "¥8.99",
  "Want Count": 2450,
  "Seller Location": "Shanghai",
  "Product Link": "https://..."
}
Technical Architecture Analysis
System Architecture Diagram
graph TD
A[Web Interface] --> B[FastAPI Service]
B --> C[Cookie Manager]
C --> D[Account 1 WS]
C --> E[Account 2 WS]
D --> F[Message Processor]
E --> F
F --> G[SQLite Database]
Core Module Functions
Deployment Guide (3 Options)
Option 1: Docker Quick Deployment
# Create data directory
mkdir -p xianyu-auto-reply
# Launch container
docker run -d \
  -p 8080:8080 \
  -v $PWD/xianyu-auto-reply/:/app/data/ \
  --name xianyu-auto-reply \
  registry.cn-shanghai.aliyuncs.com/zhinian-software/xianyu-auto-reply:1.0
Windows users: Replace $PWD with %cd%
Option 2: Source Code Deployment
git clone https://github.com/zhinianboke/xianyu-auto-reply.git
cd xianyu-auto-reply
chmod +x docker-deploy.sh  # Linux/macOS
./docker-deploy.sh
Windows users: Use docker-deploy.bat
Option 3: Local Development Setup
python -m venv venv
source venv/bin/activate  # Linux/macOS
venv\Scripts\activate    # Windows
pip install -r requirements.txt
playwright install chromium
python Start.py
Practical Configuration Guide
Initial Login Setup
- 
Access http://localhost:8080 - 
Use default credentials: - 
Username: admin - 
Password: admin123 
 - 
 - 
Immediately change default password  
Adding Xianyu Accounts
- 
Obtain Xianyu cookies  - 
Add new account in system  - 
Enter complete cookie values  - 
Start monitoring task  
Configuring Auto-Shipping Rules
1. Navigate to "Shipping Management"
2. Create new rule:
   - Product Keywords: *music membership*
   - Shipping Content: Key data or API links
3. Configure specification matching
4. Enable shipping delay (optional)
Technical Implementation Deep Dive
🔒 Security Architecture
🚀 Performance Optimization
- 
Async architecture: asyncio-based message processing  - 
Connection pooling: Database connection reuse  - 
Smart caching: In-memory frequent data caching  - 
Resource isolation: Per-account runtime environments  
🧠 AI Response Configuration
# Sample configuration
ai_engine: openai
api_key: sk-xxxxxxxxxxxx
model: gpt-4
temperature: 0.7
max_tokens: 500
Supported models:
- 
OpenAI GPT series  - 
Tongyi Qianwen  - 
Other API-compatible models  
Troubleshooting Guide
1. Docker Container Startup Failure
# Clean and rebuild containers
docker-compose down
docker rm xianyu-auto-reply
docker-compose up -d --build
2. WebSocket Connection Issues
Diagnosis steps:
- 
Open ports 3000-3010 in firewall  - 
Verify cookie validity  - 
Check real-time connection logs  
3. Script Execution Errors (Linux/Mac)
# Fix line endings
sed -i 's/\r$//' docker-deploy.sh
chmod +x docker-deploy.sh
./docker-deploy.sh
4. Multi-Spec Product Matching Failures
Resolution strategy:
- 
Ensure consistent specification naming  - 
Configure fallback shipping rules  - 
Enable fuzzy matching mode  
5. Image Upload Failures
Solutions:
- 
Verify CDN configuration  - 
Check image format restrictions  - 
Review storage quotas  
Technical Support Channels
Community Groups
For technical support, join developer communities:

WeChat group QR code

QQ group QR code
Copyright and Usage Terms
Permitted Uses
- 
✅ Personal learning and research  - 
✅ Non-commercial technical sharing  - 
✅ Open-source contributions  
Prohibited Actions
- 
❌ Any commercial application  - 
❌ Code resale for profit  - 
❌ Removal of copyright information  - 
❌ Illegal operations  
Disclaimer
- 
Project provided “as-is” without warranties  - 
Users assume all risks  - 
Illegal usage strictly prohibited  
“
Using this project signifies agreement to these terms
Project Acknowledgements
Development leveraged these open-source projects:
- 
XianYuApis – Xianyu API implementation  - 
XianyuAutoAgent – Automation framework  - 
myfish – QR login solution  
“
Project URL: https://github.com/zhinianboke/xianyu-auto-reply
Important: This system is for technical research only. Using Xianyu automation tools requires compliance with platform policies

