whatsapp-cloud-api
WhatsApp Cloud API Python Module
The whatsapp-cloud-api Python module provides a simple and convenient way to interact with WhatsApp Cloud API. This module allows you to send various types of messages, including text messages, images, audio, videos, documents, and media messages. It abstracts away the complexity of the API calls and provides easy-to-use methods for sending different types of messages to WhatsApp users.
Installation
You can install the whatsapp-cloud-api module using pip:
pip install whatsapp-cloud-api
Usage
To use the whatsapp-cloud-api module, you need to import it into your Python script and create an instance of the WhatsApp class by providing the required parameters: phone_number_id and bearer_token.
from whatsapp_cloud_api import WhatsApp
phone_number_id = "your_phone_number_id"
bearer_token = "your_bearer_token"
whatsapp = WhatsApp(phone_number_id, bearer_token)
Sending Text Messages
You can send text messages to WhatsApp users using the send_text_message method.
to = "recipient_phone_number"
message = "Hello, this is a text message."
response = whatsapp.send_text_message(to, message)
print(response.json())
Sending Images
You can send images to WhatsApp users using the send_image_message method.
to = "recipient_phone_number"
image_id_or_url = "image_id_or_url"
response = whatsapp.send_image_message(to, image_id_or_url)
print(response.json())
Sending Audio
You can send audio messages to WhatsApp users using the send_audio_message method.
to = "recipient_phone_number"
audio_id_or_url = "audio_id_or_url"
response = whatsapp.send_audio_message(to, audio_id_or_url)
print(response.json())
Sending Videos
You can send videos to WhatsApp users using the send_video_message method.
to = "recipient_phone_number"
video_id_or_url = "video_id_or_url"
response = whatsapp.send_video_message(to, video_id_or_url)
print(response.json())
Sending Documents
You can send documents to WhatsApp users using the send_document_message method.
to = "recipient_phone_number"
document_id_or_url = "document_id_or_url"
response = whatsapp.send_document_message(to, document_id_or_url)
print(response.json())
Sending Media Messages
You can send media messages (such as images, audio, videos, and documents) to WhatsApp users using the send_media_message method.
to = "recipient_phone_number"
media_type = "image" # Replace with the desired media type
media_id_or_url = "media_id_or_url"
response = whatsapp.send_media_message(to, media_type, media_id_or_url)
print(response.json())
Sending Reactions
You can send reactions to specific messages using the send_react_to_message method.
to = "recipient_phone_number"
reply_to_message_id = "message_id"
emoji = "👍" # Replace with the desired emoji
response = whatsapp.send_react_to_message(to, reply_to_message_id, emoji)
print(response.json())
Contributing
If you'd like to contribute to the development of this module or report issues, please feel free to submit a pull request or create an issue on the GitHub repository.
License
This module is released under the MIT License.
Disclaimer
This module is not officially affiliated with WhatsApp or Facebook. It's an independent project developed by the community.
Note: Make sure to replace placeholders (your_phone_number_id, your_bearer_token, etc.) with actual values when using the module.
For more detailed information about the methods and classes provided by the whatsapp-cloud-api module, refer to the module's source code or docstrings.
Metadata
Release files for whatsapp-cloud-api 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| whatsapp_cloud_api-0.0.4.tar.gz | 4.7 kB | Without provenance | Details for whatsapp_cloud_api-0.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| whatsapp_cloud_api-0.0.4-py3-none-any.whl | Python 3 | none | any | Details for whatsapp_cloud_api-0.0.4-py3-none-any.whl |
Total release size: 10.2 kB
Release files / whatsapp_cloud_api-0.0.4.tar.gz
| Download URL | whatsapp_cloud_api-0.0.4.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4f718e9717238ae3158366ac0e24f5aa0d9e48c008ebf9fcb5bcbc242f3ca05f
|
|
BLAKE2b-256 checksum How to use checksums |
da66d8791ee3443731ab92188de14b4a6d9df03fdfb8ff9954c52ae86004cc2c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|
Release files / whatsapp_cloud_api-0.0.4-py3-none-any.whl
| Download URL | whatsapp_cloud_api-0.0.4-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5a82abb153aaf99846df3c288712f7e7c297533409001e45e3f6f7054becc155
|
|
BLAKE2b-256 checksum How to use checksums |
bbaedb4c74e2d8ea8fc061f8ce72efd6f3dffb0fed5be63608115eacb3049ea5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|
Security for whatsapp-cloud-api 0.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.