WhatsApp API SDK for Python — send messages, templates, media, and broadcasts
Project description
gaviwhatsapp
WhatsApp API SDK for Python. Send messages, templates, media, and broadcasts.
Install
pip install gaviwhatsapp
Quick Start
import os
from gaviwhatsapp import WhatsApp
wa = WhatsApp(api_key=os.environ["GAVIVENTURES_API_KEY"])
# Send a text message
wa.send(to="+919876543210", text="Hello!")
# Send a template message
wa.send_template(
to="+919876543210",
template="order_confirmation",
variables={"1": "ORD-1234", "2": "$49.99"},
)
# Send media
wa.send_media(
to="+919876543210",
type="image",
url="https://example.com/photo.jpg",
caption="Your receipt",
)
# List templates
result = wa.get_templates()
print(result["templates"])
# Send broadcast
wa.broadcast(
recipients=["+919876543210", "+919876543211"],
template="promo_offer",
)
# Register webhook
webhook = wa.register_webhook(
url="https://myapp.com/api/webhook",
events=["message.received"],
)
print(webhook["secret"]) # Save for HMAC verification
API Reference
| Method | Description |
|---|---|
wa.send(to, text) |
Send a text message |
wa.send_template(to, template, language?, variables?) |
Send a template message |
wa.send_media(to, type, url, caption?, filename?) |
Send media |
wa.get_messages(phone?, limit?) |
Get message history |
wa.get_templates(sync?) |
List available templates |
wa.broadcast(recipients, template, language?, variables_per_recipient?) |
Send to multiple recipients |
wa.register_webhook(url, events?) |
Register a webhook endpoint |
wa.list_webhooks() |
List registered webhooks |
Get an API Key
Sign up at gaviventures.com and go to Settings > API Keys.
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
gaviwhatsapp-0.1.1.tar.gz
(3.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gaviwhatsapp-0.1.1.tar.gz.
File metadata
- Download URL: gaviwhatsapp-0.1.1.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf96a854590fd74c56954ff5d7f6260f92ae38943792f278de50c2402af5326e
|
|
| MD5 |
1df65c385a10c9cdc5d62666c1dada97
|
|
| BLAKE2b-256 |
b0255f4dafbad894f8abaed4fac154d0e89b640c0917c13ffe2abc7d81cf72ee
|
File details
Details for the file gaviwhatsapp-0.1.1-py3-none-any.whl.
File metadata
- Download URL: gaviwhatsapp-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4130ea44bef9b37c6835de66f6314c65152b1e096aa7fa360a802a4e850b8ce
|
|
| MD5 |
e0ffa03bf60d02b87d6e515064f3d65c
|
|
| BLAKE2b-256 |
87e46f8f757268cdfa79a03bc2c8ff2b5786c6e22bcd72405b5a30439f771df2
|