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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

senviok-0.1.0.tar.gz (35.5 kB view details)

Uploaded Source

Built Distribution

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

senviok-0.1.0-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file senviok-0.1.0.tar.gz.

File metadata

  • Download URL: senviok-0.1.0.tar.gz
  • Upload date:
  • Size: 35.5 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for senviok-0.1.0.tar.gz
Algorithm Hash digest
SHA256 51b5844db9b205ed3e20336da7b33695cda717e5e39b8e17f5c11c6a15ba9f61
MD5 78368bd53419cbddb9acb833fa625bcd
BLAKE2b-256 4d48b95d830010abffc7edcb916f986408a118b3143fbd0903ccd55c76e65824

See more details on using hashes here.

File details

Details for the file senviok-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: senviok-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for senviok-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 181280f08cbc231e7c51b468ad4adfad2feb32bbab4fe44fb554552ba4dcabd9
MD5 9f4a9b18d2a9f3541654d08d0d3dba3d
BLAKE2b-256 8380566698dc71654b4052496f7aa23a468845766786fde3b9c90f0ba617c56e

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page