中文 | English
Transmit WeChat messages on Telegram, supporting multiple WeChat protocols (iPad, Mac, Car, Windows, Pad)
Current stable release: v6.0.41 — static sticker photos, red-packet amounts on the original button, improved WebUI input and previews, consistent templates, avatar deduplication, and a slimmer image. See the release notes and upgrade guidance.
Warning
According to feedback, the Windows protocol has the risk of account suspension, please do not use this protocol
New groups are organized into WeChat, WeChat 2, WeChat 3, and so on using the logged-in account’s Telegram limits. If no folder slot remains, group creation, binding, and forwarding still succeed; the chat stays available in All Chats. Existing settings and unrelated/shared folders are preserved. See folder allocation and failure behavior (Chinese).
Optionally set OFFICIAL_ACCOUNT_TOPICS_ENABLED=true and restart. The first official-account message automatically provisions one private forum, with a separate topic per account. Future messages use those topics and replies route back to the matching account; General never routes to WeChat. The feature defaults off, retains old groups/bindings, and restores old routing when disabled. See official-account topics (Chinese).
WECHAT_CUSTOM_EMOJI_ENABLED=true renders native [微笑] / [Facepalm] tokens inline using WeChatPack, preserving rich text and ordinary Unicode emoji. Sending eligibility includes a Premium bot owner or an eligible Fragment username. Enabled by default in auto mode, with button-icon eligibility checks before delivery and compatible output when eligibility is unknown or unavailable. The WebUI shows detection results and supports rechecking or explicit disable. Unknown tokens remain unchanged. See mapping, coverage and limits (Chinese). Available starting with v6.0.13-dev.3.
The WebUI starts with the application; the current React interface is primarily Chinese. Docker Compose exposes TCP 17863 on all host interfaces by default: open http://<server-address>:17863/. Local development listens on loopback by default: http://127.0.0.1:17863/. WebUI and MCP share the same port; the MCP path is /mcp.
The same WebUI can open from the owner’s private-chat 控制台 menu. Configure WEBUI_MINI_APP_URL=https://your-domain/ and restart the Bot: the backend verifies Telegram signatures and permits only the existing bot owner, without entering a WebUI token. Ordinary browser login remains available. The message page uses SSE change notifications instead of five-second polling. A reachable HTTPS root URL and an SSE-compatible reverse proxy are required; see setup and security boundaries. Available since v6.0.35; use v6.0.36 or later for the private-chat menu fix.
WEBUI_TOKEN (at least 16 characters), or the generated storage/webui-token. Sign-in opens chat by default. Ordinary browsers save the access token locally for refresh/reopen; Mini App sessions remain separate and memory-only. Signing out or a rejected token clears saved credentials.Important
**WebUI chat is currently intended mainly for viewing simple messages such as text, with limited send, quote, recall and synchronization operations. It does not fully support every WeChat message type and is not a replacement for the WeChat client.** A summary, link or attachment entry does not mean that a message type is fully decoded, interactive or comprehensively verified. Use WeChat for the complete experience.
Use /chat for chat and /manage for settings. Implemented features retain SSE-driven updates without periodic message/contact polling; desktop focus mode and chat/settings switching preserve in-window chat drafts and reading position. See PWA/chat boundaries, directory/menu capabilities and WebUI development.
Enter an OpenAI-compatible API URL and key, read the provider's model list, select a model, and test the connection before saving. The current model tools use the saved key; do not assume an unsaved replacement key is being tested. Save and review configuration when changing provider origin. Checks use a generic test prompt, never conversation history. /ai generates contextual reply suggestions; it does not automatically send them.
Configure Tencent Cloud ASR credentials and enable automatic voice transcription through WebUI or /settings.
Manage MCP directly in the WebUI MCP access page:
| Tool | Purpose |
|---|---|
wechat_status | WeChat / Telegram connection status |
wechat_search_contacts | Search contacts and groups |
wechat_get_group_members | Search group members and obtain IDs for native mentions |
wechat_list_conversations | List saved conversations by recent activity |
wechat_read_messages | Search and paginate conversation history |
wechat_get_new_messages | Read new incoming messages using a persistent cursor |
wechat_send_text | Send authorized text with an idempotent request ID |
wechat_revoke_message | Recall an eligible own message with explicit confirmation |
wechat_send_media | Send an uploaded attachment, or a local file through the bridge |
wechat_download_attachment | Download ordinary or merged-history attachments |
wechat_get_send_status | Check WeChat submission and Telegram synchronization |
MCP uses the existing WeChat login and send queue. Reading messages does not wake an idle AI or enable automatic replies. Cursor-based reception is separate from Telegram unread counters. See MCP setup, parameters, and client examples.
| Storage file / directory | Purpose | When changes apply |
|---|---|---|
storage/webui-config.json | WebUI environment overrides | Restart the application |
storage/db/wx2tg.db | Bot bindings and runtime preferences | Preferences apply immediately; startup synchronization runs on next startup |
storage/db/webui-messages.db | Message center history and delivery tracking | Immediately |
storage/webui-media / storage/webui-avatars | Attachments and avatar cache | Immediately |
storage/mcp-settings.json | MCP enablement, client settings, and tokens | Immediately, including token rotation |
storage/webui-token, storage/mcp-token, storage/mcp-read-token | Generated access credentials | Used for their respective interfaces |
Docker mounts ./config as /app/storage; back it up with save-files, conf, and redis-data. WebUI environment overrides take priority over .env and container environment variables. To restore an environment default, stop the app, remove that key from webui-config.json, and restart. Saved MCP settings take priority over MCP_ENABLED, MCP_TOKEN, and MCP_READ_TOKEN; these variables initialize settings before the first WebUI MCP save. WEBUI_CONFIG_PATH relocates the WebUI file and MCP settings/token directory.
Normal startup leaves the WebUI available if Telegram credentials are missing. For setup without clients or a database, use npm run build then npm run webui; stop the standalone process before starting the normal app. Standalone mode cannot manage bot database preferences or send messages.
See the release notes for updates.
For a new deployment, copy .env.example to .env and configure the environment variables. Never overwrite existing private configuration, including the user’s home_202.env; merge required changes manually.
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.
Use Docker Engine with Docker Compose v2, or Node.js 18+ for local development. Native SQLite, image-processing, and media-conversion dependencies must match the runtime platform.
The Compose example below uses finalpi/wechat2tg:latest and finalpi/wx2tg-server:v6-latest. Save it as docker-compose.yml; no WebUI override is needed.
The commands below initialize a new stack. For an existing deployment, review your local Compose and preserve private configuration, then update the bot with docker compose pull wechat2tg and docker compose up -d --no-deps wechat2tg.
test -e .env || cp .env.example .env
mkdir -p conf
test -e conf/app.conf || cp app.conf.example conf/app.conf
docker compose pull
docker compose up -d
docker compose exec wechat2tg cat storage/webui-token
In .env, fill in BOT_TOKEN, API_ID, and API_HASH, or enter them through WebUI and restart the app after saving. The bundled example uses BASE_API=http://wx2tg-server:8058/api and redislink=wx2tg-redis:6379. Keep those Compose service names if using the bundled stack.
Open http://<server-address>:17863/ and sign in with the token. Then use Telegram /login to sign in to WeChat. Missing credentials leave the configuration page available. After saving environment settings in WebUI:
docker compose restart wechat2tg
Example Compose configuration:
services:
wechat2tg:
image: finalpi/wechat2tg:latest
container_name: wechat2tg-v6
environment:
WEBUI_ENABLED: "${WEBUI_ENABLED:-true}"
WEBUI_HOST: "0.0.0.0"
WEBUI_PORT: "${WEBUI_PORT:-17863}"
ports:
- "${WEBUI_BIND_ADDRESS:-0.0.0.0}:${WEBUI_PORT:-17863}:${WEBUI_PORT:-17863}"
# - "8056:8056" # callback 模式且需宿主机访问时启用 / Optional callback exposure
volumes:
- ./config:/app/storage
- ./save-files:/app/save-files # 保存文件夹挂载后贴纸文件不需要重新转换
env_file: ".env"
restart: unless-stopped
depends_on:
- wx2tg-server
wx2tg-server:
image: finalpi/wx2tg-server:v6-latest
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
| Host port | Service | Default exposure |
|---|---|---|
TCP 17863 | WebUI and MCP (/mcp) | All host interfaces |
TCP 8058 | WeChat protocol service | As defined in Compose |
TCP 16379 | Redis (6379 inside the container) | As defined in Compose |
TCP 8056 | Optional callback mode | Commented out; enable only if needed |
Set WEBUI_PORT in .env to change both the container listener and published WebUI port. Set WEBUI_BIND_ADDRESS=127.0.0.1 for local-only access. Compose always uses WEBUI_HOST=0.0.0.0 inside the container. Port/binding or .env changes require recreating the container (docker compose up -d); a process restart alone does not change Docker port mappings.
For Internet access, route a configured HTTPS endpoint to the WebUI port and set that public /mcp URL in the MCP access page. Allow the chosen TCP port through your firewall and router/forwarding setup as applicable. A self-signed deployment needs its CA trusted by the client; the stdio bridge can use NODE_EXTRA_CA_CERTS=/absolute/path/to/ca.pem while retaining TLS validation. Deployment-specific IPs, ports, paths, and certificates belong in private configuration.
npm install
npm run build
npm run dev
Open http://127.0.0.1:17863/. npm start runs compiled production code. Use .env.example for configuration and keep native dependencies aligned with your OS.
npm run test:webui
npm run test:mcp
docker compose logs --tail=100 wechat2tg
Tests use isolated message fixtures; they do not send to real WeChat contacts.
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: List WeChat contacts, excluding official accounts; search by name or remark, e.g. /user Zhang, then create a group or bind the contact.
/official: List official accounts separately; search by name or remark, e.g. /official WeChat Pay, then create a group or bind the account to the current Telegram group.
/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")
/contacts [name or remark]: Read-only contact directory. Select a name to view cached WeChat ID, username, remark, region, signature and other available details; pagination and Back preserve your position. Never binds or creates groups. Without arguments in a Telegram group/topic bound to an individual contact, shows that contact directly (also with /contacts@your_bot). An explicit search still opens the list.
/members [group name or remark]: Select a WeChat group, browse its members and open member details. Supports pagination and returning to the original group list. Without arguments in a bound Telegram group or topic, opens the corresponding WeChat group directly. Only known profile fields are displayed.
/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
Contact, official-account, and group searches also support bot mentions in groups:
/user@your_bot Zhang San
/official@your_bot WeChat Pay
/room@your_bot Project A (Development)
Replace @your_bot with your bot username. Queries preserve internal spaces and punctuation. List buttons show names or remarks without an added emoji prefix.
Starting with v6.0.15, directories use native Telegram RichMessage: click names and navigation directly inside the message, without duplicate lists or start-link redirects. Pages retain 30 entries, search and Back state. An explicit compatibility mode uses a compact ordinary keyboard, with bounded safe fallback. See directory pagination (Chinese).
| 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 c |
Content type
Image
Digest
sha256:556420c92…
Size
340.8 MB
Last updated
about 2 hours ago
docker pull finalpi/wechat2tg:v6-dev