Skip to main content

Zaptilo WhatsApp Business API SDK for Python

Official Python SDK for the Zaptilo WhatsApp Business API. Send text, media, and template messages via WhatsApp with a simple, clean API.

Zero dependencies — uses only Python standard library.

Installation

pip install zaptilo-whatsapp

Requirements: Python 3.7+

Quick Start

from zaptilo_whatsapp import Zaptilo

client = Zaptilo("YOUR_API_TOKEN")

# Send a text message
client.send_message("919876543210", "Hello from Zaptilo!")

Get your API token from the Zaptilo Dashboard under Developer Tools > Access Tokens.

Usage

Send Text Message

client.send_message("919876543210", "Hello! Your order has been confirmed.")

Send Template Message

client.send_template(
    number="919876543210",
    template_name="order_update",
    language="en",
    body_values=["John", "Shipped"],
    header_values=["#ORD-1234"],
)

Send Media Message

# Send image
client.send_media("919876543210", "https://example.com/photo.jpg", "image", "Check this out!")

# Send document
client.send_media("919876543210", "https://example.com/invoice.pdf", "document", "Your invoice")

# Send video
client.send_media("919876543210", "https://example.com/video.mp4", "video")

List Templates

result = client.get_templates()

for template in result["data"]:
    print(f"{template['name']} - {template['status']}")

Check Credit Balance

result = client.get_balance()
print(f"Balance: {result['balance']}")

Verify API Token

result = client.verify()
print(result["message"])  # "API key is valid and active"

Error Handling

from zaptilo_whatsapp import Zaptilo, ZaptiloException

client = Zaptilo("YOUR_API_TOKEN")

try:
    client.send_message("919876543210", "Hello!")
except ZaptiloException as e:
    print(f"Error: {e}")
    print(f"Status code: {e.status_code}")

Configuration

# Custom base URL (for self-hosted or staging)
client = Zaptilo("YOUR_TOKEN", base_url="https://your-domain.com")

# Custom timeout (default: 30 seconds)
client = Zaptilo("YOUR_TOKEN", timeout=60)

API Reference

Method Description
send_message(number, message) Send a text message
send_media(number, media_url, media_type, caption) Send image, video, or document
send_template(number, template_name, language, body_values, header_values) Send a template message
get_templates() List all approved templates
get_balance() Get current credit balance
verify() Verify API token and subscription status

Django / Flask Integration

# Django - settings.py
ZAPTILO_API_TOKEN = os.environ.get("ZAPTILO_API_TOKEN")

# In your view
from zaptilo_whatsapp import Zaptilo
from django.conf import settings

client = Zaptilo(settings.ZAPTILO_API_TOKEN)
client.send_message("919876543210", "Hello from Django!")
# Flask
import os
from zaptilo_whatsapp import Zaptilo

client = Zaptilo(os.environ["ZAPTILO_API_TOKEN"])

@app.route("/notify")
def notify():
    client.send_message("919876543210", "Hello from Flask!")
    return "Sent!"

Links

License

MIT

Metadata

Release files for zaptilo-whatsapp 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zaptilo-whatsapp 1.0.0
File Size Uploaded
zaptilo_whatsapp-1.0.0.tar.gz 5.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for zaptilo-whatsapp 1.0.0
File Interpreter ABI Platform
zaptilo_whatsapp-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.0 kB

Release files / zaptilo_whatsapp-1.0.0.tar.gz

Download URL zaptilo_whatsapp-1.0.0.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
6dd62f9bf02ed2343a0c2eb32a45732e2a2810f9600bbf7d1e2bd47f235209c0
BLAKE2b-256 checksum
How to use checksums
824966b61d007d44063cbc40a9fccd1a49ca54fb23697c8470368c07cdb462ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / zaptilo_whatsapp-1.0.0-py3-none-any.whl

Download URL zaptilo_whatsapp-1.0.0-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
676c7611573db6a70d76bcf42d70218b34143b4f932c8cbea99916dbf90ab7be
BLAKE2b-256 checksum
How to use checksums
e1ea8dca8671cfe935b98742903dc0389a7a52f7fcabd803ee1f61a4d638b797
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page