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

Test: uv run --no-project --with httpx python test_whatsapp_sdk.py

Releasing

  1. Bump version in pyproject.toml and push to main.
  2. Actions → Release to PyPI & GitHub → Run workflow. It tests, builds, publishes to PyPI, tags vX.Y.Z, and creates a GitHub release.

License

Apache-2.0

Metadata

Release files for openping-whatsapp 0.1.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 openping-whatsapp 0.1.0
File Size Uploaded Provenance Actions
openping_whatsapp-0.1.0.tar.gz 23.3 kB Without provenance Details for openping_whatsapp-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 45.1 kB

Release files / openping_whatsapp-0.1.0.tar.gz

Download URL openping_whatsapp-0.1.0.tar.gz
Size 23.3 kB
Tags Source
SHA-256 checksum
How to use checksums
2362f38d2a401d148847df84fb635f23ff8e4f4abae26d08be6c9b71eea6f99d
BLAKE2b-256 checksum
How to use checksums
db18c4d6d71b18b592befbf1eb082958c07a5c0b4e5c87b8890fabfbdbaa0ea0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","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.1.0-py3-none-any.whl

Download URL openping_whatsapp-0.1.0-py3-none-any.whl
Size 21.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2197563930d9641f5f514b02d51b8b3ba0d468c7bbb0d059fcdb82c426f6b057
BLAKE2b-256 checksum
How to use checksums
f300dc9378c98e80f75fc85c05f7b25c19a565132d0339134a71f85ac62be294
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","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.1.0

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