Skip to main content

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

njiwa-0.1.0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

njiwa-0.1.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

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

Hashes for njiwa-0.1.0.tar.gz
Algorithm Hash digest
SHA256 32e1be35722bb7dd666976c80a6c1f3add0a4fb3f3c35b5184f9c9c2c8d49112
MD5 e7feeb34c08f60c7ec40f4d8d160c3fc
BLAKE2b-256 86457d42b2c91da477d0743adeef534786c79fd2bf06f63745ec5a1bf2a4791b

See more details on using hashes here.

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

Hashes for njiwa-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d1d1d80a32c9c5d18f3699ac182ea844886ae0ce8fe1882abd27b2147f667f89
MD5 ab7cfbb5eeeddde346b5ebf54c6a9a94
BLAKE2b-256 e80f53272789bba4bdec23e67e90eee055c444b5fddd5a50536bf7fd1c34beb3

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page