django-meta-whatsapp supports multiple WhatsApp Business Accounts in a single Django project. Each account has its own credentials, inbox, campaigns, and templates. The dashboard includes an account selector that scopes all views — inbox, campaigns, templates, and analytics — to the currently active account.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/rahul-baberwal/django-meta-whatsapp/llms.txt
Use this file to discover all available pages before exploring further.
WhatsAppAccount Model Fields
Each WhatsApp Business Account is represented by aWhatsAppAccount record with the following fields:
| Field | Type | Description |
|---|---|---|
name | CharField | Friendly label for this account (e.g. "Business A") |
access_token | TextField | Meta permanent or system-user access token |
phone_number_id | CharField | Phone number ID from the Meta developer dashboard |
waba_id | CharField | WhatsApp Business Account ID — required for template sync and In-App Signups |
verify_token | CharField | Per-account webhook verify token, auto-generated as a UUID on creation |
profile_name | CharField | Business profile name, fetched automatically via Graph API on save |
profile_picture_url | URLField | Profile picture URL, fetched automatically via Graph API on save |
default_catalog_id | CharField | Default Meta Commerce Catalog ID for this account |
is_active | BooleanField | Whether this account is active and eligible for webhook matching |
created_at | DateTimeField | Auto-set on creation |
Creating Accounts
Add a new account through the dashboard at/whatsapp/settings/accounts/add/. When you save the form, the package will attempt to fetch the profile_name and profile_picture_url automatically using the provided access_token.
Each account automatically receives a unique UUID as its verify_token, which is used to verify its specific webhook subscription with Meta.
Switching Accounts
The account selector dropdown in the dashboard header lets agents switch between accounts without leaving the current page. Selecting an account POSTs to/whatsapp/settings/accounts/set-global/, which stores the chosen account’s ID in the Django session:
request.session["wa_account_id"] and filter their querysets accordingly. If no session value is set, views fall back to the first active account found.
Per-Account Webhook Routing
All accounts share a single webhook URL (/whatsapp/webhook/). The webhook view handles routing transparently:
- Verification (
GET): When Meta sends ahub.verify_token, the view checks it against all activeWhatsAppAccount.verify_tokenvalues. If none match, it falls back toWHATSAPP["VERIFY_TOKEN"]in settings. - Inbound messages (
POST): The payload contains aphone_number_idinvalue.metadata. The view matches this to the correctWhatsAppAccountrecord and associates all createdWhatsAppMessageandWhatsAppConversationrecords with that account.
Using Accounts Programmatically
All utility functions indjango_meta_whatsapp.utils accept an optional account parameter. Pass a WhatsAppAccount instance to direct API calls to that account’s credentials:
Single-Account Mode
If you only operate one WhatsApp Business Account, you can place credentials directly in your Djangosettings.py under the WHATSAPP dictionary. Utility functions fall back to these settings when account=None is passed:
settings.py
- The
WhatsAppAccountinstance passed asaccount= WHATSAPP["ACCESS_TOKEN"]in Django settingsMETA_WA_ACCESS_TOKENDjango settingMETA_WA_ACCESS_TOKENenvironment variable