Skip to content

A lightweight wrapper around the WAAPI Whatsapp API

License

Notifications You must be signed in to change notification settings

Raj1v/WAAPI-Wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WAAPI Wrapper

The WAAPI Wrapper is a Python library designed to simplify the integration with the WAAPI WhatsApp API, making it easier to send messages, manage contacts, and automate responses on WhatsApp.

Installation

pip install git+https://github.com/Raj1v/WAAPI-Wrapper

Usage

Here are a couple of examples of how you can use the WAAPI Package to interact with WhatsApp:

Sending a Message

from waapi_wrapper.webhook import send_message

send_message("Hello, world!", recipient_id="1234567890")

Webhook Event Handling

This section provides a simple example of how to set up a webhook to receive messages via WhatsApp. We'll use the Flask framework to create a small web server that listens for incoming WhatsApp messages.

from flask import Flask, request, jsonify
from waapi_wrapper.webhook import handle_waapi_event

app = Flask(__name__)

@app.route('/webhook', methods=['POST'])
def webhook():
    # Parse the incoming JSON data
    request_data = request.get_json()
    
    # Handle the WhatsApp API event
    event = handle_waapi_event(request_data)

    # Access some data from the event
    message_body = event.message_body
    sender = event.sender

    # Do something with the data
    print(f"Received message from {sender}: {message_body}")

    # Respond to the webhook
    return jsonify({
        'status': 'success',
        'message_body': message_body,
        'sender': sender
    })

if __name__ == '__main__':
    app.run(debug=True, port=5000)

Contributing

Contributions are welcome! Please feel free to fork the repository, make your changes, and submit a pull request. We appreciate your input and will review each PR carefully and discuss potential changes.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A lightweight wrapper around the WAAPI Whatsapp API

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages