中文 | English
Transmit WeChat messages on Telegram, supporting multiple WeChat protocols (iPad, Mac, Car, Windows, Pad)
Telegram Group: @Wx2TgUserGroup
Warning
According to feedback, the Windows protocol has the risk of account suspension, please do not use this protocol
- Receive messages from WeChat personal chats, group chats, official accounts, and enterprise WeChat
- Send messages via Telegram to specific WeChat users, groups, and official accounts
- Flexible group message blocking functionality
- Text messages
- Enterprise WeChat messages
- WeChat stickers
- Image messages
- Video messages
- Audio/Video calls (notification only)
- File messages
- Link messages
- Group chat messages
- Group chat @mentions (converts @everyone and @you to Telegram @you)
- Official account messages
- Emoji
- Location messages
- Message recall
- Voice messages
- Red packet messages (notification only, cannot retrieve content)
- Mini program messages
- Text messages
- Sticker emotes
- Image messages
- Video messages
- File messages
- Voice messages
- This project is for technical research and learning purposes only, strictly prohibited for illegal use
- Welcome to submit issues for any problems encountered during use
- Ensure that the IP of wx2tg-server matches the login region, otherwise verification code may be required
- On arm-64 architecture, due to missing dependencies, the wx2tg-server image cannot be used.
- After logging in, you may be logged out once after one day; after logging in again, the connection will remain stable.
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.
Create a docker-compose.yml file:
version: '3'
services:
wx2tg-v3:
image: finalpi/wechat2tg-v3:latest
container_name: wx2tg-v3
# ports:
# - "8056:8056" # Only needed for callback mode
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:v3-latest # Pull image
container_name: wx2tg-server
ports:
- "8058:8058"
volumes:
- ./conf:/usr/wic-go/conf
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-stoppeddocker-compose up -dDisable 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 Zhangto 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 takeoutto 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 -
/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 |
-
WeChat 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_IDandTENCENT_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
-
Log 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, switch to the
wx2tg-v3-devbranch, or create a new branch. Please do not directly submit code to the main branch. -
Submit a Pull Request to the
wx2tg-v3-devbranch
Thanks to Jetbrains for supporting this project
