Open source Python wrapper for the WhatsApp Cloud API
Reason this release was yanked:
Broken version
Project description
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):
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:
git clone https://github.com/filipporomani/whatsapp.git
cd whatsapp
pip install hatch
hatch shell
Documentation is available in the wiki section on GitHub.
Why choose this library?
The main reason why I decided to fork the original library is that it uses an old version of the API, it's missing many useful features and it's almost not mantained anymore.
In this fork I added app events (to listen to incoming messages) and implemented an easier way to send/receive messages and media by using the Message
object.
I fixed some bugs and added many features, however the library still needs a lot of work to be done even if it's working and usable.
Supported features:
- Listening to events (messages, media, etc.)
- Sending messages
- Sending messages from different numbers individually
- Marking messages as read
- Reacting to messages
- Sending Media (images, audio, video and documents)
- Sending location
- Sending interactive buttons
- Sending template messages
- Parsing messages and media received
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.
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 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.
All the prices are available in the WhatsApp API docs.
[!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.
Contributing
If you are facing any issues or have any questions, please open a new issue!
This is an open source project published under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file whatsapp_python-3.3.9.post1.tar.gz
.
File metadata
- Download URL: whatsapp_python-3.3.9.post1.tar.gz
- Upload date:
- Size: 21.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8222a1e65e0441036e6dba4ced6539877bd33d745296cab0a9a0ec66dea285e |
|
MD5 | 2c40d6b9c1061d85946a041bf843fa97 |
|
BLAKE2b-256 | 62929f2b88a79dc2c3b0c4876e35bd7ae8c642d58339135bc01ab82652598c94 |
File details
Details for the file whatsapp_python-3.3.9.post1-py3-none-any.whl
.
File metadata
- Download URL: whatsapp_python-3.3.9.post1-py3-none-any.whl
- Upload date:
- Size: 16.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e511e8fa6a0ffc81eb08c4dcff508f2dff0839464e95584f8dcf14a0af7277e |
|
MD5 | 0060ae8af648e9f5062763cd32b16dd5 |
|
BLAKE2b-256 | b336b5b840e1d450dd84231ec03a57d474192527ee99c0bb6bce7280a3d978cc |