Wechaty is a Conversatioanl 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.
If you have any questions, please join our Gitter at https://gitter.im/wechaty/wechaty
The fatest way to getting started with Wechaty is to use a Cloud IDE.
If you have no idea about anything, then you should try Gitpod first.
Use Gitpod to run our Wechaty Getting Started ding-dong BOT instantly inside your browser!
Learn more about Gitpod ❤️ Wechaty from our blog: Getting Started Without Leave Your Browser: Wechaty ❤️ Gitpod, @huan, Feb 06, 2021
Generated via open-in-cloud-shell
The Google Cloud Shell should open our tutorial in the right panel for you, please follow it to finish the tutorials.
Learn more from our blog: Google Cloud Shell Tutorials for Wechaty, @huan, Feb 20, 2021
dong
message when it received a ding
.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/
git clone https://github.com/wechaty/wechaty-getting-started.git
cd wechaty-getting-started
npm install
You might want to use taobao registry mirror for NPM:
npm --registry=https://registry.npm.taobao.org install
You mignt need windows-build-tool if you are using windows:
npm install windows-build-tools
You can use export
to set environment variables in Linux, and use set
in Windows.
export WECHATY_LOG=verbose
export WECHATY_PUPPET=wechaty-puppet-wechat
npm start
# the above is equals to the below command:
# npx ts-node examples/ding-dong-bot.ts
set WECHATY_LOG=verbose
set WECHATY_PUPPET=wechaty-puppet-wechat
npm start
# the above is equals to the below command:
# npx ts-node examples/ding-dong-bot.ts
You are all set!
In our getting started example, the ding-dong BOT is using wechaty-puppet-wechat4u when WECHATY_PUPPET
is not set, which is just for newcomer's convenience.
By default, the Wechaty will use the Puppet Service for logging in your bot. You can use other Puppet Provider like Whatsapp Web protocol(wechaty-puppet-whatsapp).
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 Wechaty Puppets can be used by Wechaty, which helps us to use protocols like Web, Pad, Mac, and Windows.
Protocol | NPM |
---|---|
Puppet Service | wechaty-puppet-service |
Whatsapp Web | wechaty-puppet-whatsapp |
WeChat Web | wechaty-puppet-wechat |
WeChat Pad | 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_TOKEN
environment variable. Apply the PadLocal TOKEN from here
export WECHATY_PUPPET=wechaty-puppet-padlocal
export WECHATY_PUPPET_PADLOCAL_TOKEN='puppet_padlocal_your-token-here'
npm start
set WECHATY_PUPPET=wechaty-puppet-padlocal
set WECHATY_PUPPET_PADLOCAL_TOKEN='puppet_padlocal_your-token-here'
npm start
Learn more about how to install under windows from this blog post.
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.
Note: Please make sure you can run
npm start
with this repository first before you go furture with more examples!
https://github.com/Chatie/docker-wechaty-getting-started
https://github.com/Chatie/heroku-wechaty-getting-started
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
Puppet
in WechatyThe 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 PuppetWeChat 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
Using Google Cloud Shell for easy getting started!
Using Gitpod for easy getting started!
Init version
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
1. 开源生态
2. 协作、人、软件
3. 评估模型