What is Wechaty
A chatbot is a software application used to conduct an online chat conversation instead of direct contact with a live human agent. It is a type of software that can automate conversations and interact with people through messaging platforms. — Wikipedia
Wechaty is an Open Source software application for building chatbots. It is a modern Conversational RPA SDK which Chatbot makers can use to create a bot in a few lines of code.
You can use Wechaty to build a chatbot which automates conversations and interact with people through instant messaging platforms such as WhatsApp, WeChat, WeCom, Gitter and Lark among others.
Features
Wechaty offers out-of-the-box support for the common features you would need for turning your Instant Messaging account into a chatbot. You can easily customize and extend Wechaty to create a chatbot that is tailored to your needs. Some common features of Wechaty that you can take advantage of include:
- Message processing: You can use Wechaty to receive and send messages. It supports messages in the form of text, image, audio, video, and attachments.
- Room management: You can use it to create rooms, add and remove room members, manage topics, etc.
- Contact management: Search by name, alias, tags, get profile data and avatar.
- Friendship management: Search and add new friends and accept friendship requests.
- Intelligent dialogue management: Just several configuration can get a task-oriented bot.
- Multi-platform support: With Wechaty, you write code which runs on all IM platforms.
Learn more functions from API Reference and How-to Guides.
Supported Instant Messaging services
Wechaty supports a number of Instant Messaging platforms. You can build a chatbot using Wechaty for any of the following Instant Messaging platforms:
Supported programming languages
The Wechaty community have developed Software Development Kits for most of the popular programming languages. You can build a Wechaty Chatbot in any of the programming languages listed below:
All these SDKs have been developed by and for the community.
Releases
Since its creation in 2016, a number of Wechaty versions have been released. For more information about the release history and the current stable version, you can read the Wechaty release notes on Github.
License
Wechaty is an Open Source Project. It is released under Apache-2.0 license and the corresponding documentation is released under the Creative Commons license.
Maintainers
Wechaty is maintained by Huan, Rui and a community of Open Source Contributors. We are always looking for people to join the Wechaty community to maintain the Wechaty codebase and documentation. You necessarily don't have to be a programmer to contribute to Wechaty. To get started contributing, you can read the Contributing section of this documentation.
Getting help
Wechaty has a community of very helpful contributors on different platforms you can join to get help from. Before joining any of the communities, we recommend that you read our Code of conduct so that you adhere to our community guidelines. A full list of the different Wechaty communities can be accessed from the Wechaty community section of this documentation.
Voice of developers
"Wechaty is a great solution, I believe there would be much more users recognize it." link — @Gcaufy, Tencent Engineer, Author of WePY
"太好用,好用的想哭" — @xinbenlv, Google Engineer, Founder of HaoShiYou.org
"最好的微信开发库" 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 contributors in open collective." — @Simple
World's shortest chatbot
You can build a chatbot with a minimum of 6 lines of code with Wechaty.
- TypeScript
- JavaScript
- Python
- Go
- Java
- PHP
- Scala
- C#
- Rust
- OpenAPI
import { Wechaty } from 'wechaty'
async function main () {
const bot = new Wechaty()
bot
.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}`))
await bot.start()
}
main()
.catch(console.error)
import { Wechaty } from 'wechaty'
async function main () {
const bot = new Wechaty()
bot
.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}`))
await bot.start()
}
main()
.catch(console.error)
from wechaty import Wechaty
import asyncio
async def main():
bot = Wechaty()
bot.on('scan', lambda status, qrcode, data: print('Scan QR Code to login: {}\nhttps://wechaty.js.org/qrcode/{}'.format(status, qrcode)))
bot.on('login', lambda user: print('User {} logged in'.format(user)))
bot.on('message', lambda message: print('Message: {}'.format(message)))
await bot.start()
asyncio.run(main())
package main
import (
"fmt"
"github.com/wechaty/go-wechaty/wechaty"
)
func main() {
_ = wechaty.NewWechaty().
OnScan(func(qrCode, status string) {
fmt.Printf("Scan QR Code to login: %s\nhttps://wechaty.js.org/qrcode/%s\n", status, qrCode)
}).
OnLogin(func(user string) { fmt.Printf("User %s logged in\n", user) }).
OnMessage(func(message string) { fmt.Printf("Message: %s\n", message) }).
Start()
}
package io.github.wechaty;
class Bot{
public static void main(String args[]){
Wechaty bot = Wechaty.instance()
.onScan((qrcode, statusScanStatus, data) -> System.out.println(QrcodeUtils.getQr(qrcode)))
.onLogin(user -> System.out.println("User logged in :" + user))
.onMessage(message -> System.out.println("Message:" + message))
.start(true);
}
}
$wechaty = \IO\Github\Wechaty\Wechaty::getInstance($token, $endPoint);
$wechaty->onScan(function($qrcode, $status, $data) {
$qr = \IO\Github\Wechaty\Util\QrcodeUtils::getQr($qrcode);
echo "$qr\n\nOnline Image: https://wechaty.js.org/qrcode/$qrcode\n";
})->onLogin(function(\IO\Github\Wechaty\User\ContactSelf $user) {
})->onMessage(function(\IO\Github\Wechaty\User\Message $message) {
$message->say("hello from PHP7.4");
})->start();
package wechaty
object DingDongBot {
def main(args: Array[String]): Unit = {
Wechaty.instance()
.onScan(payload => { println("Scan QR Code to login: %s\nhttps://wechaty.js.org/qrcode/%s\n".format(payload.status, payload.qrcode)) })
.onLogin(payload => { println("User %s logged in\n".format(payload.id)) })
.onMessage(message => { println(message) })
.start()
Thread.currentThread().join()
}
}
var wechaty = new Wechaty(options, logger).onScan((qrcode, status) => {
Console.WriteLine($"Scan QR Code to login: {status} https://wechaty.js.org/qrcode/{(qrcode)}`");
}).OnLogin( user => {
Console.WriteLine("User {user} logined");
}).OnMessage( message => {
Console.WriteLine($"Message: {message}");
}).Start();
let bot = Wechaty::new(PuppetService::new(options).await.unwrap());
bot.on_scan(handle_scan)
.on_login(handle_login)
.on_logout(handle_logout)
.on_message(handle_message)
.start()
.await;
# To be add: curl ...
Read more codes from Polyglot.
Stargazers over time
Contributors
This project exists thanks to all the people who contribute.
Backers
Thank you to all our backers! 🙏. [Become a backer]
Sponsors
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]
Join us
Scan the following QRCode and reply with "wechaty" to join the home of Wechaty Developers.