Skip to main content

notificme

Official Python SDK for notific.me. It sends events, keeps live cards up to date, asks people for decisions and waits for the answer, and verifies the signed webhooks the server sends you.

  • Python 3.10+, sync (NotificMe) and async (AsyncNotificMe) clients.
  • Built on httpx; webhook signatures use cryptography (Ed25519).
  • Retries 429, 5xx and network errors (honouring Retry-After), with a timeout on every request.
  • Fully typed (py.typed).

Installation

pip install notificme

Quick start

Create a service token in the customer area. It needs the events:write, asks:write and asks:read scopes. Keep the token on your server.

from notificme import NotificMe

notific = NotificMe(token="nm_svc_...", source="billing")  # or set NOTIFICME_TOKEN

notific.send("invoice.failed", severity="high", summary="Invoice #42 failed")
Argument Default
token NOTIFICME_TOKEN env var Service token (nm_svc_…).
base_url NOTIFICME_URL or https://api.notific.me API address.
source none Default source of your events.
timeout 30.0 Per-request timeout (seconds).
max_retries 3 Retries on 429, 5xx and network errors.
retry_base_delay / retry_max_delay 0.5 / 10.0 Exponential backoff with jitter (seconds).
http_client new httpx.Client Your own client (proxies, mounts, tests).

Use the client as a context manager (with NotificMe(...) as notific:) or call close() to release connections.

Sending events

notific.send(
    "container.die",  # dotted lowercase type
    severity="high",  # info | low | medium | high | critical (default: info)
    summary="api-v2 died on vps-01",
    dedup_key="vps-01/api-v2",  # merges repeats in the dedup window
    expires_when="container.healthy",
    payload={"host": "vps-01", "exit_code": 137},  # sent as is
    card={
        "title": "Container died",
        "blocks": [
            {"type": "metric", "label": "Crashes in 24h", "value": 3},
            {
                "type": "buttons",
                "buttons": [{"label": "Open dashboard", "url": "https://dokploy.example.com"}],
            },
        ],
    },
)

Cards and questions use the protocol's snake_case, exactly as in protocol/schemas. Every event gets an idempotency id, so a retried request is not stored twice. You can also pass your own id.

Live cards

deploy = notific.send(
    "deploy.progress",
    summary="Deploying api",
    live=True,  # the SDK creates a card_id; you can also pass your own card_id
    card={"blocks": [{"type": "progress", "value": 0.1}]},
)

notific.update(deploy.card_id, card={"blocks": [{"type": "progress", "value": 0.8}]})

update() takes type, source, severity and summary from the last event this client sent for that card. You can override any of them.

Asking humans

result = notific.ask(
    "Deploy api to production?",
    [
        {
            "id": "action",
            "type": "single",
            "text": "What should we do?",
            "options": ["Deploy", "Wait"],
            "allow_other": True,
        },
        {"id": "note", "type": "text", "text": "Anything else?", "optional": True},
    ],
    to="ops",
    timeout="30m",
    on_timeout={"action": "Wait"},
)

if result.status == "answered" and result.answers["action"] == "Deploy":
    ...

print(result.as_text)  # natural-language summary, ready for an AI agent

ask() long-polls until the reply arrives or the question set times out (result.status == "timeout", with on_timeout applied). It raises AskClosedError when the question set expires or is cancelled. Pass max_wait= (seconds) to stop waiting earlier: it raises AskPendingError, and you can resume with notific.wait_for_reply(err.ask_id).

Answers are converted per question type: yesno → bool, single → str, multi → list[str], number → number, date → str, voice → VoiceAnswer, text → UntrustedText.

To create the question set without waiting, use create_ask() (returns a handle with .wait()), or set callback_url= and receive the reply on a webhook.

Untrusted text

Anything a human typed comes back as UntrustedText. Never feed it to a shell, SQL, eval, HTML or an LLM prompt as instructions. Read it on purpose with .text, or embed it as a quoted JSON string with .quoted().

Async

from notificme import AsyncNotificMe

async with AsyncNotificMe(source="agent") as notific:
    await notific.send("agent.started", summary="Agent started")
    result = await notific.ask("Run the migration?", [{"id": "ok", "type": "yesno", "text": "Go?"}])

Verifying webhooks

Every webhook carries a Notificme-Signature header signed with Ed25519. Always verify the raw body.

# FastAPI
from fastapi import FastAPI, Request
from notificme import NotificMe, WebhookVerificationError

app = FastAPI()
notific = NotificMe(source="billing")


@app.post("/notificme")
async def hook(request: Request):
    body = await request.body()
    try:
        webhook = notific.receive_webhook(body, request.headers)
    except WebhookVerificationError:
        return {"ok": False}, 400
    if webhook.reply:
        print(webhook.reply.answers)
    return {"ok": True}
# Flask
from flask import Flask, request
from notificme import NotificMe

app = Flask(__name__)
notific = NotificMe(source="billing")


@app.post("/notificme")
def hook():
    webhook = notific.receive_webhook(request.get_data(), request.headers)
    return {"ok": True}

Without a client, pass the key explicitly: receive_webhook(body, headers, "https://api.notific.me/.well-known/notificme-keys.json"). The key can also be the base64url public key, raw bytes, a JWK or a JWKS. Keys fetched from a URL are cached for 10 minutes and refreshed when an unknown kid shows up.

Use webhook.id (Notificme-Webhook-Id) to deduplicate: it is the same on every retry.

Errors

Error When
NotificMeApiError The API answered with a non-2xx status (status, code, details, request_id).
AskClosedError The question set expired or was cancelled.
AskPendingError max_wait elapsed while the question set is still open.
WebhookVerificationError Bad or missing signature (reason).
NotificMeError Base class; client-side failures such as timeout and network_error.

License

Apache 2.0.

Metadata

Release files for notificme 0.1.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 notificme 0.1.1
File Size Uploaded Provenance Actions
notificme-0.1.1.tar.gz 28.7 kB With provenance Details for notificme-0.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 57.5 kB

Release files / notificme-0.1.1.tar.gz

Download URL notificme-0.1.1.tar.gz
Size 28.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c529ab139f59aff16fe55c4e15044c39e53c817c88f63a456ae2ceac5d393209
BLAKE2b-256 checksum
How to use checksums
bf2cc932000243344d6b061d73e8237c9675baebf85a5b37695a659dcfdcf84b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 6, 2026.

Transparency log

Release files / notificme-0.1.1-py3-none-any.whl

Download URL notificme-0.1.1-py3-none-any.whl
Size 28.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bbb913d103993f0619651ecac9a4c3be34fde2dcd6a94e51b25c42f963037927
BLAKE2b-256 checksum
How to use checksums
dc541bddb2c976e69049764ef259dce1cdc28c5d544dbc11b9f4edf79adc081f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 6, 2026.

Transparency log

Security for notificme 0.1.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for notificme-0.1.1.tar.gz

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 Nov 6, 2026.

Transparency log

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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