Python SDK

Webhooks

Register an HTTP endpoint that axonpush POSTs to when matching events land, and inspect the delivery log.

A webhook endpoint is attached to one channel. When an event is published there and passes the endpoint’s event-type filter, the backend POSTs it to your URL and records the attempt.

Register an endpoint

from axonpush import AxonPush

with AxonPush() as client:
    endpoint = client.webhooks.create_endpoint(
        url="https://your-server.example/axonpush",
        channel_id=channel_id,
        event_types=["agent.error"],
        description="Page on agent errors",
    )

    print(endpoint.endpoint_id, endpoint.url, endpoint.active)

Every argument is keyword-only.

KeywordTypeRequiredWhat it does
urlstryesWhere axonpush POSTs.
channel_idstryesSource channel UUID.
event_typeslist[str]noOnly these types fire. Omit to receive every event on the channel.
descriptionstrnoFree-form note, shown in the dashboard.

The server always generates the signing secret; you cannot supply your own.

The signing secret is shown once

The create response, and only the create response, carries raw_secret. Store it at that moment; later reads expose only has_secret, never the value.

endpoint = client.webhooks.create_endpoint(url=..., channel_id=...)

if endpoint and endpoint.raw_secret:
    save_to_vault(endpoint.raw_secret)     # your only chance

The create response is a different shape from the endpoint records list_endpoints() returns, it is the only one with raw_secret on it. If you skip storing it, delete the endpoint and create a new one.

List and delete

for ep in client.webhooks.list_endpoints(channel_id):
    print(ep.endpoint_id, ep.url, ep.active, ep.event_types)

client.webhooks.delete_endpoint(endpoint_id)

list_endpoints takes the channel UUID; delete_endpoint takes the endpoint UUID. Endpoint records carry endpoint_id, url, channel_id, active, event_types, has_secret, created_at, and optionally org_id, description and updated_at.

Inspect deliveries

for d in client.webhooks.deliveries(endpoint_id):
    print(d.status, d.attempts, d.status_code, d.error)
FieldTypeMeaning
delivery_idstrThis attempt record.
endpoint_idstrEndpoint it was sent to.
event_idstrEvent that triggered it.
statusstrDelivery status, for example pending, success or failed.
attemptsintAttempts so far.
status_codeintHTTP status your server returned.
errorstrTransport or application error, when one occurred.
next_retry_atstrWhen the next retry is scheduled, if any.
created_atstrWhen the delivery was queued.

Optional fields are Unset rather than None when the server omitted them.

deliveries = client.webhooks.deliveries(endpoint_id) or []
failed = [d for d in deliveries if d.status == "failed"]

Return a 2xx to acknowledge. Anything else is retried on a backoff, and the attempts show up in this log.

Async

async with AsyncAxonPush() as client:
    endpoint = await client.webhooks.create_endpoint(
        url="https://your-server.example/axonpush",
        channel_id=channel_id,
        event_types=["agent.error"],
    )
    deliveries = await client.webhooks.deliveries(endpoint.endpoint_id)

The request axonpush sends

The delivery body and signature header are defined by the backend, not the SDK, see the webhook API reference for the exact contract your handler has to satisfy.