Skip to main content

Senviok Python SDK

Official Python client for the Senviok messaging API — email, SMS and WhatsApp, plus the resources around them. Mirrors the official JavaScript SDK's public facade 1:1, so the two stay in lockstep.

  • Sync (Senviok) and async (AsyncSenviok) clients
  • Typed request and response models (pydantic)
  • Automatic camelCase serialization — the API's quirks are handled for you (e.g. list endpoints that return bare arrays vs. wrapped payloads)
  • webhooks.verify_signature() for validating webhook payloads

Installation

pip install senviok

Quick start

from senviok import Senviok

senviok = Senviok("svk_live_xxx")

# Email — note `from_` (trailing underscore: `from` is a Python keyword)
message = senviok.emails.send(
    from_="Acme <onboarding@acme.com>",
    to="dev@acme.com",                      # or a list: ["dev@acme.com", "ops@acme.com"]
    subject="Hello from Senviok",
    html="<p>Hello!</p>",
)
print(message.id)  # msg_...

# SMS
senviok.sms.send(to="+2348012345678", from_="Senviok", text="Your code is 123456")

# WhatsApp
senviok.whatsapp.send(to="+2348012345678", from_="Senviok", text="Hello!")

Resources

Resource Methods
emails send(...)
sms send(to, from_, text)
whatsapp send(to, from_, text)
messages list(skip, take, sort_order, channel, status, to_address, from_address, subject, start_date, end_date)
webhooks create(url, events), list(), delete(id), logs(webhook_id), verify_signature(raw_body, signature, secret)
templates create(name, subject, html_content), list(), get(id), update(id, ...), delete(id)
domains create(name), list(), get_dkim(id), verify(id)
audiences create(name), list(), delete(id)
contacts create(audience_id, email, first_name, last_name, unsubscribed), list(audience_id), delete(audience_id, id)
suppressions create(email, reason), list(), delete(id)
api_keys create(name), list(), delete(id)

Email options

emails.send accepts the same options as the JS SDK, with snake_case names:

  • from_, from_name, to, subject, html, text
  • cc, bcc, reply_to
  • template_id, template_data
  • add_unsubscribe_footer, add_list_unsubscribe_header

Unknown options raise TypeError immediately — no silent typos.

Webhook signature verification

raw_body = b'{"event":"email.delivered","messageId":"msg_123"}'

if senviok.webhooks.verify_signature(raw_body, signature, secret):
    # signature is valid — process the event
    ...

Async usage

import asyncio
from senviok import AsyncSenviok

async def main():
    async with AsyncSenviok("svk_live_xxx") as senviok:
        await senviok.emails.send(
            from_="hi@example.com",
            to="user@example.com",
            subject="Hi",
            html="<p>Hi</p>",
        )
        logs = await senviok.messages.list(take=10)

asyncio.run(main())

Local development

Point the client at a locally running API:

senviok = Senviok("dev-key", base_url="http://localhost:5033")

Errors

Exception When
AuthenticationError Missing/invalid API key (HTTP 401/403)
RateLimitError Tenant rate limit exceeded (HTTP 429, 100 req/min)
ApiError Any other non-2xx response (carries status_code and raw body)

All inherit from SenviokError.

Development

uv sync --extra dev
uv run pytest

License

MIT

Metadata

Release files for senviok 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for senviok 0.1.0
File Size Uploaded
senviok-0.1.0.tar.gz 35.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for senviok 0.1.0
File Interpreter ABI Platform
senviok-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 45.2 kB

Release files / senviok-0.1.0.tar.gz

Download URL senviok-0.1.0.tar.gz
Size 35.5 kB
Tags Source
SHA-256 checksum
How to use checksums
51b5844db9b205ed3e20336da7b33695cda717e5e39b8e17f5c11c6a15ba9f61
BLAKE2b-256 checksum
How to use checksums
4d48b95d830010abffc7edcb916f986408a118b3143fbd0903ccd55c76e65824
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / senviok-0.1.0-py3-none-any.whl

Download URL senviok-0.1.0-py3-none-any.whl
Size 9.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
181280f08cbc231e7c51b468ad4adfad2feb32bbab4fe44fb554552ba4dcabd9
BLAKE2b-256 checksum
How to use checksums
8380566698dc71654b4052496f7aa23a468845766786fde3b9c90f0ba617c56e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release 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