Python SDK
Install whabuzz from PyPI, send your first message in ten lines, verify webhooks.
The whabuzz package for Python 3.9+. No dependencies (urllib by default; add the httpx extra to use httpx). Request bodies and responses are Meta's own.
pip install whabuzz
export WHABUZZ_API_KEY="wb_live_..." # your keybash#First message
import os
from whabuzz import WhaBuzz
wb = WhaBuzz() # reads WHABUZZ_API_KEY
res = wb.messages.send({
"from": "+14692311132", # your connected number
"to": os.environ["TO"], # the recipient, E.164
"type": "text",
"text": {"body": "Hello from WhaBuzz"},
})
print(res["messages"][0]["id"])pythonOutside the 24-hour customer window send a template instead.
#Options and resources
WhaBuzz(api_key, base_url, tenant, timeout, transport); transport="httpx" needs pip install whabuzz[httpx]. Pass idempotency_key= on send, batch and create calls; see Idempotency.
tenant.get, messages (send, batch, get_batch, list_batch_items, cancel_batch, mark_read), templates (list, create, get), numbers (list, get), webhooks.endpoints (list, create, get, update, delete, verify, rotate_secret), events (list, get, iterate), media.get.
#Errors
Failures raise WhaBuzzError with status, source (meta, whabuzz, client), code, meta (Meta's error object, verbatim) and request_id. See Errors.
#Verify a webhook
from whabuzz import verify_webhook
# raw_body must be the exact bytes received, before JSON parsing
event = verify_webhook(raw_body, request.headers, WEBHOOK_SECRET)
print(event["type"])pythonRaises WebhookVerificationError with a reason when the signature, timestamp (300 s) or header is wrong. Details of the scheme: Webhooks.
This page as Markdown: /sdks/python.md. All docs in one file: /llms-full.txt.