https://github.com/wechaty/python-wechaty-getting-started
Python Wechaty Starter Project Template that Works Out-of-the-Box
https://github.com/wechaty/python-wechaty-getting-started
chatbot getting-started python wechaty
Last synced: 8 months ago
JSON representation
Python Wechaty Starter Project Template that Works Out-of-the-Box
- Host: GitHub
- URL: https://github.com/wechaty/python-wechaty-getting-started
- Owner: wechaty
- License: apache-2.0
- Created: 2020-05-13T15:12:43.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-09-19T23:07:44.000Z (over 3 years ago)
- Last Synced: 2025-06-06T10:11:37.083Z (9 months ago)
- Topics: chatbot, getting-started, python, wechaty
- Language: Makefile
- Homepage: https://gitpod.io/#https://github.com/wechaty/python-wechaty-getting-started
- Size: 101 KB
- Stars: 199
- Watchers: 10
- Forks: 57
- Open Issues: 43
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# python-wechaty-getting-started  [](https://www.python.org/downloads/release/python-370/)

[](https://gitpod.io/#https://github.com/wechaty/python-wechaty-getting-started)
[](https://github.com/wechaty/python-wechaty)
Python Wechaty Starter Project Template that Works Out-of-the-Box
## Connecting Chatbots
[](https://github.com/Wechaty/wechaty)
Wechaty is a RPA SDK for Wechat **Individual** Account that can help you create a chatbot in 9 lines of Python.
## Requirements
1. python3.7+
## Live Coding Video Tutorial
Here's a great live coding video tutorial from our Python Wechaty creator @wj-Mcat:
## Quick Start
1. Clone python-wechaty-getting-started repository
```shell
git clone https://github.com/wechaty/python-wechaty-getting-started
cd python-wechaty-getting-started
```
2. Install Dependencies
```shell
make install
# or
pip install -r requirements.txt
```
3. Set token for your bot
You need a [Wechaty Puppet Service](https://wechaty.js.org/docs/puppet-services/) Token first, you can learn how to get it from our official docs at .
```sh
# examples/ding-dong-bot.py : func-> main()
# it must be donut token
export WECHATY_PUPPET=wechaty-puppet-service
export WECHATY_PUPPET_SERVICE_TOKEN=your_token_at_here
```
or you can use `TOKEN` or `token` environment variable alias name to set **token**, for example:
```shell
export TOKEN=your_token_at_here
# or
export token=your_token_at_here
```
> Learn more about the token related concepts by reading our blog post: [Introducing Wechaty Puppet Service (Providers), @huan, Jan 14, 2021](https://wechaty.js.org/2021/01/14/wechaty-puppet-service/)
4. Run the bot
```shell
make bot
# or
python examples/ding-dong-bot.py
```
## The World's Shortest Python ChatBot: 9 lines of Code
```python
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.wechaty.js/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())
```
## Wechaty Getting Started in Multiple Languages
- [TypeScript Wechaty Getting Started](https://github.com/wechaty/wechaty-getting-started)
- [Python Wechaty Getting Started](https://github.com/wechaty/python-wechaty-getting-started)
- [Java Wechaty Getting Started](https://github.com/wechaty/java-wechaty-getting-started)
- [Go Wechaty Getting Started](https://github.com/wechaty/go-wechaty-getting-started)
## Badge
[](https://github.com/wechaty/python-wechaty)
```md
[](https://github.com/wechaty/python-wechaty)
```
## Maintainers
[@wechaty/python](https://github.com/orgs/wechaty/teams/python/members)
## Copyright & License
- Code & Docs © 2020 Wechaty Contributors
- Code released under the Apache-2.0 License
- Docs released under Creative Commons