Conversational RPA SDK for Chatbot Makers. Join our Discord: https://discord.gg/7q8NBZbQzt
Conversational RPA SDK for Chatbot Makers. Join our Discord: https://discord.gg/7q8NBZbQzt
Wechaty is a conversational RPA SDK that simplifies the process of building chatbots. It's like a Swiss Army knife for chatbot development, providing a universal interface to various messaging platforms such as WhatsApp, WeChat, and more. With Wechaty, you write your bot code once, and it runs on any of the supported platforms. This means you can focus on creating engaging conversational experiences without worrying about the underlying complexities of each platform's API. It's open-source, easy to use, and backed by a vibrant community that's ready to help you bring your chatbot ideas to life.
Wechaty is an RPA (Robotic Process Automation) SDK for Chatbot Makers which can help you create a bot in 6 lines of JavaScript, Python, Go, and Java, with cross-platform support including Linux, Windows, MacOS, and Docker.
:spider_web: https://wechaty.js.org
:octocat: https://github.com/Wechaty/wechaty
:beetle: https://github.com/Wechaty/wechaty/issues
:book: https://github.com/Wechaty/wechaty-getting-started
:whale: https://hub.docker.com/r/wechaty/wechaty
"Wechaty is a great solution; I believe there would be much more users who recognize it." link
— @Gcaufy, Tencent Engineer, Author of WePY"太好用,好用的想哭"
— @xinbenlv, Google Engineer, Founder of HaoShiYou.org”好用到哭“——你们对得起这个评价! link
— @bigbrother666sh, creator of《社长不见了》剧本杀 NPC DM"最好的微信开发库" link
— @Jarvis, Baidu Engineer"Wechaty让运营人员更多的时间思考如何进行活动策划、留存用户,商业变现" link
— @lijiarui, Founder & CEO of Juzi.BOT."If you know js ... try Wechaty. It's easy to use."
— @Urinx Uri Lee, Author of WeixinBot(Python)"Wechaty is a good project; I hope it can continue! Therefore, I became a contributor in open collective."
— @Simple
See more at Wiki:Voice Of Developer
Wechaty is used in many ChatBot projects by thousands of developers. To talk with other developers, scan the QR Code below and join our Wechaty Developer Community.
Scan now because other Wechaty developers want to talk with you, too!
Wechaty has already held lots of talks and got a lot of blogs in the past years; here are all of the wechaty resources:
import { WechatyBuilder } from 'wechaty'
const wechaty = WechatyBuilder.build() // get a Wechaty instance
wechaty
.on('scan', (qrcode, status) => console.log(`Scan QR Code to login: ${status}\nhttps://wechaty.js.org/qrcode/${encodeURIComponent(qrcode)}`))
.on('login', user => console.log(`User ${user} logged in`))
.on('message', message => console.log(`Message: ${message}`))
wechaty.start()
Notice: Wechaty requires Node.js version >= 16
This bot can log all messages to the console after login by the scan.
You can find Wechaty's Official Examples at examples/ding-dong-bot.ts and more from our Example Directory.
We have a Wechaty starter repository for beginners with the simplest setting. It will be work out-of-the-box after you clone & npm install & npm start.
If you are new to Wechaty and want to try it the first time, we'd like to strong recommend you starting from this repository, and using it as your starter template for your project.
Otherwise, please saved the above The World's Shortest ChatBot Code: 6 lines of JavaScript example to a file named bot.js before you can use either NPM or Docker to run it.
npm init
npm install wechaty
# create your first bot.js file, you can copy/paste from the above "The World's Shortest ChatBot Code: 6 lines of JavaScript"
# then:
node bot.js
Wechaty Docker supports both JavaScript and TypeScript. To use TypeScript just write in TypeScript and save with extension name
.ts, no need to compile because we usets-nodeto run it.
2.1. Run JavaScript
# for JavaScript
docker run -ti --rm --volume="$(pwd)":/bot wechaty/wechaty bot.js
2.2. Run TypeScript
# for TypeScript
docker run -ti --rm --volume="$(pwd)":/bot wechaty/wechaty bot.ts
Learn more about Wechaty Docker at Wiki:Docker.
Wechaty is very powerful that it can run over different protocols. You can specify the protocol by set the environment variable WECHATY_PUPPET to different puppet provider.
If you cannot use Web protocol, you can apply other protocols following the instruction here: https://github.com/wechaty/wechaty/wiki/Support-Developers We provide free token to support developers build a valuable WeChat chatbot.
Currently we support the following puppet providers :
| Protocol | Puppet Provider | Environment Variable |
|---|---|---|
| Web | PuppetPuppeteer | export WECHATY_PUPPET=wechaty-puppet-puppeteer |
| Windows | PuppetWorkPro | export WECHATY_PUPPET=wechaty-puppet-service |
| Mock | PuppetMock | export WECHATY_PUPPET=wechaty-puppet-mock |
| Web | PuppetWechat4u | export WECHATY_PUPPET=wechaty-puppet-wechat4u |
| iPad | PuppetRock | export WECHATY_PUPPET=wechaty-puppet-service |
| iPad | PuppetPadLocal | export WECHATY_PUPPET=wechaty-puppet-service |
| Windows | PuppetDonut | export WECHATY_PUPPET=wechaty-puppet-service |
| iPad | PuppetPadpro DEPRECATED | export WECHATY_PUPPET=wechaty-puppet-padpro |
| iPad | PuppetPadchat DEPRECATED | export WECHATY_PUPPET=wechaty-puppet-padchat |
| iPad | PuppetPadplus DEPRECATED | export WECHATY_PUPPET=wechaty-puppet-padplus |
| Mac | PuppetMacpro DEPRECATED | export WECHATY_PUPPET=wechaty-puppet-macpro |
| Windows | PuppetWxwork DEPRECATED | export WECHATY_PUPPET=wechaty-puppet-service |
Learn more about Wechaty Puppet from the Puppet Wiki:
Read the Full Documentation at Wechaty Official API Reference
WechatyMain bot class.
A Bot is a Wechaty instance that control a specific wechaty-puppet.
new Wechaty(options?: WechatyOptions)options.name?: string the name of this bot(optional)options.puppet?: string select which puppet provider we want to use. must be one of the:options.puppetOptions?: PuppetOptions options for the puppet provider.| Wechaty | API | Description |
|---|---|---|
| event | login |
emit after bot login full successful |
| event | logout |
emit after the bot log out |
| event | friendship |
emit when someone sends bot a friend request |
| event | message |
emit when there's a new message |
| event | room-join |
emit when anyone join any room |
| event | room-topic |
emit when someone change room topic |
| event | room-leave |
emit when anyone leave the room |
| event | room-invite |
emit when there is a room invitation |
| event | scan |
emit when the bot needs to show you a QR Code for scanning |
| method | start(): Promise<void> |
start the bot |
| method | stop(): Promise<void> |
stop the bot |
| method | logonoff(): boolean |
bot login status |
| method | logout(): Promise<void> |
logout the bot |
| method | currentUser(): ContactSelf |
get the login-ed bot contact |
| method | say(text: string): Promise<void> |
let bot say text to itself |
ContactAll wechat contacts(friends/non-friends) will be encapsulated as a Contact.
| Contact | API | Description |
|---|---|---|
| static | [`find(query: string): Promise<n |
No open issues yet, or sync has not completed.