Skip to main content

This is a clone of the original repository: https://github.com/filipporomani/whatsapp

I have removed Flask and uvicorn from dependencies. I will try to mantain this repository up to date with the original one.

logo

whatsapp-python

Free, open-source Python wrapper for the WhatsApp Cloud API.
Forked from Neurotech-HQ/heyoo.

Made in Italy Downloads Monthly Downloads Weekly Downloads

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/yoandresaav/whatsapp-python-cloud-api.git
cd whatsapp
pip install .

If you want to use a local enviroment you can also use hatch:

git clone https://github.com/yoandresaav/whatsapp-python-cloud-api.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
  • 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 API1 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]
One recommendation I can give you is to use a test number (you can get a free phone number and use it for testing purposes only).

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.

  1. https://developers.facebook.com/docs/whatsapp/cloud-api ↩

Metadata

Release files for whatsapp-python-cloud-api 3.2.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for whatsapp-python-cloud-api 3.2.5
File Size Uploaded
whatsapp_python_cloud_api-3.2.5.tar.gz 19.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for whatsapp-python-cloud-api 3.2.5
File Interpreter ABI Platform
whatsapp_python_cloud_api-3.2.5-py3-none-any.whl Python 3 none any Details

Total release size: 34.6 kB

Release files / whatsapp_python_cloud_api-3.2.5.tar.gz

Download URL whatsapp_python_cloud_api-3.2.5.tar.gz
Size 19.0 kB
Tags Source
SHA-256 checksum
How to use checksums
7885e745c1827b93689bf9765596d36dbeac4ff24bdb162ea83599cfbfff8ea4
BLAKE2b-256 checksum
How to use checksums
ec4c863afccf258e9a8c4a8373a86aeb38f9ef6e4881f70b6a9f37937c96f209
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.5

Release files / whatsapp_python_cloud_api-3.2.5-py3-none-any.whl

Download URL whatsapp_python_cloud_api-3.2.5-py3-none-any.whl
Size 15.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c2dac99f3c2fd3f2bd205e7f5bafdcf7c342559afe2efdcf0b5e2b6bf76ffea8
BLAKE2b-256 checksum
How to use checksums
7cacddcb2ea39d43181a9f06eddc9dd7bce6909c2a3a2d221aa954ce6e776da2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.5

Release history Release notifications | RSS feed

This release

3.2.5 This release

2 release files

3.1.4

2 release files

3.1.3

2 release files

3.1.2

2 release files

3.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page