Channels

Get decisions by webhook

Send signed events to your own systems when requests are created, decided, expire or are cancelled.

About 5 minutes

Transcript (30 seconds)

Webhooks send every decision to your systems.

Add an endpoint and store its signing secret.

Verify the signature on each delivery.

Failed deliveries retry for a day, and you can replay any of them.

Resume workflows the moment someone decides.

Before you start

Steps

  1. Add an endpoint

    Under Webhooks, enter your URL and pick events. The signing secret is shown once; store it as a secret.

  2. Verify the signature

    Each delivery has a promptcompute-signature header: t=<unix>,v1=<HMAC-SHA256 of t.body>. The SDKs check it and reject old timestamps.

    import { constructEvent } from "@promptcompute/sdk/webhooks";
    
    const event = await constructEvent(rawBody, req.headers["promptcompute-signature"], process.env.PC_WEBHOOK_SECRET!);
    if (event.type === "approval.decided") {
      // event.data.final_args is what may run
    }
  3. Send a test event

    Press Send test event. The delivery log shows the status code your endpoint returned.

  4. Handle retries

    Failed deliveries retry with backoff for 24 hours. Make your handler idempotent on the event id. Replay any delivery from the log.

Use cases

Resume a workflow

The situation
A Temporal or Inngest workflow waits for a decision.
What to do
Point a webhook at a handler that signals the workflow on approval.decided.
What happens
The workflow resumes the moment someone decides.

Mirror into your ticket system

The situation
Your team tracks risky changes in tickets.
What to do
Create or update a ticket on approval.created and approval.decided.
What happens
Every request has a ticket with the decision and who made it.

What you will see

Your endpoint receives signed events, and the delivery log shows each attempt.

It worked when

Example output: approval.decided payload

{
  "id": "evt_01j...",
  "type": "approval.decided",
  "created": 1793349840,
  "data": { "id": "apr_01j...", "status": "approved", "final_args": { "amount": 80 } }
}

If something goes wrong

Signature check fails
Verify the raw body, not parsed JSON, and use the secret for this endpoint. Rotating keeps the old secret valid for a while.
The URL is refused
Endpoints must be https and public. Private and local addresses are blocked.
Duplicate events
Retries resend the same event id. Skip ids you already handled.