Skip to main content

Open source Python wrapper for the WhatsApp Cloud API

Project description

whatsapp-python

Made in Italy Downloads Downloads Downloads

Free, open-source Python wrapper for the WhatsApp Cloud API.

Forked from Neurotech-HQ/heyoo

Supported features

  1. Listening to events (messages, media, etc.)
  2. Sending messages
  3. Marking messages as read
  4. Sending Media (images, audio, video and documents)
  5. Sending location
  6. Sending interactive buttons
  7. Sending template messages
  8. Parsing messages and media received

Docs

Docs are 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 and doesn't support many features.

In this library I added app events (to listen to incoming messages) and implemented an easier way to send/receive messages and media by creating the Messageobject.

I fixed some bugs and added some features, but the library still needs a lot of work to be done even if it's working and usable.

Installation

To install the library you can either use pip (latest release version):

pip install whatsapp-python

or git (latest development version):

git clone https://github.com/filipporomani/whatsapp.git
cd whatsapp
python3 setup.py install

Obtaining the WhatsApp API credentials

To use the WhatsApp API you need to create a Facebook Business account and a WhatsApp Business account.

To create an account, I recomend to follow this video

Costs of the API

While using third-party API providers of the WhatsApp API may have some monthly fees, using the WhatsApp API provided directly by Facebook is way cheaper, even if the billing docs are pretty hard to understand. The first 1000 chats created are free, then there is a pay-as-you-go fee that is paid for each conversation started.

IMPORTANT: it is now mandatory (at least it was for me) to add a credit card to the whatsapp account to use the service. I eventually got billed for using a non-test number (~1,20€), so be carefull using the API! I'm not responsible for any costs you may have using the API.

A suggestion I can give you is to use a test number (you can get one for free and use it for testing purposes only).

All the prices are available in the WhatsApp API docs

Switching 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 any breaking change..

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 version which are GREATER THEN 1.1.2, messages have became objects, so you need to change your code to use the new methods.

Note: docs for version 1.1.2 are available in the dedicated wiki page.

Issues

If you are facing any issues or have any questions, please open an issue on the GitHub repository

Contributing

This is an opensource project published under the MIT License: LICENSE.

References

  1. WhatsApp Cloud API official documentation

Project details


Download files

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

Source Distribution

whatsapp_python-3.0.4.tar.gz (17.6 kB view details)

Uploaded Source

Built Distribution

whatsapp_python-3.0.4-py3-none-any.whl (21.1 kB view details)

Uploaded Python 3

File details

Details for the file whatsapp_python-3.0.4.tar.gz.

File metadata

  • Download URL: whatsapp_python-3.0.4.tar.gz
  • Upload date:
  • Size: 17.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for whatsapp_python-3.0.4.tar.gz
Algorithm Hash digest
SHA256 54a63e5e722da46a2c055f5fb17063c8f14815a7111c4448728f4819cc5841f5
MD5 984009169384ecb1e59eacf4cc8a4ca1
BLAKE2b-256 9c326c1beb51ee6d35bd87f50ac8460871076a27f2b4575a21445dd0001c33b4

See more details on using hashes here.

File details

Details for the file whatsapp_python-3.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for whatsapp_python-3.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 edc16eb75dd571aa66b66a175decc92c918c39b32533b2b3ce584c261a0d7ce2
MD5 c4558a51569b5749bd1596e9d0538bd5
BLAKE2b-256 3de48506a018a99f4346a14bdf4b192126414e4847ba7fe84b5a6cc599e0b802

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page