Async Python client for the WhatsApp Business Cloud API
Project description
whatsapp-client
Async Python client for the WhatsApp Business Cloud API.
Requires Python 3.14+
Installation
uv add whatsapp-client
Usage
from whatsapp_client import WhatsAppClient
async with WhatsAppClient(
phone_number_id="your-phone-number-id",
access_token="your-access-token",
) as client:
await client.send_text(to="5511999999999", body="Hello!")
Send media
await client.send_image(to="5511999999999", link="https://example.com/image.png", caption="Check this out")
await client.send_audio(to="5511999999999", link="https://example.com/audio.mp3")
await client.send_video(to="5511999999999", link="https://example.com/video.mp4")
await client.send_document(to="5511999999999", link="https://example.com/doc.pdf", filename="report.pdf")
await client.send_sticker(to="5511999999999", link="https://example.com/sticker.webp")
Send location
await client.send_location(to="5511999999999", latitude=-23.5505, longitude=-46.6333, name="São Paulo")
Send template
from whatsapp_client import Template, TemplateLanguage
await client.send_template(
to="5511999999999",
template=Template(name="hello_world", language=TemplateLanguage(code="en_US")),
)
Send interactive messages
from whatsapp_client import ReplyButton, ListSection, ListRow
await client.send_buttons(
to="5511999999999",
body="Choose an option:",
buttons=[ReplyButton(id="btn1", title="Option 1"), ReplyButton(id="btn2", title="Option 2")],
)
await client.send_list(
to="5511999999999",
body="Browse products:",
button_text="View",
sections=[ListSection(title="Category", rows=[ListRow(id="r1", title="Item 1")])],
)
Error handling
from whatsapp_client import WhatsAppAPIError
try:
await client.send_text(to="invalid", body="Hello")
except WhatsAppAPIError as e:
print(e.status_code, e.error_code, e.message)
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
whatsapp_client-0.1.0.tar.gz
(4.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file whatsapp_client-0.1.0.tar.gz.
File metadata
- Download URL: whatsapp_client-0.1.0.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a81accdd6ba34efc439b5d4e75c7644bb37119a0a29a215ee5637f0ed6ec5880
|
|
| MD5 |
e929add5cb85e5d137df5994a1e22e0e
|
|
| BLAKE2b-256 |
ef0cd347c77283774b3d87af359bb6e697382a8e54d72f932959cb1337f77df7
|
File details
Details for the file whatsapp_client-0.1.0-py3-none-any.whl.
File metadata
- Download URL: whatsapp_client-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b92330cabceaff29464211e3b5055fd6141f1a24cfadfb073657b8811f893e4a
|
|
| MD5 |
ed28d9f10941e26e268591587e1d3074
|
|
| BLAKE2b-256 |
197cbbcdcf2898bce7c3f05773abd8a7f28ff52250c0c6176a36fd459ee42340
|