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
- Add the webhook, with your agent's ID as
target.id:webhooks/refund-requests.tsimport { 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" }], },}); - Save a matching delivery:
refund.json
{"action": {"type": "refund.requested"}, "order_id": "1042"} - Save one that doesn't:
shipped.json
{"action": {"type": "order.shipped"}, "order_id": "1043"} - Run the matching one. You should now see
ran agent "assistant":Shellnpx veryfront webhook run refund-requests --payload refund.json - Run the other. You should now see
was ignored: Webhook event did not match configured filter:Shellnpx veryfront webhook run refund-requests --payload shipped.json
Try it in a sandbox
Create a project
Add the webhook
Save a delivery that matches
Save one that doesn't
Run it with the delivery that matches
Check it