Skip to main content

Production-ready Django WhatsApp Cloud Platform — Inbox, Campaigns, Templates, Analytics

Project description

django-meta-whatsapp logo

django-meta-whatsapp

A production-ready WhatsApp Cloud Platform engine for Django.

PyPI Latest on Django Packages Python Django License


django-meta-whatsapp is not just an API wrapper — it's a fully-featured, drop-in WhatsApp CRM and messaging platform that lives entirely within your existing Django project. Beautiful Tailwind UI, real-time inbox, bulk campaigns, webhook engine, and REST APIs — all without third-party SaaS subscriptions.


✨ Features

  • 📨 Live Unified Inbox — Real-time chat interface with media, reply threading, and message status ticks.
  • 🚀 Marketing Campaigns — Schedule and send bulk messages using approved WhatsApp Templates. Track delivery, read rates, and bounce rates.
  • 👥 Contact Management — Import CSVs, assign dynamic colored Labels, and auto-sync users who subscribe via WhatsApp deep-links.
  • 🎯 Contact Filter Presets — Define named audience filters in settings for one-click campaign targeting.
  • 🔗 User Model Integration — Link your Django User model to WhatsAppContact with pluggable audience providers.
  • 🚫 Blocked User Sync — Automatically detect and exclude users who block your business.
  • 🧩 Template Sync — Pull all approved WhatsApp message templates directly from Meta with one click.
  • 🔗 In-App Signups — Create and manage wa.me deep links so users can instantly opt-in.
  • Webhooks Engine — Built-in webhook endpoints to automatically ingest incoming messages, delivery receipts, and status updates.
  • 🔑 REST APIs — Send text, location, template; list chats/campaigns (API-key auth).
  • 🏢 Multi-Account — One Django project, multiple WhatsApp Business Accounts.

📦 Installation

# Using uv (Recommended)
uv add django-meta-whatsapp

# Using pip
pip install django-meta-whatsapp

⚙️ Configuration

1. Add to INSTALLED_APPS:

INSTALLED_APPS = [
    # ...
    "django_meta_whatsapp",
]

2. Mount URLs in urls.py:

from django.urls import path, include

urlpatterns = [
    # ...
    path("whatsapp/", include("django_meta_whatsapp.urls", namespace="django_meta_whatsapp")),
]

3. Add WHATSAPP settings to settings.py:

WHATSAPP = {
    # ── Required ──────────────────────────────────────────
    "API_TOKEN": "EAA...",
    "PHONE_NUMBER_ID": "1234567890",
    "WEBHOOK_VERIFY_TOKEN": "your_secure_random_string",

    # ── UI Customization (optional) ───────────────────────
    "DASHBOARD_NAME": "My Business CRM",
    "DASHBOARD_LOGO": "https://yourwebsite.com/logo.png",

    # ── Audience Providers (optional) ─────────────────────
    # Map your own model querysets as named campaign audiences
    "PHONE_FIELD": "phone",       # field on your model with the phone number
    "NAME_FIELD": "name",         # field on your model with the display name
    "AUDIENCES": {
        "All Users":     "myapp.audiences.all_users",
        "VIP Customers": "myapp.audiences.vip_customers",
    },

    # ── Contact Filter Presets (optional) ─────────────────
    # Pre-defined filters shown as a dropdown in the Campaign form
    "CONTACT_FILTERS": {
        "VIP Customers":        '{"labels__name": "VIP"}',
        "Subscribed via Link":  '{"subscribed_via_signup__isnull": false}',
        "New This Month":       '{"created_at__gte": "2024-06-01"}',
    },
}

4. Run migrations:

python manage.py migrate

🚀 Quickstart

  1. Visit /whatsapp/ in your browser.
  2. The UI will prompt you to add a WhatsApp Account if none exists.
  3. Set your Meta App Webhook URL to https://yourdomain.com/whatsapp/webhook/.
  4. Sync your templates from the Templates tab.
  5. Start chatting from the Inbox!

🔗 Linking Your Django User Model

You can link WhatsAppContact to your existing User model without modifying the package. Three approaches are documented:

Option A — Profile Model (recommended):

from django_meta_whatsapp.models import WhatsAppContact

class UserWhatsAppProfile(models.Model):
    user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name="whatsapp_profile")
    contact = models.OneToOneField(WhatsAppContact, on_delete=models.SET_NULL, null=True, blank=True)

Option B — Query your User model directly as a campaign audience:

# myapp/audiences.py
from django.contrib.auth import get_user_model
User = get_user_model()

def all_users():
    return User.objects.filter(is_active=True, phone__isnull=False)

See the full documentation for signals-based auto-linking and more filter patterns.


🔑 REST API

All endpoints require an X-API-Key header (generated from the dashboard under Settings → API Keys).

# Send a text message
curl -X POST https://yourdomain.com/whatsapp/api/send-message/ \
  -H "X-API-Key: your-key" \
  -H "Content-Type: application/json" \
  -d '{"phone": "919876543210", "message": "Hello!"}'

# Send an approved template
curl -X POST https://yourdomain.com/whatsapp/api/send-template/ \
  -H "X-API-Key: your-key" \
  -H "Content-Type: application/json" \
  -d '{"phone": "919876543210", "template_name": "order_update", "language": "en", "body_params": ["Rahul", "ORD-999"]}'

📖 Full Documentation

https://rahul-baberwal.github.io/django-meta-whatsapp


📋 Changelog

v1.0.4

  • ✅ Updated README with complete settings reference and REST API examples
  • ✅ Version badge added to docs (auto-updated each release)
  • ✅ Django 4.0 / 5.0 / 5.1 + Python 3.9+ version tags corrected in docs & README

v1.0.3

  • ✅ Contact Filter Presets — define named filters in settings, auto-populate campaign form
  • ✅ User model linking docs — 3 integration patterns with code examples
  • ✅ Dashboard logo updated to custom PNG
  • ✅ Sidebar scrollbar hidden for premium feel

v1.0.2

  • ✅ Single clean migration (0001_initial.py)
  • ✅ Mintlify-style documentation site (docs/index.html)
  • ✅ REST API documentation with cURL examples
  • pyproject.toml + uv migration

v1.0.1

  • ✅ Label system with color picker (tom-select)
  • ✅ Blocked user sync, In-App Signups, Catalog products
  • ✅ WhatsApp Catalog product management

Crafted with ❤️ by Rahul Baberwal

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_meta_whatsapp-1.0.4.tar.gz (1.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_meta_whatsapp-1.0.4-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file django_meta_whatsapp-1.0.4.tar.gz.

File metadata

  • Download URL: django_meta_whatsapp-1.0.4.tar.gz
  • Upload date:
  • Size: 1.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for django_meta_whatsapp-1.0.4.tar.gz
Algorithm Hash digest
SHA256 e706dac5f20c73187f603fbee553c91c6de7662818bc65a27605a0256ceef043
MD5 4cd0b067b22f33d907459961826df18c
BLAKE2b-256 c2136b17f088ccabadbf52f90ff1e086d79266cda3b09b90d84179bae19b829a

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_meta_whatsapp-1.0.4.tar.gz:

Publisher: publish.yml on rahul-baberwal/django-meta-whatsapp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_meta_whatsapp-1.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for django_meta_whatsapp-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 63e275a2b57ab88ee36a79c9e37c0bd395286496e7ae323618903ac5d59bad27
MD5 929cb7db53552b0825753cc761628e51
BLAKE2b-256 ab2861661621f91cd78505cd4694645de6d4a226c4566c969ce3a48efa4c76a2

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_meta_whatsapp-1.0.4-py3-none-any.whl:

Publisher: publish.yml on rahul-baberwal/django-meta-whatsapp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page