Skip to navigation

Python SDK

The Partner API, events and webhooks for Python, synchronous and asyncio.

Requirements

RequirementDetail
Python3.11 or later — supported 3.11, 3.12, 3.13 and 3.14; 3.14 recommended
Runtime dependencieshttpx >=0.27,<1 and websockets >=13,<18
Optionalthe jwt extra adds cryptography >=42 for private_key_jwt

Install

Coming at general availability. Until then, this page shows the requirements and how the SDK is used.

Configure

client.py
import os
from evva_partner import ClientSecretBasic, EvvaPartnerClient
client = EvvaPartnerClient(
base_url="https://api.evvahub.com",
auth=ClientSecretBasic(os.environ["EVVA_CLIENT_ID"], os.environ["EVVA_CLIENT_SECRET"]),
)

ClientSecretPost sends the secret in the form body instead; PrivateKeyJwt signs a fresh assertion for every token request (RS256 or ES256), so no shared secret leaves your infrastructure:

private_key_jwt
from evva_partner import PrivateKeyJwt
auth = PrivateKeyJwt(os.environ["EVVA_CLIENT_ID"], private_key, key_id="key-2026-12", algorithm="ES256")

AsyncEvvaPartnerClient is the asyncio twin. Both are context managers.

First calls

first_calls.py
with EvvaPartnerClient(base_url="https://api.evvahub.com", auth=auth) as client:
print(client.app.me())
for account in client.accounts.list():
creator_id = account["creatorId"]
for conversation in client.conversations.iter(creator_id, limit=50):
print(creator_id, conversation["id"], conversation.get("lastMessageAt"))

client.<resource>.list(...) returns one page; .iter(...) walks every page. client.operations reaches every operation of the API reference.

Receive events and reply

bot.py
import asyncio, os
from evva_partner import AsyncEvvaPartnerClient, ClientSecretBasic, PartnerEventStream, SQLiteStore
async def main() -> None:
store = SQLiteStore("evva-state.db") # durable checkpoint + dedup
async with AsyncEvvaPartnerClient(
base_url="https://api.evvahub.com",
auth=ClientSecretBasic(os.environ["EVVA_CLIENT_ID"], os.environ["EVVA_CLIENT_SECRET"]),
) as client:
async def on_event(event):
if event.type == "message.received":
await client.messages.send_text(event.creator_id, event.conversation_id, "Got it!")
await PartnerEventStream(client, consumer_id="replier", handler=on_event,
checkpoints=store, dedup=store).run()
asyncio.run(main())
You wantUse
Low latency and no lossPartnerEventStream — realtime plus the feed, deduplicated
Batch, cron or replayFeedConsumer / AsyncFeedConsumer
Raw realtimeRealtimeClient

The checkpoint is saved only after your handler returns, so a crash re-delivers rather than loses. Implement CheckpointStore and DedupStore on your own database to share state across instances; SQLiteStore is durable on one host, the in-memory stores are for tests.

Errors

Each API error has .status, .code, .message, .details and .request_id.

ErrorWhen
BadRequestError400
AuthError401
PermissionDeniedError403
NotFoundError404
ConflictError, IdempotencyConflictError409
CursorExpiredError410 CURSOR_EXPIRED
RateLimitedError429 — .retry_after
ServerError, NetworkError5xx, no response
ApprovalRequiredError202 APPROVAL_REQUIRED — .approval_id. Re-send with approval_id= once approved; see Approvals.

Webhooks

webhooks.py
from evva_partner import WebhookHandler # AsyncWebhookHandler for asyncio frameworks
webhooks = WebhookHandler([os.environ["EVVA_WEBHOOK_SECRET"]], on_event=enqueue, dedup=store)
result = webhooks.handle(raw_body_bytes, request.headers)
return result.status # 204 handled/duplicate · 401 signature · 400 payload · 500 retry me

Polling statuses that have no event

waiters.py
client.waits.media_processing(creator_id, [asset_id]) # until ready / failed / unavailable
client.waits.scheduled_content(creator_id, content_id) # until the post left its scheduled draft

Next steps