eSauti Marketing SDK for Python
Send customer and business events to an eSauti marketing tenant to drive marketing workflows. This SDK also retains its marketing REST API support for contacts, campaigns, and other tenant resources.
Customer API: Verify, WhatsApp, and Wallet
One esauti installation includes both Marketing and the Customer API:
import os
from esauti.api import ESauti
api = ESauti(os.environ["ESAUTI_API_KEY"])
balance = api.wallet.balance()
verification = api.verify.create(
{"recipient": "+14165551234", "channel": "whatsapp", "language": "en"},
idempotency_key="signup-123-send-otp-1",
)
The Customer API defaults to https://api.esauti.com and has its own API key.
It exposes verify, whatsapp, and wallet, with typed dictionaries in
esauti.api.models and errors in esauti.api.errors. It makes one request
attempt, rejects redirects, and requires explicit idempotency keys where specified.
Existing from esauti import EsautiClient usage, client.api tenant resources,
and Marketing events remain available with their existing configuration.
Migrating from esauti-api: replace from esauti_api import ESauti with
from esauti.api import ESauti. Update model and error imports in the same way,
install this repository's esauti package, then remove the old esauti-api
dependency. Method calls and response dictionaries are unchanged.
See Customer API documentation for all operations, error handling, and retry guidance.
Which SDK should I use?
| Your integration | SDK | Python import |
|---|---|---|
| Track events for marketing workflows; manage marketing tenant resources | eSauti Marketing SDK (esauti) |
from esauti import EsautiClient |
| Send messages, verify users, manage WhatsApp accounts/templates, or retrieve wallet balances | eSauti API SDK (esauti-api) |
from esauti_api import ESauti |
The Marketing SDK keeps the existing esauti package, imports, and public
methods. Both SDKs can coexist and release independently. Configure each
client with the credentials and endpoint for its own product.
Requirements
- Python 3.10+
requests >= 2.20
Installation
pip install esauti
Or from source:
git clone https://github.com/esauti/pyesauti
cd pyesauti
pip install -e ".[dev]"
Quick Start
Event Injection
from esauti import EsautiClient
from esauti.events import EventType
client = EsautiClient(
base_url="https://your-instance.esauti.com",
token="YOUR_BEARER_TOKEN",
)
receipt = client.events.send(
EventType.CUSTOMER_CREATED,
customer={"id": "cus_123", "email": "jane@esauti.com"},
data={"status": "active"},
source="my-app",
)
print(receipt)
HMAC Signing
from esauti import EsautiClient
client = EsautiClient(
base_url="https://your-instance.esauti.com",
token="YOUR_BEARER_TOKEN",
hmac_secret="your-hmac-secret",
)
receipt = client.events.send(
"order.created",
customer={"id": "cus_456"},
data={"value": 99.99, "currency": "USD"},
source="shopify",
)
Marketing REST API
from esauti import EsautiClient
client = EsautiClient(
base_url="https://your-instance.esauti.com/api",
token="YOUR_BEARER_TOKEN",
)
# List contacts
contacts = client.api.contacts.list(limit=10)
print(contacts)
# Create a contact
contact = client.api.contacts.create({"firstname": "Jane", "email": "jane@esauti.com"})
print(contact)
Configuration
client = EsautiClient(
base_url="https://...",
token="...",
hmac_secret=None, # optional HMAC secret for event signing
timeout=30.0, # request timeout in seconds
max_retries=3, # max retry attempts
debug=False, # enable debug logging
redact_pii=False, # redact email/phone in logs
events_endpoint="/api/integrations/events", # override events URL
source="sdk", # X-eSauti-Source header value
)
Running Tests
pip install -e ".[dev]"
pytest
Project Structure
src/esauti/
├── __init__.py # Public API
├── client.py # EsautiClient entrypoint
├── auth.py # BearerAuth, HmacAuth, CompositeAuth
├── transport.py # HttpTransport abstraction + requests impl
├── retry.py # RetryPolicy with exponential backoff + jitter
├── exceptions.py # ApiError, EventValidationError
├── _logging.py # Redacting structured logger
├── deadletter.py # DeadLetter sink (JSONL file or custom hook)
├── api/
│ ├── __init__.py
│ └── client.py # OpenAPI module (contacts, campaigns, etc.)
└── events/
├── __init__.py
├── registry.py # EventType enum + registry loader
├── builder.py # Event envelope builder + validator
└── client.py # EventsClient (build / send)
Documentation
| Document | Description |
|---|---|
| 01 – Installation & Setup | Requirements, pip install, environment variables |
| 02 – Getting Started | Your first marketing event and tenant API call |
| 03 – Authentication | Bearer tokens, API keys, HMAC signing |
| 04 – REST API Module | Contacts, campaigns, forms and all resource methods |
| 05 – Events Module | Building, validating and sending canonical events |
| 06 – Event Types Reference | All 225 canonical event type constants |
| 07 – Error Handling | ApiError, TransportError, EventValidationError |
| 08 – Reliability | Retry policy, dead-letter sink, idempotency |
| 09 – Logging | Debug logging, PII redaction |
| 10 – Advanced | Custom transport, testing, multi-tenant usage |
Changelog
See CHANGELOG.md.
Metadata
Release files for esauti 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| esauti-1.1.0.tar.gz | 61.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| esauti-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 119.3 kB
Release files / esauti-1.1.0.tar.gz
| Download URL | esauti-1.1.0.tar.gz |
|---|---|
| Size | 61.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1d93dd1b1b6f1703f61d39d6747dfc0044cedb3ef375dfbef741f41ad92f5c95
|
|
BLAKE2b-256 checksum How to use checksums |
52621a2e423a25350b20be7e86e811576fc2f3fb9a984a348082a9a03a7a34b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.7
|
Release files / esauti-1.1.0-py3-none-any.whl
| Download URL | esauti-1.1.0-py3-none-any.whl |
|---|---|
| Size | 57.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ade6dddd121548b8a5ecab940b0d8a04d7c7f26b05082d54ce13d50293b4d8bb
|
|
BLAKE2b-256 checksum How to use checksums |
c331198687803cfca2d10810ca9df944bce2e83a709a2647e419aeb75a68ed5e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.7
|
Security for esauti 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.