Skip to main content

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.

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_messager.messaging 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


Download files

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

Source Distribution

whatsapp_messager-0.0.3.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

whatsapp_messager-0.0.3-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file whatsapp_messager-0.0.3.tar.gz.

File metadata

  • Download URL: whatsapp_messager-0.0.3.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

Hashes for whatsapp_messager-0.0.3.tar.gz
Algorithm Hash digest
SHA256 5ec7f5361d48052647f6b57fd424126ed1d015ef91a32dc77e7093a8012613e3
MD5 3012ba840487c89b425ce6f051fbf0d0
BLAKE2b-256 b072392ae5ee308d0c39286f17ccd3bb5119cadc7746cc913c7b2f46458b3153

See more details on using hashes here.

File details

Details for the file whatsapp_messager-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for whatsapp_messager-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e080262cf76c8bac10b92ff6431899bcf66f7cec9e019a734e35155513791066
MD5 df572bcac2ec58d05c6a58911de432f6
BLAKE2b-256 b298fb4ca2fae3fb44cecafd357cf9bbb81ebc2b50dc4936ffa4b501b4567048

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