Skip to main content

openping-whatsapp

Async Python client for the WhatsApp Business Platform (Meta Graph API, default v26.0). One file, one dependency (httpx).

pip install openping-whatsapp      # or: uv add openping-whatsapp
from whatsapp_sdk import WhatsApp, WhatsAppError, verify_challenge, verify_signature

wa = WhatsApp("ACCESS_TOKEN", waba_id="WABA_ID", phone_number_id="PHONE_NUMBER_ID")

await wa.send_text("15551234567", "Hi")
await wa.send_template_message(to="15551234567", name="hello_world", language="en_US")

try:
    await wa.send_text("15551234567", "Hi")
except WhatsAppError as error:
    if error.retryable:      # never reached Meta, 429, 5xx, or a transient Meta code
        ...                  # safe to send again
    elif error.maybe_sent:   # went out, no answer: may have been delivered
        ...                  # don't resend blindly
    print(error.status_code, error.detail)

async for template in wa.paginate("WABA_ID/message_templates", limit=100):
    ...

# Webhooks
verify_challenge(request.query_params, VERIFY_TOKEN)          # setup handshake
verify_signature(APP_SECRET, raw_body, request.headers.get("X-Hub-Signature-256"))

waba_id / phone_number_id are defaults; every method also takes them as arguments. to accepts a phone number or a business-scoped user ID (BSUID); send(..., recipient_type="group") messages a group. For bulk sends, pass one shared httpx.AsyncClient (WhatsApp(..., client=client)). Pass app_secret= to sign every call with appsecret_proof. Anything not wrapped: await wa.request("GET", "<path>", params=..., json=...).

Coverage

Area Methods
Messages send (any type, BSUID, groups), send_message (raw payload), send_text, send_media, send_location, send_contacts, send_interactive, send_reaction, send_template_message (incl. MM Lite), mark_message_read (+ typing indicator)
Media upload_message_media (bytes or file), get_media, iter_media (streamed, Meta hosts only, no redirects, max_bytes), download_media, delete_media
Templates create, update, get, list, delete (bulk), upload_template_sample, list_template_library, compare_templates, preview_authentication_templates, upsert_authentication_templates, migrate_message_templates, template groups
Flows list_flows, create_flow, get_flow (+ metrics, preview), update_flow, delete_flow, upload_flow_json, list_flow_assets, publish_flow, deprecate_flow, migrate_flows
Phone numbers list, create, get, update, set_two_step_pin, register, deregister, request/verify code, get_sending_limits, settings, username (+ suggestions), contact book (BSUID), sync_business_app_data (coexistence)
Profile & settings business profile, commerce settings, Flows encryption key, compliance info (India), Official Business Account, conversational automation (welcome, ice breakers, commands)
QR codes · Blocking list/get/create/delete_qr_code(s) · list_blocked_users, block_users, unblock_users
Calling call (connect, pre_accept, accept, reject, terminate, media_update), get_call_permissions
Groups create, list, get, update, delete, invite link (get/reset/delete), join requests, participants
WABA get/update, get_analytics (messaging, conversation, pricing, call, template, template group, group), subscribed apps (+ callback override), assigned users, system users, schedules, activities, solutions, product catalogs (+ list_catalog_products), CTWA welcome sequences, In-App Signup, customer bases, reach estimate, migrations
Payments (India) payment configurations (list/get/create/update/delete, OAuth link), get_payment, refund_payment
Partners business portfolio, owned/client WABAs, create WABA, add phone numbers, business users, extended credit lines (share/attach/revoke), MM Lite onboarding, max price agreement, partner-led business verification, pre-verified numbers, Multi-Partner Solutions, message history events
Auth & tokens exchange_code (Embedded Signup), get_system_user_token, debug_token, app_id, appsecret_proof
Generic request, paginate, get_node / update_node / delete_node
Webhooks verify_challenge, verify_signature

Reference: https://developers.facebook.com/documentation/business-messaging/whatsapp/reference/llms.txt

Layout

src/whatsapp_sdk/
├── __init__.py   public exports
├── client.py     WhatsApp (combines the three API areas) and exchange_code
├── _base.py      request plumbing: auth, appsecret_proof, pagination, media streaming
├── messages.py   messages, media, templates, Flows
├── account.py    phone numbers, profile, QR codes, blocking, calling, groups
├── business.py   business account, analytics, payments, partners, credit lines
├── errors.py     WhatsAppError and retry classification
└── webhooks.py   verify_signature, verify_challenge

Test (from python/): uv run --isolated --no-project --with . python tests/test_whatsapp_sdk.py

License

Apache-2.0

Metadata

Release files for openping-whatsapp 0.2.1

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

Source distribution (sdist)

Source distribution for openping-whatsapp 0.2.1
File Size Uploaded Provenance Actions
openping_whatsapp-0.2.1.tar.gz 24.5 kB Without provenance Details for openping_whatsapp-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for openping-whatsapp 0.2.1
File Interpreter ABI Platform Actions
openping_whatsapp-0.2.1-py3-none-any.whl Python 3 none any Details for openping_whatsapp-0.2.1-py3-none-any.whl

Total release size: 50.4 kB

Release files / openping_whatsapp-0.2.1.tar.gz

Download URL openping_whatsapp-0.2.1.tar.gz
Size 24.5 kB
Tags Source
SHA-256 checksum
How to use checksums
576b975302e0ecbee0cb0e4fe86525cbb51e41098106487e53a4a0375bcdcf4c
BLAKE2b-256 checksum
How to use checksums
5b9acfe179f1a6d2cdf78330245925257ca87bf1171ab8cb400d02df0eefb6a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / openping_whatsapp-0.2.1-py3-none-any.whl

Download URL openping_whatsapp-0.2.1-py3-none-any.whl
Size 26.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
766324554abc7a92991a89b7c86709384017dd01286807229799ca2a3c36f05f
BLAKE2b-256 checksum
How to use checksums
1ab0eb279487c7cff41f0b3f0cbc964459df88e570f0a47fd4d5baa9d235ff1b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for openping-whatsapp 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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