Filter webhook deliveries

A filter decides which deliveries start a run. The others show in its events as Ignored, with no run.

Before you start

You need a webhook, or the agent to make one for. See Receive webhooks.

Run only on matching deliveries

  1. Add the webhook, with your agent's ID as target.id:
    webhooks/refund-requests.ts
    import { webhook } from "veryfront/webhook"; export default webhook({  id: "refund-requests",  name: "Refund requests",  target: { kind: "agent", id: "assistant" },  agentMessage: {    promptTemplate: "A customer asks for a refund on order {{payload.order_id}}.",  },  eventFilter: {    mode: "all",    conditions: [{ path: "action.type", operator: "equals", value: "refund.requested" }],  },});
  2. Save a matching delivery:
    refund.json
    {"action": {"type": "refund.requested"}, "order_id": "1042"}
  3. Save one that doesn't:
    shipped.json
    {"action": {"type": "order.shipped"}, "order_id": "1043"}
  4. Run the matching one. You should now see ran agent "assistant":
    Shell
    npx veryfront webhook run refund-requests --payload refund.json
  5. Run the other. You should now see was ignored: Webhook event did not match configured filter:
    Shell
    npx veryfront webhook run refund-requests --payload shipped.json

Try it in a sandbox

  1. Create a project

  2. Add the webhook

  3. Save a delivery that matches

  4. Save one that doesn't

  5. Run it with the delivery that matches

  6. Check it

Try it out

Next steps