Puppet Provider: WhatsApp
WhatsApp is the most popular Instance Messaging service in many parts of the world. With the WhatsApp Wechaty Puppet Provider, you can reach more than 1.5 billion WhatsApp users. You can send notifications, have two-way conversations, by building chatbots. If you're trying to reach and better converse with users in the west world, you need to consider using WhatsApp.
With the introduction of wechaty puppet and the growth of the wechaty ecosystem and community, we’re happy to introduce wechaty-puppet-whatsapp which connects Wechaty API, the conversational RPA SDK for chatbot makers, and WhatsApp, a free, multi-platform messaging app.
The WhatsApp Wechaty Puppet Provider is now available in alpha stage, to allow developers to start building and prototyping in your developing environments.
As a developer, you can use wechaty-puppet-whatsapp to build your own WhatsApp chatbot with a few lines of code, which can send and receive WhatsApp messages with wechaty API.
- Repo: https://github.com/wechaty/wechaty-puppet-whatsapp
- Support & Feedback: https://github.com/wechaty/wechaty-puppet-whatsapp/issues
- npm package: https://npmjs.com/package/wechaty-puppet-whatsapp
- Built on top of whatsapp-web.js, which is a WhatsApp client library for NodeJS.
- Creator of whatsapp-web.js is @pedroslopez.
Features
- Send & receive messages
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`.
- Install the dependencies using the following commands:
- Add the dependencies for using the bot with Whatsapp.
- Create a new folder `src` and add a file `my-bot.js`. Add your custom functions to the code snippet below:
- After you are done with the file, you can run the bot using the following commands:
mkdir my-bot
cd my-bot
npm install wechaty
npm install qrcode-terminal
npm install wechaty-puppet-whatsapp
import {
Wechaty,
ScanStatus,
log,
} from 'wechaty'
import qrcodeTerminal from 'qrcode-terminal'
console.log(welcome)
const bot = new Wechaty()
/*
*Your function goes here
*/
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 read more about deploying a whatsapp puppet here.
Features to be implemented
Here are some features to be implemented :
Feature | Status |
---|---|
Send and Receive text messages | ✅ |
Send media (images/audio/documents) | ❌ |
Send video | ❌ |
Receive Video | ❌ |
Receive media (images/audio/video/documents) | ❌ |
Send contact cards | ❌ |
Get invite for group | ❌ |
Modify group subject | ❌ |
Add group participants | ❌ |
Kick group participants | ❌ |
Mention users | ❌ |
Get contact info | ❌ |
Get profile pictures | ❌ |
Set user status message | ❌ |
History
Contributing
Feel free to file an issue on the github repo for any feedback.
wechaty-puppet-whatsapp is an open-source project. If you’re interested in contributing to this project, check out the contribution guidelines to learn more, and welcome to join the Wechaty Developers’ Home or our Gitter network to join our community.