Skip to content

Integrate

Webhooks and automations

Use an incoming event to run a focused AI task, then handle the result in your application.

Use the event as the task

Your application receives a webhook from a shop, helpdesk or another service. Verify the sender and authorize the event, then call the NullProtocol run endpoint. The endpoint returns the result in the HTTP response.

StepWhat happens
ReceiveYour endpoint verifies the sender’s signature and extracts the event ID
RunYour backend calls NullProtocol with that ID and the task input
HandleYour application checks result.success and stores or delivers the output

Call from your event handler

Python 3.10 or newer, using httpx (included with the SDK). Call this function after your framework has verified the webhook signature. Keep the Space key in the server environment. The HTTP JSON field names stay unchanged.

event_handler.py
import os
import httpx


def summarize_event(event):
    # event["id"] must be a stable, unique source-event ID.
    response = httpx.post(
        "https://api.nullprotocol.ai/v1/agents/support/run",
        headers={
            "Authorization": "Bearer " + os.environ["NULLPROTOCOL_KEY"],
            "Idempotency-Key": event["id"],
        },
        json={
            "operation": "summarize",
            "content": event["message"],
            "maxLength": 300,
            "focus": "customer problem and requested resolution",
        },
        timeout=30.0,
    )
    response.raise_for_status()
    body = response.json()
    if not body["result"]["success"]:
        raise RuntimeError(body["result"]["error"])
    return body

Use an HTTP step in Make or n8n

Choose POST and copy the agent URL from Connect → HTTP API. Add Authorization, Content-Type and Idempotency-Key headers. Map the incoming text into the operation body. Branch on result.success, read the output and preserve operationId.

Keep the same ID and body for delivery retries. A stored refusal is replayed too; follow the HTTP retry rules before creating a new attempt after fixing a configuration error. If an event needs several distinct operations, assign stable IDs for each task, such as event-42-summary and event-42-classification.