Njiwa for Python
pip install njiwa
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.
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:
njiwa.send("254712345678", document="invoice.pdf", idempotency_key="invoice-4417")
Verifying a webhook:
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:
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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 njiwa-0.1.0.tar.gz.
File metadata
- Download URL: njiwa-0.1.0.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32e1be35722bb7dd666976c80a6c1f3add0a4fb3f3c35b5184f9c9c2c8d49112
|
|
| MD5 |
e7feeb34c08f60c7ec40f4d8d160c3fc
|
|
| BLAKE2b-256 |
86457d42b2c91da477d0743adeef534786c79fd2bf06f63745ec5a1bf2a4791b
|
File details
Details for the file njiwa-0.1.0-py3-none-any.whl.
File metadata
- Download URL: njiwa-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d1d1d80a32c9c5d18f3699ac182ea844886ae0ce8fe1882abd27b2147f667f89
|
|
| MD5 |
ab7cfbb5eeeddde346b5ebf54c6a9a94
|
|
| BLAKE2b-256 |
e80f53272789bba4bdec23e67e90eee055c444b5fddd5a50536bf7fd1c34beb3
|