WhatsApp message sender using WhatsApp Business API
Project description
whatsapp_messager
is a Python library that makes it easy to send messages using WhatsApp's official API. This library is built to interact with the WhatsApp Business API, providing a simple way to send text messages and OTP messages.
Features
-
Send OTP messages via WhatsApp.
-
Send general text messages via WhatsApp.
-
Simple and easy-to-use interface for developers.
Installation
You can install the library using pip
:
pip install whatsapp_sender
Usage
To start using whatsapp-sender
, you need to create an instance of the WhatsAppSender
class with your access token, phone number ID, and version number.
Import and Setup
from whatsapp_sender import WhatsAppSender
# Initialize the WhatsAppSender
sender = WhatsAppSender(
access_token="your_access_token",
phone_number_id="your_phone_number_id",
version_number="v15.0" # Optional, default is v15.0
)
Send OTP Message
To send an OTP message:
response = sender.send_otp_message(recipient_phone_number="1234567890", otp="123456")
print(response)
Send Text Message
To send a text message:
response = sender.send_text_message(
recipient_phone_number="1234567890",
message="Hello from WhatsApp Sender!",
country_code="+1" # Include the appropriate country code
)
print(response)
Requirements
-
Python 3.7+
-
requests
library
Error Handling
The library provides basic error handling and returns success or failure messages based on the API response. If an error occurs, the response will contain details about the failure.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Author
-
John Gbaya-kokoya
-
Email
Contributing
Contributions are welcome! Please feel free to submit a Pull Request or open an Issue to improve the library.
Links
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_messager-0.0.2.tar.gz
.
File metadata
- Download URL: whatsapp_messager-0.0.2.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34812d6717b5e11b4453c9fa98fa0217f4be6c4dc12de61f13144f2647c81d17 |
|
MD5 | 843064d1034398b528a8e663abf27c19 |
|
BLAKE2b-256 | 47ab804a2a890d79a8053447ef093ab77298cb32db30ce9edcffd3580ce4e61c |
File details
Details for the file whatsapp_messager-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: whatsapp_messager-0.0.2-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2242c733668f6bd9fc24294df6cc6d04ca326df5021194b549aa7d35726890db |
|
MD5 | e75a6c391b63839a80a2ececd3530427 |
|
BLAKE2b-256 | 0d0f34e187486cb4aa3a335c501451798052f7b032daf08f7c2d6997efd398be |