Skip to main content

notavia

Official Python SDK for Notavia — send transactional email and manage templates.

Features: ✓ Notifications API ✓ Templates API ✓ Inbox API ✓ Preferences API ✓ Webhooks ✓ SMS ✓ Chat channels (Slack / Teams / Discord) ✓ Workflows API

Install

pip install notavia

Send your first notification

from notifyservice import NotifyClient
from notifyservice_api.models.send_notification_request import SendNotificationRequest
from notifyservice_api.models.recipient import Recipient

client = NotifyClient(
    base_url="https://api.notavia.saas-infrastructure.com",
    api_key="ns_live_...",
)

notification = client.notifications.send_notification(
    SendNotificationRequest(
        channel="email",
        recipient=Recipient(address="alice@example.com", name="Alice"),
        subject="Welcome",
        html_body="<h1>Hello!</h1>",
    )
)
print(notification.id)

Idempotency

Pass idempotency_key to guarantee at-most-once delivery. Repeat requests with the same key within 24 hours return the original response without re-sending:

notification = client.notifications.send_notification(request, idempotency_key=f"signup-{user_id}")

Templates

Create a stored template, then reference it by key at send time:

from notifyservice_api.models.create_template_request import CreateTemplateRequest
from notifyservice_api.models.render_template_request import RenderTemplateRequest

client.templates.create_template(
    CreateTemplateRequest(
        key="welcome",
        name="Welcome email",
        subject_template="Welcome, {{name}}!",
        html_body_template="<h1>Hello, {{name}}.</h1>",
    )
)

# Preview a template with data before sending
rendered = client.templates.render_template(
    "welcome",
    RenderTemplateRequest(data={"name": "Alice"}),
)
print(rendered.subject)   # "Welcome, Alice!"
print(rendered.html_body) # "<h1>Hello, Alice.</h1>"

# Send using the stored template
client.notifications.send_notification(
    SendNotificationRequest(
        channel="email",
        recipient=Recipient(address="alice@example.com"),
        template_key="welcome",
        template_data={"name": "Alice"},
    )
)

SMS

client.notifications.send_notification(
    SendNotificationRequest(
        channel="sms",
        recipient=Recipient(external_user_id="usr_1"),
        template_key="order_shipped_sms",
        template_data={"order_id": "ord_99"},
    )
)

Chat channels

Slack (DM by user id)

client.notifications.send_notification(
    SendNotificationRequest(
        channel="slack",
        recipient=Recipient(external_user_id="usr_1", slack_user_id="U07XYZ123"),
        template_key="invoice_paid_slack",
        template_data={"invoice_id": "inv_42"},
    )
)

To post to a Slack channel instead of a user DM, use slack_channel_id:

recipient=Recipient(external_user_id="usr_1", slack_channel_id="C07XYZ123")

Microsoft Teams

Teams requires an endpoint registered first via POST /v1/teams-endpoints. Use the returned UUID:

client.notifications.send_notification(
    SendNotificationRequest(
        channel="teams",
        recipient=Recipient(external_user_id="team_alerts", teams_endpoint_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"),
        template_key="incident_alert_teams",
    )
)

Discord

Discord requires an endpoint registered first via POST /v1/discord-endpoints. Use the returned UUID:

client.notifications.send_notification(
    SendNotificationRequest(
        channel="discord",
        recipient=Recipient(external_user_id="team_alerts", discord_endpoint_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"),
        template_key="incident_alert_discord",
    )
)

Webhook signature verification

Verify incoming webhook payloads using your signing secret (prefixed whsec_):

from notifyservice import verify_signature

is_valid = verify_signature(
    raw_body=request.body,
    signature_header=request.headers["NotifyService-Signature"],
    signing_secret="whsec_...",
)
if not is_valid:
    raise ValueError("Invalid webhook signature")

Delegated tokens (inbox & preferences)

Mint short-lived JWTs so your frontend can access the inbox or preferences widgets directly without exposing your API key:

from notifyservice import mint_inbox_token, mint_prefs_token, mint_inbox_and_prefs_token

# Inbox only
token = mint_inbox_token(
    organization_id="org_123",
    external_user_id="usr_456",
    signing_key="nsi_...",          # must start with nsi_
    ttl_seconds=900,                # default 15 min, min 60, max 86400
)

# Preferences only
token = mint_prefs_token("org_123", "usr_456", "nsi_...")

# Both scopes in one token
token = mint_inbox_and_prefs_token("org_123", "usr_456", "nsi_...")

Decode a token to inspect its claims:

from notifyservice import decode

payload = decode(token)
print(payload.iss, payload.sub, payload.scope, payload.exp)

Error handling

The generated API layer raises notifyservice_api.exceptions.ApiException on non-2xx responses. The .status attribute holds the HTTP status code and .body holds the raw response body (a JSON string with code, message, and param fields):

import json
from notifyservice_api.exceptions import ApiException

try:
    client.notifications.send_notification(request)
except ApiException as exc:
    if exc.status == 400:
        error = json.loads(exc.body)
        print(f"{error['code']}: {error['message']} (param: {error.get('param')})")
    elif exc.status == 429:
        # rate-limited — the SDK already retried up to 3 times
        raise
    else:
        raise

Retries

The SDK retries up to 3 times on transient failures (429, 502, 503, 504) with exponential backoff and Retry-After support. Adjust at construction time:

client = NotifyClient(base_url="...", api_key="...", max_retries=5)

Disable retries entirely:

client = NotifyClient(base_url="...", api_key="...", max_retries=0)

Compatibility

  • Python 3.9+
  • Dependencies: pydantic, urllib3

License

MIT.

Release files for notavia 1.0.1

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

Source distribution (sdist)

Source distribution for notavia 1.0.1
File Size Uploaded
notavia-1.0.1.tar.gz 96.9 kB Details

Built distribution (wheel)

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

Total release size: 425.0 kB

Release files / notavia-1.0.1.tar.gz

Download URL notavia-1.0.1.tar.gz
Size 96.9 kB
Tags Source
SHA-256 checksum
How to use checksums
631d3d69a682866d0686daa7188a117872de3904e53901738204a7f5159dd85c
BLAKE2b-256 checksum
How to use checksums
16cfebba76101c98c9eb8f1f1792c188bf01a0cf6fac9b31aed0e78253ebf773
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 14, 2026.

Transparency log

Release files / notavia-1.0.1-py3-none-any.whl

Download URL notavia-1.0.1-py3-none-any.whl
Size 328.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1b6cd582fdba02033f3287b5213b27ddf11ccbadef724a4b00c834bc0df84cef
BLAKE2b-256 checksum
How to use checksums
52780c41793466b3cfda0754890e84437250f06aabaf2b894688398dffff052f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 14, 2026.

Transparency log

Release history Release notifications | RSS feed

1.0.2

2 release files

This release

1.0.1 This release

2 release files

1.0.0

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