Wechaty Getting Started 
Wechaty is a RPA SDK for Chatbot Makers. It's well designed with an easy to use API, supports all OSs including Linux, OSX, Win32, Docker, and lots of IMs including WeChat, WeCom, Whatsapp, Lark, Gitter, etc.
As a developer, you can use Wechaty to easily build your bot, effectively manage message sending/receiving, room creating/inviting, contact friendship, and delightful add artificial intelligence between users and your bot.
This repository should work out-of-the-box, and is the best start point for Wechaty beginners.
Features
- Works out-of-the-box under Linux/Mac/Windows.
- Supports all puppets like Web, Pad, Windows, and Mac.
- Reply a
dongmessage when it received ading.
Requirements
- Node.js v12+
- Build Tools for your platform
- Wechaty Puppet Service TOKEN (if you want to use RPA protocols other than Web)
- Apply from our Wechaty Puppet Service Providers
Getting Started
1 Install Node.js (>=12)
If you have not installed Node.js(or version is below 10),You need to install the latest version of Node.js first by following the links below:
Instal Node.js for other platforms can be found at https://nodejs.org/en/download/package-manager/
2 Clone this Repository
git clone https://github.com/wechaty/wechaty-getting-started.git
cd wechaty-getting-started
3 Install Dependencies
npm install
4 Run the Bot
npm start
Or use node to run bot directly
# Linux: export WECHATY_LOG=verbose
# Win32: set WECHATY_LOG=verbose
npx ts-node examples/ding-dong-bot.ts
You are all set!
Working with Different Puppets
By default, the Wechaty will use the Puppet Service for logging in your bot. You can use other Puppet Provider like Web protocol (wechaty-puppet-puppeteer) for logging in bot.
If you want to use a Wechaty Puppet Provider for different protocols, then you need to specified a puppet service provider name (the same as its NPM name) by setting the WECHATY_PUPPET environment variable.
Thanks for the great contributions from our great community, there are many puppet service providers can be used by Wechaty, which helps us to use protocols like Web, Pad, Mac, and Windows.
Wechaty Puppet Service Providers
| Protocol | NPM |
|---|---|
| Web | wechaty-puppet-puppeteer |
| Service | wechaty-puppet-service |
| PadLocal | wechaty-puppet-padlocal |
Visit our website for learning more about Wechaty Puppet Service Providers
For example, if you want to use the padlocal puppet, you should set WECHATY_PUPPET=wechaty-puppet-padlocal before you run npm start.
You also need a TOKEN for the
wechaty-puppet-padlocal, and set it to theWECHATY_PUPPET_PADLOCAL_TOKENenvironment variable.
Linux
export WECHATY_PUPPET=wechaty-puppet-service
export WECHATY_PUPPET_SERVICE_TOKEN='your_token_here'
npm start
Windows
set WECHATY_PUPPET=wechaty-puppet-service
set WECHATY_PUPPET_SERVICE_TOKEN='your_token_here'
npm start
Advanced
1 Wechaty Tutorial
Above is a 10 minute video tutorial(a little outdated, it's running under v0.14 or older versions of Wechaty), which is a good way to start if you are new to Wechaty.
2 More Examples
Note: Please make sure you can run
npm startwith this repository first before you go furture with more examples!
API REFERENCE
- GitBook: https://wechaty.js.org/api
SEE ALSO
1 Docker Wechaty Getting Started
https://github.com/Chatie/docker-wechaty-getting-started
2 Heroku Wechaty Getting Started
https://github.com/Chatie/heroku-wechaty-getting-started
3 Wechaty Home
FAQ
1. I can not login with my Wechat account
WeChat account that registered after 2017 will not be able to login via Web API. Learn more at https://github.com/Chatie/wechaty/issues/872
Solution: Wechaty support protocols other than Web API, such as pad. Learn more at https://github.com/Chatie/wechaty/issues/1296
2. What is a Puppet in Wechaty
The term Puppet in Wechaty is an Abstract Class for implementing protocol plugins. The plugins are the component that helps Wechaty to control the Wechat(that's the reason we call it puppet).
The plugins are named PuppetXXX, like PuppetPuppeteer is using the google puppeteer to control the WeChat Web API via a chrome browser, PuppetPadchat is using the WebSocket protocol to connect with a Protocol Server for controlling the iPad Wechat program. More detail you could go Puppet in wiki.
Learn more about Wechaty Puppet from our documentation at Wechaty Puppet
Wechaty Getting Started in Multiple Languages
- TypeScript Wechaty Getting Started
- Python Wechaty Getting Started
- Go Wechaty Getting Started
- Java Wechaty Getting Started
- Scala Wechaty Getting Started
- PHP Wechaty Getting Started
- .NET(C#) Wechaty Getting Started
Contributors
Maintainers
Copyright & License
- Code & Docs © 2018-now Huan and Wechaty Community Contributors (https://github.com/wechaty)
- Code released under the Apache-2.0 License
- Docs released under Creative Commons
