Deploy in WhatsApp
WhatsApp is the most popular IM platform, so this how to guide focuses on deploying the bot in WhatsApp locally. You will learn how to deploy the bot in WhatsApp locally and integrate bot from the list of examples present in the starter templete.

Requirements
- Your system must have Node.js installed (version >= 16).
- Your system must have Wechaty (version >= 0.40).
Deployment
Run wechaty-puppet-whatsapp:
- Linux
- macOS
- Windows
npm install wechaty-puppet-whatsapp
export WECHATY_PUPPET=wechaty-puppet-whatsapp
npm start
npm install wechaty-puppet-whatsapp
export WECHATY_PUPPET=wechaty-puppet-whatsapp
npm start
npm install wechaty-puppet-whatsapp
set WECHATY_PUPPET=wechaty-puppet-whatsapp
npm start
Integrating a Bot to WhatsApp
Let's take up an example on how to integrate bot from starter templete to WhatsApp.
The steps are similar for all other bots as well.
Prerequisite
- Offical Wechaty package: package/wechaty.
- QRCode terminal edition: package/qrcode-terminal.
You can follow up the steps mentioned below:
- Initialize the project by creating a new folder
my-bot.
mkdir my-bot
cd my-bot
- Install the dependencies using the following commands:
npm install wechaty
npm install qrcode-terminal
- Add the dependencies for using the bot with WhatsApp.
npm install wechaty-puppet-whatsapp
- Create a new folder
srcand add a filemy-bot.js. Add your custom functions to the code snippet below:
import {
Contact,
Message,
ScanStatus,
Wechaty,
log,
} from 'wechaty'
import qrTerm from 'qrcode-terminal'
console.log(welcome)
const bot = new Wechaty()
/*
*Your function goes here
*/
- After you are done with the file, you can run the bot using the following commands:
export WECHATY_LOG=verbose
export WECHATY_PUPPET=wechaty-puppet-whatsapp
node src/my-bot.js
Scan it using your WhatsApp and you are ready to play with the bot!
You can deploy the bot with popular container solutions as well such as:
References
- Find out some more information about WhatsApp puppet from wechaty-puppet-whatsapp.
- Get the starter template from wechaty-getting-started.
- Find out about other puppet as well from docs/puppet-providers.