/lolapy-whatsapp

Lolapy SDK Whatsapp Extension

Primary LanguagePython

Logo

Lola v2 Python SDK Extension

This project is a Python SDK for the Prompter API. It is intended to be used by developers who want to integrate Lola into their own applications.

Installation

pip install lolapy-whatsapp

pip install git+https://...

pip install .

Examples

Check the examples folder for more examples

Send a message

PHONE = getenv("RECIPIENT_PHONE")

connector = WhatsappConnector(
                token=getenv("TOKEN"),
                phone_number_id=getenv("PHONE_NUMBER_ID")
            )

connector.send_text_message("Hello World!", PHONE)

Send reply buttons

PHONE = getenv("RECIPIENT_PHONE")

connector = WhatsappConnector(
                token=getenv("TOKEN"),
                phone_number_id=getenv("PHONE_NUMBER_ID")
            )


button1 = ReplyButton("id_yes", "Yes")
button2 = ReplyButton("id_no", "No")

connector.send_button_reply("Header Testing", 
                            "Body Testing", 
                            [button1, button2], 
                            PHONE, 
                            footer="Footer Testing")

Send link template

PHONE = getenv("RECIPIENT_PHONE")

connector = WhatsappConnector(
                token=getenv("TOKEN"),
                phone_number_id=getenv("PHONE_NUMBER_ID")
            )


connector.send_template("lola_verify_account", 
                        PHONE, 
                        body_params=["Alejandro", "*email*"], 
                        button_params=["PAYLOAD"])

Send Image

response = connector.send_image(
    PHONE,
    "https://i.imgur.com/Fh7XVYY.jpeg"
)

Intall for dev locally

Create a virtual environment

python3.11 -m venv .venv

Then activate the virtual environment

source .venv/bin/activate

For development purposes

pip install git+https://github.com/alejamp/whatsapp#egg=whatsapp-python