Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/filipporomani/whatsapp-python
Open source Python wrapper for the WhatsApp Cloud API.
https://github.com/filipporomani/whatsapp-python
python python-whatsapp whatsapp whatsapp-api whatsapp-python
Last synced: 4 days ago
JSON representation
Open source Python wrapper for the WhatsApp Cloud API.
- Host: GitHub
- URL: https://github.com/filipporomani/whatsapp-python
- Owner: filipporomani
- License: agpl-3.0
- Created: 2023-04-07T20:28:45.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-30T07:08:57.000Z (about 2 months ago)
- Last Synced: 2025-01-17T18:03:08.110Z (8 days ago)
- Topics: python, python-whatsapp, whatsapp, whatsapp-api, whatsapp-python
- Language: Python
- Homepage: https://pypi.org/project/whatsapp-python/
- Size: 2.07 MB
- Stars: 113
- Watchers: 6
- Forks: 19
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
whatsapp-python
Free, open-source Python wrapper for the WhatsApp Cloud API.
Forked from Neurotech-HQ/heyoo.
## Installation
To install the library you can either use pip (latest release version):
``pip install whatsapp-python``
You can also install the development GitHub version (always up to date, with the latest features and bug fixes):
```bash
git clone https://github.com/filipporomani/whatsapp.git
cd whatsapp
pip install .
```If you want to use a local enviroment you can also use hatch:
```bash
git clone https://github.com/filipporomani/whatsapp.git
cd whatsapp
pip install hatch
hatch shell
```Documentation is available in the [wiki](https://github.com/filipporomani/whatsapp/wiki) here on GitHub.
### Key features:
- Modern interface using `async` and `await`
- Full support for Graph API error handling
- Optimized for high-load workflows using asyncronous programming
- Always up to date
- All of the WhatsApp Business chat UI features supported### All features
- Event listening (incoming messages)
- Asyncronous API calls
- Error handling
- Sending messages
- Sending messages from different numbers individually
- Marking messages as read
- Replying to messages
- Reacting to messages
- Sending medias (images, audios, videos, links and documents)
- Sending location
- Sending interactive buttons
- Sending template messages
- Parsing messages and media received
- Sending contacts
- Uploading media to the Facebook cloud## Obtaining the WhatsApp API credentials
To use the WhatsApp API you need to create a Facebook Business account and a WhatsApp Business account.
> [!TIP]
> To create an account, I recommend to follow [this video](https://youtu.be/d6lNxP2gadA).## Pricing of the API
Whereas using third-party providers of the WhatsApp API can result in monthly fees, using the WhatsApp API[^1] offered directly by Facebook is much cheaper, even if the billing documentation is quite difficult to understand.
> [!CAUTION]
> It is now mandatory to add a credit card to the WhatsApp account (at least for me) in order to use the service. I was even charged a tiny fee for using a non-test phone number (~€1.20), so be careful when using the API! I'm not responsible for any costs you may face by using the API.
>
> The API should be, however, free for testing purposes with the provided test phone number.All the prices are available in the [**WhatsApp API docs**](https://developers.facebook.com/docs/whatsapp/pricing).
> [!TIP]
> I recomend to use a test number, as you you can get a free one and use it for testing purposes.## Migrating from `Neurotech-HQ/heyoo`
*You can ignore this if it's your first time using the library.*
- Any version >1.1.2 is incompatible with the original `heyoo` library! Be careful updating! Read the docs first!
- Any version <=1.1.2 is fully compatible with the original `heyoo` library and doesn't include breaking changes.Switching from heyoo to whatsapp-python doesn't require any change for versions up to 1.1.2: just uninstall `heyoo`, install `whatsapp-python==1.1.2` and change the import name from `heyoo` to `whatsapp`.
For versions GREATER THAN 1.1.2, messages have became objects, so you need to change your code to use the new methods.
> [!NOTE]
> Documentation for version 1.1.2 can be found [here](https://github.com/filipporomani/whatsapp/wiki/v1.1.2).## Contributing
If you are facing any issues or have any questions, please [open a new issue](https://github.com/filipporomani/whatsapp/issues/new/choose)!
*This is an open source project published under the [GNU Affero General Public License v3](LICENSE).*
[^1]: https://developers.facebook.com/docs/whatsapp/cloud-api