whatsapp-cloud-api-py 0.1.1__py3-none-any.whl → 0.2.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- whatsapp_cloud_api/client.py +3 -3
- {whatsapp_cloud_api_py-0.1.1.dist-info → whatsapp_cloud_api_py-0.2.1.dist-info}/METADATA +19 -11
- {whatsapp_cloud_api_py-0.1.1.dist-info → whatsapp_cloud_api_py-0.2.1.dist-info}/RECORD +5 -5
- {whatsapp_cloud_api_py-0.1.1.dist-info → whatsapp_cloud_api_py-0.2.1.dist-info}/WHEEL +0 -0
- {whatsapp_cloud_api_py-0.1.1.dist-info → whatsapp_cloud_api_py-0.2.1.dist-info}/licenses/LICENSE +0 -0
whatsapp_cloud_api/client.py
CHANGED
|
@@ -15,8 +15,8 @@ if TYPE_CHECKING:
|
|
|
15
15
|
from .resources.phone_numbers import PhoneNumbersResource
|
|
16
16
|
from .resources.templates.resource import TemplatesResource
|
|
17
17
|
|
|
18
|
-
_DEFAULT_BASE_URL = "https://
|
|
19
|
-
_DEFAULT_VERSION = "
|
|
18
|
+
_DEFAULT_BASE_URL = "https://api.kapso.ai/meta/whatsapp"
|
|
19
|
+
_DEFAULT_VERSION = "v24.0"
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
class WhatsAppClient:
|
|
@@ -71,7 +71,7 @@ class WhatsAppClient:
|
|
|
71
71
|
|
|
72
72
|
@property
|
|
73
73
|
def _auth_headers(self) -> dict[str, str]:
|
|
74
|
-
return {"
|
|
74
|
+
return {"X-API-Key": self._access_token}
|
|
75
75
|
|
|
76
76
|
# ── core request ─────────────────────────────────────────────
|
|
77
77
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: whatsapp-cloud-api-py
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: Async Python SDK for WhatsApp Business Cloud API with Pydantic V2
|
|
5
5
|
Project-URL: Homepage, https://github.com/HeiCg/whatsapp-cloud-api-py
|
|
6
6
|
Project-URL: Repository, https://github.com/HeiCg/whatsapp-cloud-api-py
|
|
@@ -26,12 +26,22 @@ Description-Content-Type: text/markdown
|
|
|
26
26
|
|
|
27
27
|
# whatsapp-cloud-api-py
|
|
28
28
|
|
|
29
|
-
Community-built async Python SDK for the WhatsApp Business Cloud API.
|
|
29
|
+
Community-built async Python SDK for the WhatsApp Business Cloud API, powered by [Kapso](https://kapso.ai).
|
|
30
30
|
|
|
31
31
|
> **Note:** This is an **independent Python implementation** — not a port or fork. It was inspired by the excellent [`@kapso/whatsapp-cloud-api`](https://github.com/gokapso/whatsapp-cloud-api-js) (TypeScript), but written from scratch in Python with its own architecture, design choices, and API surface.
|
|
32
32
|
|
|
33
33
|
Built with **httpx** (HTTP/2 + connection pooling), **Pydantic V2** (Rust-powered validation), and optional **pyventus** event-driven webhooks.
|
|
34
34
|
|
|
35
|
+
## Prerequisites
|
|
36
|
+
|
|
37
|
+
This SDK connects to Meta's WhatsApp Cloud API through [Kapso's](https://kapso.ai) managed proxy. You'll need a **Kapso API key** before getting started:
|
|
38
|
+
|
|
39
|
+
1. Create an account at [kapso.ai](https://kapso.ai)
|
|
40
|
+
2. Connect your WhatsApp Business account
|
|
41
|
+
3. Generate an API key from the dashboard
|
|
42
|
+
|
|
43
|
+
See the [Kapso docs](https://docs.kapso.ai/docs/introduction) for detailed setup instructions.
|
|
44
|
+
|
|
35
45
|
## Features
|
|
36
46
|
|
|
37
47
|
- **Fully async** — all I/O uses `async`/`await` with httpx
|
|
@@ -69,7 +79,7 @@ import asyncio
|
|
|
69
79
|
from whatsapp_cloud_api import WhatsAppClient, TextMessage
|
|
70
80
|
|
|
71
81
|
async def main():
|
|
72
|
-
async with WhatsAppClient(access_token="
|
|
82
|
+
async with WhatsAppClient(access_token="YOUR_KAPSO_API_KEY") as client:
|
|
73
83
|
response = await client.messages.send_text(TextMessage(
|
|
74
84
|
phone_number_id="PHONE_NUMBER_ID",
|
|
75
85
|
to="5511999999999",
|
|
@@ -562,24 +572,22 @@ except GraphApiError as e:
|
|
|
562
572
|
```python
|
|
563
573
|
from whatsapp_cloud_api import WhatsAppClient
|
|
564
574
|
|
|
565
|
-
# Default:
|
|
566
|
-
client = WhatsAppClient(access_token="
|
|
575
|
+
# Default: api.kapso.ai, v23.0, HTTP/2, 30s timeout
|
|
576
|
+
client = WhatsAppClient(access_token="YOUR_KAPSO_API_KEY")
|
|
567
577
|
|
|
568
|
-
# Custom
|
|
578
|
+
# Custom timeout
|
|
569
579
|
client = WhatsAppClient(
|
|
570
|
-
access_token="
|
|
571
|
-
base_url="https://graph.facebook.com",
|
|
572
|
-
graph_version="v23.0",
|
|
580
|
+
access_token="YOUR_KAPSO_API_KEY",
|
|
573
581
|
timeout=60.0,
|
|
574
582
|
)
|
|
575
583
|
|
|
576
584
|
# Bring your own httpx client
|
|
577
585
|
import httpx
|
|
578
586
|
custom_http = httpx.AsyncClient(http2=True, timeout=60.0)
|
|
579
|
-
client = WhatsAppClient(access_token="
|
|
587
|
+
client = WhatsAppClient(access_token="YOUR_KAPSO_API_KEY", http_client=custom_http)
|
|
580
588
|
|
|
581
589
|
# Always use as async context manager
|
|
582
|
-
async with WhatsAppClient(access_token="
|
|
590
|
+
async with WhatsAppClient(access_token="YOUR_KAPSO_API_KEY") as client:
|
|
583
591
|
await client.messages.send_text(...)
|
|
584
592
|
```
|
|
585
593
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
whatsapp_cloud_api/__init__.py,sha256=Di8XwNmOvQlumpaSdjxnaZcibLlaGA1PQCoNfzE0aTs,2011
|
|
2
|
-
whatsapp_cloud_api/client.py,sha256=
|
|
2
|
+
whatsapp_cloud_api/client.py,sha256=QBVbFjvM64JoG3YRWRFw8CQYE9Oy0E-ScTOoROnLGEI,5719
|
|
3
3
|
whatsapp_cloud_api/types.py,sha256=ShfVT4R1ks67A06sZCOymPb9p-0Wxd_NSNuvI08DuNU,5790
|
|
4
4
|
whatsapp_cloud_api/errors/__init__.py,sha256=1GvmVFH0PZdS9YnxidzGmSAIPiPLi1GICAKH8hHAYI0,296
|
|
5
5
|
whatsapp_cloud_api/errors/categorize.py,sha256=oc9l8oCLatvw3Ag-Uwl6j8dUc55wlV_I7WmVgW112zA,2019
|
|
@@ -23,7 +23,7 @@ whatsapp_cloud_api/utils/case.py,sha256=Vu2LH15ZuCKqfXZdRn1fPk-ctmQgSaqC3_wz4kwD
|
|
|
23
23
|
whatsapp_cloud_api/webhooks/__init__.py,sha256=wKf4IE-exZXQ_xUwhkf4J54e7-EGOkvoASmp2Uv5sM0,131
|
|
24
24
|
whatsapp_cloud_api/webhooks/normalize.py,sha256=8tTAmGRvzZ15AmuWXBphOlmoomM86e3SfVpKJKqATmY,2633
|
|
25
25
|
whatsapp_cloud_api/webhooks/verify.py,sha256=DAA2vHtm2vB9AthDZrER6b3jZTU31CaDVUnnvRvOKg0,1033
|
|
26
|
-
whatsapp_cloud_api_py-0.
|
|
27
|
-
whatsapp_cloud_api_py-0.
|
|
28
|
-
whatsapp_cloud_api_py-0.
|
|
29
|
-
whatsapp_cloud_api_py-0.
|
|
26
|
+
whatsapp_cloud_api_py-0.2.1.dist-info/METADATA,sha256=WCPzeVBF4W6q2uQ3DbIoU4Tgl1r8a9ln75ItQFQwwi8,19280
|
|
27
|
+
whatsapp_cloud_api_py-0.2.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
28
|
+
whatsapp_cloud_api_py-0.2.1.dist-info/licenses/LICENSE,sha256=x8Z_8RMIgoi1dz7Wl4v_0OdmLI-EHdc3kJtE4PbaFT4,1062
|
|
29
|
+
whatsapp_cloud_api_py-0.2.1.dist-info/RECORD,,
|
|
File without changes
|
{whatsapp_cloud_api_py-0.1.1.dist-info → whatsapp_cloud_api_py-0.2.1.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|