This project creates a bridge between a whatsapp chat and a telegram channel, ie you could recieve the messages sent on whatsapp through telegram.
It is recommended that you use Node and NPM locally and use Docker if you wanna deploy, as the container is very large.
-
Create a
settings.json
file from thesettings.example.json
. In thePIPES
key store your all your required whatsapp chat's names. -
Create a telegram bot. Find the API key, and store it as value of key
TOKEN
. -
If you want to use it for a private channel, follow this link, and obatin
chat_id
If you don't mind creating a public channel, create it and obtain
chat_id
(@your channel name in url) -
Add
chat_id
to your corresponding whatsapp chat's key. -
Run
npm install npm start
-
It will display a QR code for whatsapp authentication, scan the QR code using whatsapp. You won't have to do this again.
-
Run the script and login locally.(This is important as we need that session data)
-
Deploy the docker container with a cloud service(Heroku is free).
-
Set
TOKEN
environment variable with yourBOT_API_KEY
-
Set
PIPES
environment variable as a JSON String of your Whatsapp-Telegram Pipes.
Settings can be stored in a json file or as environment variables.
The BOT_API_TOKEN
obtained while creating your telegram bot.
The mappings between whatsapp chats and telegram channel. Must be stored as JSON. Can have multiple pipes.
Show or hide default header.
Sent from whatsapp chat: $chat_name
Sent by: $sender
Currently headers don't work for attachments.
Default is true
Add your own header to all messages sent except attachments.
Note: Passing a CUSTOM_HEADER
won't disable DEFAULT_HEADER
, you have to explicitly set it to false
.
-
Since WhatsApp has no official API, the API used is based on WhatsApp Web. So you can't use WhatsApp Web while running this.
-
WhatsApp Web relies on your phone's internet too, so even if you deploy this on a server, your phone must have 24x7 internet access too.
Whatsapp API - Venom
Telegram Bot API - node-telegram-bot-api