Loops

Send an event to a Loop

Changed on

Delivers an event to the Loop whose webhook this is. A Loop with a webhook wakes on each accepted event: the event opens a Session of its Reason, or continues the Session of earlier events with the same correlation key. The webhook URL and its key come back once, from the createReasonLoop (or updateReasonLoop) call that adds the webhook.

Authenticate with one of: the key as Authorization: Bearer <key>; an HMAC signature of the body keyed with the key, in X-Signature-256 for a sender you write, or the headers GitHub (X-Hub-Signature-256), Standard Webhooks and Svix, Linear, Sentry and Shopify send once the key is pasted in as their webhook secret; or a signature by a secret the sender generated (Stripe's Stripe-Signature, a Standard Webhooks whsec_ secret) stored as the Loop's signing_secret_name. Signatures that carry a timestamp are refused once it is over 5 minutes old.

A retry with the same event id is answered 202 with duplicate: true and is not queued again. A paused or deleted Loop refuses events (409 automation_disabled).

<sub>Auth: the Loop's webhook key (bearer, body signature, or URL segment) only; API keys are not accepted</sub>

post/webhooks/automations/{publicToken}

Request

  • Base URL
    https://api.reasonmachines.com
  • URL
    https://api.reasonmachines.com/webhooks/automations/{publicToken}
  • Auth
    • HTTP bearer
    • or API key in header X-Signature-256

Headers

X-Webhook-Correlation-Keystring

Events with the same key continue one Session; without it (or a key in the body) each event opens its own.

X-Webhook-Event-Idstring

The sender's id for the event; a retry with the same id is answered as a duplicate and queued once. Without one (or an id in the body), every POST is a new event.

X-Webhook-Event-Sourcestring

Which system sent the event, shown with it.

X-Signature-256string

For a sender you write: hex HMAC-SHA256 of the exact body bytes, keyed with the Loop's webhook key (or its signing secret), optionally prefixed sha256=. X-Signature is read the same way.

Request body

unknown required

Response

Accepted, or a duplicate of an event already accepted.

acceptedtrue required
duplicateboolean required

True when an event with the same id already arrived: this one is not queued again, and the earlier event's ids are returned.

event_idstring required

The stored event.

work_item_idstring nullable required

The unit of work its correlation key groups it into: one Session per work item.

Changes