Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
W

wechaty

> 编程语言
Open source

Conversational RPA SDK for Chatbot Makers. Join our Discord: https://discord.gg/7q8NBZbQzt

22.9K stars0 likes0 views
WebsiteGitHub

About

Conversational RPA SDK for Chatbot Makers. Join our Discord: https://discord.gg/7q8NBZbQzt

Wechaty

Ship.Fail PreAngel

Elevator Pitch

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.

Connecting Chatbots

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

Breaking News

  • 重磅:绕过登录限制,wechaty免费版web协议重放荣光, @gengchen528, Apr 13, 2021

Voice of Developers

"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

Join Us on Discord

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!

Resource

Wechaty has already held lots of talks and got a lot of blogs in the past years; here are all of the wechaty resources:

  • :video_camera: Youtube Playlist: Watch all of the talk videos related with Wechaty
  • :page_with_curl: Full Docs
  • :bulb: Blog: See how developers use wechaty to build fantastic projects!
  • :beginner: Wechaty-Getting-Started:Wechaty Starter Project Template that Works Out-of-the-Box
  • :tada: Wechaty Contributor List: Thanks for their contribution!
  • :gift: Juzibot Support Wechaty: Know everything about Wechaty

:rocket: The World's Shortest ChatBot Code: 6 lines of JavaScript


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.

:checkered_flag: Requirements

  1. Node.js version 16+
  2. NPM version 7+
  3. TypeScript version 4.4+

Getting Started

  • Wechaty Starter Repository - https://github.com/wechaty/wechaty-getting-started

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.

1. Npm

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

2. Docker

  • Wechaty Starter Repository for Docker - https://github.com/wechaty/docker-wechaty-getting-started

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 use ts-node to 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.

3. Switch Protocol(Puppet)

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:

  1. Puppet Directory: https://github.com/Wechaty/wechaty-puppet/wiki/Directory
  2. Puppet Compatibility: https://github.com/Wechaty/wechaty-puppet/wiki/Compatibility

:guitar: API

Read the Full Documentation at Wechaty Official API Reference

1 Class Wechaty

Main bot class.

A Bot is a Wechaty instance that control a specific wechaty-puppet.

  • new Wechaty(options?: WechatyOptions)
    1. options.name?: string the name of this bot(optional)
    2. options.puppet?: string select which puppet provider we want to use. must be one of the:
      1. wechaty-puppet-wechat - Angular Hook for Web Wechat
      2. wechaty-puppet-wechat4u - HTTP API for Web Wechat
      3. wechaty-puppet-padpro - iPad App Protocol
      4. wechaty-puppet-ioscat - iPhone App Hook
      5. wechaty-puppet-mock - Mock for Testing
    3. 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

2 Class Contact

All wechat contacts(friends/non-friends) will be encapsulated as a Contact.

Contact API Description
static [`find(query: string): Promise<n

Issues· 198 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

TypeScriptbotchatbotconversational-aiframework

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言