中文 | English
Transmit WeChat messages on Telegram, supporting multiple WeChat protocols (iPad, Mac, Car, Windows, Pad)
Warning
According to feedback, the Windows protocol has the risk of account suspension, please do not use this protocol
Choose the branch that matches your wx2tg-server major version:
| Repository branch | Required server version |
|---|---|
v6 | wx2tg-server v6 |
v7 | wx2tg-server v7 |
Do not mix the v6 branch with server v7, or the v7 branch with server v6. When switching branches, also switch the server to the matching major version.
Both branches were initialized from the same wx2tg-v3 codebase. Creating these branches does not itself implement or verify compatibility; version-specific changes will be maintained on their respective branches.
Important
All three repositories now target **`v6.0.12`**: bot and puppet package versions are `6.0.12`; bot/server Docker tags are `v6.0.12`. Local Git tags do not mean npm/Docker artifacts have been published. See [release rules (Chinese)](docs/releases.md) and [v6 configuration and message flow notes (Chinese)](docs/server-v6.md). The v7 line is unchanged in this release.
First, copy .env.example to .env and configure the environment variables.
Copy app.conf.example to app.conf in the conf directory and set the Redis address to your deployed Redis address. For existing deployments, merge the new settings instead of overwriting your ports, Redis credentials, and callback URL.
Keep MODE=polling in .env and syncmessage=false, msgpush=false on the server. Server-side message archiving now defaults to SQLite at host path ./server-data/messages, independent of the bot database under ./config. Puppet 6.0.12 supports message-bearing callbacks and binary file sections. To switch to callback mode, also configure msgpush=true and a reachable callback URL on the server; see the linked notes.
Create a docker-compose.yml file:
version: '3'
services:
wx2tg-v3:
image: finalpi/wechat2tg-v3:v6.0.12
container_name: wx2tg-v3
# ports:
# - "8056:8056" # Only for external callbacks; not needed within the Compose network
volumes:
- ./config:/app/storage
- ./save-files:/app/save-files # After mounting save-files folder, sticker files do not need to be converted again
env_file: ".env"
restart: unless-stopped
depends_on:
- wx2tg-server
wx2tg-server:
image: finalpi/wx2tg-server:v6.0.12
container_name: wx2tg-server
ports:
- "8058:8058"
volumes:
- ./conf:/usr/wic-go/conf
- ./server-data:/usr/wic-go/data
- ./server-logs:/usr/wic-go/logs
environment:
MESSAGE_STORE_POSTGRES_DSN: "${MESSAGE_STORE_POSTGRES_DSN:-}"
restart: unless-stopped
depends_on:
- wx2tg-redis
wx2tg-redis:
image: redis:7.2
container_name: wx2tg-redis
ports:
- "16379:6379"
volumes:
- ./redis-data:/data
command: ["redis-server", "--appendonly", "yes"]
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 30s
timeout: 10s
retries: 3
restart: unless-stopped
docker-compose up -d
Disable the bot's privacy mode. Open BotFather, enter /mybots, select your bot. Click Bot Settings - Group Privacy - Turn off. When Privacy mode is disabled for xxx appears, it means the disabling is successful.
/login: Get login QR code; the first person to send this command during initial deployment will become the bot owner
/logout: Logout and delete login cache
/update: Update group avatar and nickname information
/message: Toggle group message reception
/forward: Toggle forwarding of messages from other people or bots in the group
/user: Get WeChat user list; click the button to create a new group or bind a user (can search by name or remarks, e.g., /user Zhang to find WeChat users containing "Zhang")
/room: Get WeChat group list; click the button to create a new group or bind a WeChat group (can search by name or remarks, e.g., /room takeout to find WeChat groups containing "takeout")
/revoke: Revoke message (reply to the message to be revoked)
/relogin: Secondary login (use only when unexpectedly logged out after login, try to login with previously cached login information)
/getqr: Get personal QR code information
/settings: Program settings
/ai: Generate AI reply suggestions from the current WeChat chat context (for example, /ai make it more polite; use /ai context 30 to save the default context message count, or /ai -n 30 make it more polite to override it for one request)
/unbind: Unbind WeChat group or WeChat user (only supported in group usage)
/quit: Exit and disband group
| Name | Required | Description |
|---|---|---|
BOT_TOKEN | Yes | Telegram Bot token, created via BotFather |
API_ID | Yes | Telegram API ID |
API_HASH | Yes | Telegram API HASH |
DEVICE_TYPE | Yes | WeChat login protocol: ipad, car, mac, pad, win, ipadX |
BASE_API | Yes | wx2tg-server container API request address, full path required |
PROXY_PROTOCOL | No | Proxy type optional values (socks5, http, https) |
PROXY_HOST | No | Proxy URL |
PROXY_PORT | No | Proxy port number |
PROXY_USERNAME | No | Proxy username |
PROXY_PASSWORD | No | Proxy password |
ROOM_MESSAGE | No | Display format of WeChat group messages in Bot |
OFFICIAL_MESSAGE | No | Display format of official account messages in Bot |
CONTACT_MESSAGE | No | Display format of WeChat user messages in Bot |
ROOM_MESSAGE_GROUP | No | Display format of WeChat group messages in group |
CONTACT_MESSAGE_GROUP | No | Display format of WeChat user messages in group |
OFFICIAL_MESSAGE_GROUP | No | Display format of official account messages in group |
CREATE_ROOM_NAME | No | Format of group name when automatically creating WeChat groups |
CREATE_CONTACT_NAME | No | Format of group name when automatically creating WeChat contacts |
MESSAGE_DISPLAY | No | Display format of text messages |
AI_API_KEY | No | OpenAI-compatible API key for /ai reply suggestions |
AI_API_URL | No | OpenAI-compatible chat completions URL, e.g. https://api.openai.com/v1/chat/completions |
AI_MODEL | No | AI model name, default: gpt-4o-mini |
AI_CONTEXT_LIMIT | No | Fallback default number of recent WeChat conversation messages used as AI context, default: 20; runtime default can be saved with /ai context <count> and overridden per request with /ai -n <count> |
/settingsWeChat emoji display as image links: When enabled, friend-sent Minions emojis will be converted to image links
Synchronize group information on startup: When enabled, all user information will be synchronized when the program starts, updating group avatars and names
Configure TENCENT_SECRET_ID and TENCENT_SECRET_KEY, which can be activated in the Tencent Speech Recognition Console. Free usage quota is available.
Enable automatic text-to-speech function in /settings
API_ID and API_HASHLog in to telegram account
Click "API development tools" and fill in application details (only application title and short name are required)
Finally, click "Create application"
If you want to modify the message sender's format, you can modify the environment variables in docker or the .env file
Custom message template placeholders:
#[alias]: Contact remarks
#[name]: Contact nickname
#[topic]: Group chat nickname
#[alias_first]: Remarks priority, if no remarks, display contact's nickname
#[identity]: Identity information text
#[body]: Message body text
#[br]: Line break
Send a message starting with @all to @everyone, only supports text messages @everyone
wx2tg-server needs to be in the same region as your login. If you encounter a verification code prompt, check if they are in the same region.
If not in the same region, you can configure WeChat proxy login in environment variables, or migrate already logged Redis data.
Fork the project and create a feature branch from v6; keep v7 work separate.
Submit a Pull Request to the matching maintenance branch and follow the release rules (Chinese).
Thanks to Jetbrains for supporting this project
Content type
Image
Digest
sha256:3fc2261fd…
Size
555.3 MB
Last updated
27 days ago
docker pull finalpi/wechat2tg-v3