Connecting WeChat and Telegram with ehForwarderBot

1. Why

WeChat is getting more and more bulky. The newest version on iOS is now of 230MB size. For people who only use WeChat to “chat”, many of the features are not quite useful, such as Moments (朋友圈), Shake (摇一摇), Top Stories (看一看), Message in a Bottle (漂流瓶), etc.. I am one of these people. In addition, in its major upgrade to version 7.0.x, the interface has been re-designed to match the popular minimal flat design trend. The color is too bright for me. These two reasons drove me to look for a substitute for WeChat, that has nothing but the basic chat function, supports dark UI theme, and runs smoothly on iOS.

I noticed Telegram as it is exactly what I wanted: simple, supports dark theme, and smooth. In fact, it is so smooth that you won’t even notice it’s a third-party app instead of Apple’s own. It would be nice if I can send and receive WeChat messages using Telegram. Fortunately, the ehForwarderBot project works like a charm. It utilizes Web WeChat functionals. You can create a robot, authorize it with your Telegram’s token, and login to your WeChat by scanning a QR code. Then the bot will forward everything you receive to your Telegram, in your conversion with your bot, and whatever you reply to the bot will be forwarded to WeChat, back to your friends.

The bot needs to be hosted somewhere. If we are going to use a machine of our own, it has to - remain powered on at all times. A messaging forwarding service that works intermittently is no good service. Therefore I considered using Google’s cloud engine. Upon registration you will get $300 credit for use, which will remain valid for one year or until it is exhausted, whichever is earlier.

After all this reasoning and introduction, let’s now move on to the “how to” part.

2. How

2.1 Configure Telegram
  1. search for “get_id_bot”, and get your Telegram ID

  2. search for “botfather” in Telegram

  3. type in /newbot

  4. follow the prompts to name your new bot

  5. follow the prompts to set a username for your bot

  6. you will be given a token to access the HTTP API; keep it safe

  7. send /setprivacy, and choose “disable” for your bot

  8. send /setjoingroups, and choose “enable” for your bot

  9. send /setcommands, and send the following:

    link - 将会话绑定到

    chat - 生成会话头

    recog - 回复语音消息以进行识别

    extra - 获取更多功能

2.2 Set up the Server

Register at Google Cloud. Click on “get started for free”, add necessary info, and start your free trial. Select “compute engine”, choose “enable billing”, and create a VM instance. I personally refer the most basic configuration - no powerful CPU, no GPU, no big hard drive. The monthly cost is cheaper than a cup of coffee!

The created instance can be accessed via SSH (please do not try to access the IP in the pic as I have deleted it now).

After opening a cloud console, some dependencies need to be installed. We will use a Docker version of ehforwarderbot, which is relatively stable than the current version on Github.

sudo apt-get update
sudo apt-get -y install apt-transport-https ca-certificates curl
curl -fsSL | sudo apt-key add - # should print "OK"
sudo add-apt-repository "deb [arch=amd64] $(lsb_release -cs) stable"
sudo apt-get update

sudo apt-get -y install docker-ce
sudo usermod -a -G docker $USER   ## log out after this step; simply close the console and reopen
docker pull royx/docker-efb

Next, we create a directory to hold data for efb:

mkdir efb
cd efb
touch tgdata.db

Then create another file via vi, and replace the token with the token you had in Section 2.1, and the admins as your Telegram ID, also obtained in Section 2.1.

master_channel = 'plugins.eh_telegram_master', 'TelegramChannel'
slave_channels = [('plugins.eh_WeChat_slave', 'WeChatChannel')]

eh_telegram_master = {
    "token": "12345678:QWFPGJLUYarstdheioZXCVBKM",
    "admins": [13456782]
2.3 Run the Bot

In your cloud console, type

docker run -d --restart=always --name=ehforwarderbot -v /efb/ -v /efb/tgdata.db:/opt/ehForwarderBot/plugins/eh_telegram_master/tgdata.db royx/docker-efb

docker logs ehforwarderbot 

Scan the QR code using your WeChat’s scan function, and login. Now you can disable notifications of WeChat and only leave Telegram on!

2.4 When Things Go Wrong

There are times when WeChat increases its monitor for user accounts, and those whose account stay online for web WeChat might get forced to log off. In these cases, my recommendation is to wait for a few hours or one day, and restart the bot. To restart, go to Google Cloud Computing, use SSH to connect to your server, stop and remove the current container first:

docker container stop ehforwarderbot
docker container rm ehforwarderbot

Next, just repeat the two steps in 2.3, and your bot will be happily running again!

3. Pros and Cons

3.1 Pros
  • Seamless messaging experience!
  • You won’t be limited by the number of devices. While WeChat only allows at most one device other than your phone to be online, Telegram allows multiple devices to be online together. See Telegram Desktop.
  • Unlike WeChat, which is mostly used by the Chinese community, Telegram is used by people all over the world. This means there is a huge collection of stickers that you can use. You can even find Lord Voldemort!


* Telegram is open source, and all source codes can be found on GitHub. Compared to a blackbox, more transparency is always preferred. * While WeChat’s interface is relatively fixed, and you can only change the chat background, Telegram gives you the options to customize the text size, the color theme, in addition to the chat background.
3.2 Cons

The are a few caveats that need to be kept in mind while using ehforwarderbot.

  • You won’t receive notifications for WeChat video or audio calls if WeChat is not running in the background.
  • You won’t be able to send or receive red packets; neither will you be able to use WeChat’s stickers; most of the time, emoji and Telegram’s stickers can provide good substitutes.
  • All conversations will be forwarded to the main chat with your bot, which will sometimes cause confusions
    • the solution to this is to create new group chats for every one. For example, if I want to single out the chat with John Doe, whose WeChat name is JohnDoe, I first use Telegram’s “create group” to make a group, inviting my bot to join, and name the group John Doe. Next I’ll type /link JohnDoe, and choose to link the slave chat to the new group I just set up. Now conversations with John Doe will be forwarded to this separate chat.
  • There could be delays as our messages traveled all the way to Google’s cloud service, and then back to us, but the delay is usually within 2 seconds, which should not be a big problem.
Yishu Xue
Yishu Xue
Data Scientist / Coder / Novice Sprinter / Gym Enthusiast

The night is dark and full of terrors.