Metadata-Version: 2.5
Name: njiwa
Version: 0.1.0
Summary: Njiwa. Send a WhatsApp message with one HTTP call.
Project-URL: Homepage, https://njiwa.upeo.ai
Project-URL: Documentation, https://docs.njiwa.upeo.ai
Author-email: Karani Geoffrey <hello@upeo.ai>
License: MIT
Keywords: api,kenya,messaging,sms,whatsapp
Requires-Python: >=3.9
Requires-Dist: httpx>=0.24
Description-Content-Type: text/markdown

# Njiwa for Python

```bash
pip install njiwa
```

```python
from njiwa import Njiwa

njiwa = Njiwa("sk_live_...")
njiwa.send("254712345678", document="invoice.pdf", caption="Your invoice")
```

A local file path uploads automatically. A URL passes through. A `med_` id
passes through. You do not have to know which is happening.

```python
njiwa.send("0712345678", text="Hello")                       # local number, fine
njiwa.send("254712345678", image="https://example.com/a.jpg")
njiwa.send("254712345678", location={"lat": -1.29, "lng": 36.82})

result = njiwa.send("254712345678", text="Hi", wait=True)     # block for the outcome
print(result["status"])
```

Anything that must not happen twice takes an idempotency key:

```python
njiwa.send("254712345678", document="invoice.pdf", idempotency_key="invoice-4417")
```

Verifying a webhook:

```python
if not Njiwa.verify_webhook(secret, request.body, request.headers["X-Njiwa-Signature"]):
    return 400
```

Errors carry a stable `code` and a link to the page explaining the fix:

```python
from njiwa import NjiwaError

try:
    njiwa.send("254712345678", document="huge.pdf")
except NjiwaError as e:
    print(e.code, e, e.docs)
```

Docs at https://docs.njiwa.upeo.ai
UPEO.AI. 0116888777 on WhatsApp. hello@upeo.ai
