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

Node.js 18 or newer. Call this function after your framework has verified the webhook signature. Keep the Space key in the server environment.

event-handler.mjs
export async function summarizeEvent(event) {
  // event.id must be a stable, unique source-event ID.
  const response = await fetch(
    'https://api.nullprotocol.ai/v1/agents/support/run',
    {
      method: 'POST',
      headers: {
        Authorization: 'Bearer ' + process.env.NULLPROTOCOL_KEY,
        'Content-Type': 'application/json',
        'Idempotency-Key': event.id
      },
      body: JSON.stringify({
        operation: 'summarize',
        content: event.message,
        maxLength: 300,
        focus: 'customer problem and requested resolution'
      })
    }
  );
  const text = await response.text();
  if (!response.ok) {
    throw new Error('NullProtocol HTTP ' + response.status + ': ' + text);
  }
  const body = JSON.parse(text);
  if (!body.result.success) {
    throw new Error(body.result.errorCode + ': ' + 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.