Integration Guide

Python WhatsApp API Integration

Send WhatsApp Business messages from any Python application — Django, Flask, FastAPI, or pure scripts — using the Zaptilo PyPI package. Built for Indian data teams, fintechs, and EdTech platforms running Python on the backend. Install with pip install zaptilo-whatsapp and start sending in minutes.

Why use Zaptilo with Python?

  • Zero-dependency PyPI package — no extra HTTP libraries needed
  • Pay-as-you-go WhatsApp Business API pricing in INR — from ₹0.04/message
  • Works with Django, Flask, FastAPI, Celery, AWS Lambda, Google Cloud Functions
  • India-based support, GST-compliant invoicing
  • Send text, media, and approved template messages

Step 1: Install the package

pip install zaptilo-whatsapp

Step 2: Send your first message

from zaptilo_whatsapp import Zaptilo

client = Zaptilo(
    token="your_api_token_here",
    base_url="https://web.zaptilo.ai"
)

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

# Send a template
client.send_template(
    phone="919876543210",
    template_name="order_confirmation",
    language="en",
    body_values=["Priya Singh", "ORD-12345"]
)

Django integration

# views.py
from django.http import JsonResponse
from zaptilo_whatsapp import Zaptilo

client = Zaptilo(token=settings.ZAPTILO_TOKEN, base_url="https://web.zaptilo.ai")

def order_confirmation(request):
    client.send_template(
        phone=f"91{request.POST['phone']}",
        template_name="order_confirmation",
        language="en",
        body_values=[request.POST['name'], request.POST['order_id']]
    )
    return JsonResponse({"ok": True})

FastAPI integration

from fastapi import FastAPI
from zaptilo_whatsapp import Zaptilo

app = FastAPI()
wa = Zaptilo(token="...", base_url="https://web.zaptilo.ai")

@app.post("/order-placed")
async def order_placed(phone: str, name: str, order_id: str):
    wa.send_template(
        phone=f"91{phone}",
        template_name="order_confirmation",
        language="en",
        body_values=[name, order_id]
    )
    return {"ok": True}

Celery for background sends

Push WhatsApp delivery to background workers so request threads stay snappy:

from celery import shared_task
from zaptilo_whatsapp import Zaptilo

wa = Zaptilo(token=settings.ZAPTILO_TOKEN, base_url="https://web.zaptilo.ai")

@shared_task
def send_whatsapp_template(phone, template, values):
    wa.send_template(phone=phone, template_name=template, language="en", body_values=values)

# Trigger from anywhere
send_whatsapp_template.delay("919876543210", "otp_login", ["123456"])

Use cases for Indian Python teams

Django e-commerce

Order, dispatch, and delivery alerts from your Django admin.

Fintech OTP delivery

WhatsApp OTPs from Django/Flask backends — cheaper than SMS in India.

Data alerts

Push BI alerts, anomaly notifications, or report links from Airflow DAGs.

EdTech reminders

Class schedules, assignment due alerts from Django LMS.

Cron-driven reminders

Daily/weekly reminders via APScheduler or Celery Beat.

ML model alerts

Trigger WhatsApp from Python ML pipelines on threshold breaches.

Frequently asked questions

How do I install the Zaptilo Python SDK?

Run `pip install zaptilo-whatsapp` in your virtualenv. Import Zaptilo from zaptilo_whatsapp, initialize with your API token and base URL https://web.zaptilo.ai, and call client.send_message or client.send_template.

Does the Zaptilo Python SDK work with Django, Flask, and FastAPI?

Yes. The Zaptilo Python SDK is framework-agnostic and works with Django, Flask, FastAPI, Celery, AWS Lambda, and Google Cloud Functions. It has zero external dependencies.

How do I send WhatsApp asynchronously from Python?

Wrap your Zaptilo client calls in a Celery shared_task and call .delay(...) from your Django/Flask views. This keeps request threads fast for OTPs and bulk sends.

What is the cost of the Python WhatsApp Business API for India?

Zaptilo charges from ₹0.04 per message at volume, billed in INR with GST invoice. There is no monthly subscription, no setup fee, and no per-user fee — making it the most cost-effective WhatsApp Business API for Indian Python teams.

Send your first WhatsApp from Python

Free signup. INR pricing. No subscription. GST invoice. India-based support.

Get Started Free

See also: Laravel · Node.js · Spring Boot