Skip to main content

Wechaty is a Conversational RPA SDK for Chatbot Makers

Project description

python-wechaty PyPI Version PyPI GitHub Actions

Python Wechaty

Python Wechaty Getting Started Python 3.7 Downloads Wechaty in Python


Connecting Chatbots

Powered by Wechaty

Wechaty is a Conversational SDK for Chatbot Makers that can help you create a bot in 9 lines of Python.

Voice of the 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

"最好的微信开发库" 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)

See more at Wiki:Voice Of Developer

Join Us

Wechaty is used in many ChatBot projects by thousands of developers. If you want to talk with other developers, just scan the following QR Code in WeChat with secret code python wechaty, join our Wechaty Python Developers' Home.

Wechaty Friday.BOT QR Code

Scan now, because other Wechaty Python developers want to talk with you too! (secret code: python wechaty)

The World's Shortest Python ChatBot: 9 lines of Code

from wechaty import Wechaty

import asyncio
async def main():
    bot = Wechaty()
    bot.on('scan', lambda status, qrcode, data: print('Scan QR Code to login: {}\n{}'.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()

Python Wechaty Developing Plan

We already have Wechaty in TypeScript, It will be not too hard to translate the TypeScript(TS) to Python(PY) because wechaty has only 3,000 lines of the TS code, they are well designed and de-coupled by the wechaty-puppet abstraction. So after we have translated those 3,000 lines of TypeScript code, we will almost be done.

As we have already a ecosystem of Wechaty in TypeScript, so we will not have to implement everything in Python, especially, in the Feb 2020, we have finished the wechaty-grpc service abstracting module with the wechaty-puppet-service implmentation.

The following diagram shows out that we can reuse almost everything in TypeScript, and what we need to do is only the block located at the top right of the diagram: Wechaty (Python).

  +--------------------------+ +--------------------------+
  |                          | |                          |
  |   Wechaty (TypeScript)   | |    Wechaty (Python)      |
  |                          | |                          |
  +--------------------------+ +--------------------------+

  |                 Wechaty Puppet Service                |
  |                                                       |
  |                (wechaty-puppet-service)               |

+---------------------  wechaty-grpc  ----------------------+

  |                Wechaty Puppet Abstract                |
  |                                                       |
  |                   (wechaty-puppet)                    |

  +--------------------------+ +--------------------------+
  |      Pad Protocol        | |      Web Protocol        |
  |                          | |                          |
  | wechaty-puppet-padplus   | |(wechaty-puppet-puppeteer)|
  +--------------------------+ +--------------------------+
  +--------------------------+ +--------------------------+
  |    Windows Protocol      | |       Mac Protocol       |
  |                          | |                          |
  | (wechaty-puppet-windows) | | (wechaty-puppet-macpro)  |
  +--------------------------+ +--------------------------+

Example: How to Translate TypeScript to Python

There's a 100 lines class named Image in charge of downloading the WeChat image to different sizes.

It is a great example for demonstrating how do we translate the TypeScript to Python in Wechaty Way:

Image Class Source Code

If you are interested in the translation and want to look at how it works, it will be a good start from reading and comparing those two Image class files in TypeScript and Python at the same time.

To-do List

  • TS: TypeScript
  • SLOC: Source Lines Of Code

Wechaty Internal Modules

  1. <input type="checkbox" disabled="" /> Class Wechaty @wj-mCat
  2. <input type="checkbox" disabled="" /> Class Contact
  3. <input type="checkbox" disabled="" /> Class ContactSelf
  4. <input type="checkbox" disabled="" /> Class Message
  5. <input type="checkbox" disabled="" /> Class Room
  6. <input type="checkbox" disabled="" /> Class Image @wj-mCat
  7. <input type="checkbox" checked="" disabled="" /> Class Accessory @huan
  8. <input type="checkbox" disabled="" /> Class Config @wj-mCat
  9. <input type="checkbox" disabled="" /> Class Favorite
  10. <input type="checkbox" disabled="" /> Class Friendship
  11. <input type="checkbox" disabled="" /> Class MiniProgram
  12. <input type="checkbox" disabled="" /> Class RoomInvitation
  13. <input type="checkbox" disabled="" /> Class Tag
  14. <input type="checkbox" disabled="" /> Class UrlLink

Wechaty External Modules

  1. <input type="checkbox" disabled="" /> Class FileBox
  2. <input type="checkbox" disabled="" /> Class MemoryCard
  3. <input type="checkbox" disabled="" /> Class WechatyPuppet
  4. <input type="checkbox" disabled="" /> Class WechatyPuppetHostie




  1. Python 3.7+


pip3 install wechaty

See Also

Static & Instance of Class



v0.6 (Jun 19, 2020)

Python Wechaty Scala Wechaty BETA Released!

Read more from our Multi-language Wechaty Beta Release event from our blog:

v0.4 (Mar 15, 2020) master

Welcome @huangaszaq for joining the project! #42

  1. Add a friendly exception message for PyPI users. #24

v0.1 (Mar 8, 2020)

Welcome @wj-Mcat for joining the project! #4

  1. Starting translate TypeScript of Wechaty to Python
  2. DevOps Setup
    1. Type Checking: mypy & pytype
    2. Unit Testing: pytest
    3. Linting: pylint, pycodestyle, and flake8
    4. CI/CD: GitHub Actions
  3. Publish to PyPI automatically after the tests passed.

v0.0.1 (Aug 25, 2018)

Project created, publish a empty module wechaty on PyPI.

Related Projects

  • Wechaty - Conversatioanl AI Chatot SDK for Wechaty Individual Accounts (TypeScript)
  • Python Wechaty - Python WeChaty Conversational AI Chatbot SDK for Wechat Individual Accounts (Python)
  • Go Wechaty - Go WeChaty Conversational AI Chatbot SDK for Wechat Individual Accounts (Go)
  • Java Wechaty - Java WeChaty Conversational AI Chatbot SDK for Wechat Individual Accounts (Java)
  • Scala Wechaty - Scala WeChaty Conversational AI Chatbot SDK for WechatyIndividual Accounts (Scala)


Wechaty in Python

[![Wechaty in Python](](

Stargazers over time

Stargazers over time


contributor contributor contributor contributor contributor contributor contributor contributor


  1. @huangaszaq - Chunhong HUANG (黄纯洪)


Copyright & License

  • Code & Docs © 2018 Wechaty Contributors
  • Code released under the Apache-2.0 License
  • Docs released under Creative Commons

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for wechaty, version 0.8.25
Filename, size File type Python version Upload date Hashes
Filename, size wechaty-0.8.25.tar.gz (43.5 kB) File type Source Python version None Upload date Hashes View
Filename, size wechaty-0.8.25-py3-none-any.whl (55.4 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page