Skip to main content

How to install Wechaty

We have a Wechaty starter repository for beginners with the simplest setting. It will be just work out-of-the-box after you clone, run npm install in the terminal, followed by npm start.


  1. Node.js v16
  2. sudo apt-get install build-essential && sudo snap install shellcheck

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

import { Wechaty }  from 'wechaty' // import { Wechaty } from 'wechaty'
Wechaty.instance() // Global Instance.on('scan', (qrcode, status) => console.log(`Scan QR Code to login: ${status}\n${encodeURIComponent(qrcode)}`)).on('login',            user => console.log(`User ${user} logged in`)).on('message',       message => console.log(`Message: ${message}`)).start()

Please save 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 Version npm (tag)

Downloads install size

npm initnpm 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#

Docker Pulls Docker Layers

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 JavaScriptdocker run -ti --rm --volume="$(pwd)":/bot wechaty/wechaty bot.js

2.2. Run TypeScript

# for TypeScriptdocker run -ti --rm --volume="$(pwd)":/bot wechaty/wechaty bot.ts

Learn more about Wechaty Docker at Wiki:Docker.


NPM Docker Coverage Status Known Vulnerabilities

Wechaty is fully automatically tested by unit and integration tests, with Continious Integration & Continious Deliver(CI/CD) support powered by CI like Travis, Shippable and Appveyor.

To test Wechaty, run:

npm test

Get to know more about the tests from Wiki:Tests


Powered by Wechaty