Hold risky first orders for review
An automation that puts a new customer's large first order on hold, tags it and notifies the managers, so nothing ships until a person releases it. A validated definition using a guarded action.
Put a new customer's large first order on hold the moment it is created, so nobody can fulfil, label or ship it until a person has looked. Trigger: order.created@1 with a filter. Actions: set_order_hold@1, add_order_tags@1, notify_me@1.
Model background: Automations. "Risky" here is your own rule: change the filter to what you consider risky.
The definition
{
"schemaVersion": 1,
"trigger": {
"type": "order.created@1",
"origins": [
"USER",
"API",
"MCP",
"ASSISTANT",
"BULK",
"IMPORT",
"DUPLICATE",
"SYSTEM",
"AUTOMATION"
],
"filter": {
"op": "all",
"rules": [
{
"path": "event.facts.customer.isFirstOrder",
"op": "eq",
"value": true
},
{
"path": "event.facts.order.total",
"op": "gte",
"value": 800
}
]
}
},
"steps": [
{
"id": "hold",
"type": "action",
"contract": "set_order_hold@1",
"input": {
"orderId": {
"$ref": "event.entityId"
},
"hold": true
}
},
{
"id": "tag",
"type": "action",
"contract": "add_order_tags@1",
"input": {
"orderId": {
"$ref": "event.entityId"
},
"tags": ["review-first-order"]
}
},
{
"id": "tell",
"type": "action",
"contract": "notify_me@1",
"input": {
"title": "Order {{order.number}} is on hold",
"message": "First order of a new customer, total {{order.total}} {{order.currency}}. Review it, then release the hold."
}
}
]
}Replace before saving: the number 800 (the order total, in the order's own currency, not converted) and the tag. Add or swap rules from the order facts (event.facts.order.shippingCountry, .paymentProvider, .discountCodes, .itemCount and others in the guide topic facts).
How it works
- The filter is the guard.
set_order_hold@1is refused withACTION_NEEDS_GUARDunless the trigger has a filter with at least one rule, or the action sits under aconditionstep. Delete the filter from this definition and the validator rejects it. set_order_hold@1is real. An order on hold cannot be fulfilled, labelled or shipped by anyone (the dashboard, the API, MCP, the assistant, the automatic label purchase) until it is released. Nothing is sent to the customer. There is no reason or note field, which is why the tag and the notice are there.- Use
order.created@1, notorder.paid@1. Only a PENDING or PROCESSING order can be held. Any other status, a paid status included, is skipped withORDER_NOT_HOLDABLE. Holding an order already on hold changes nothing. - A release returns the order to the status it had before the hold (PROCESSING if none is on record) and re-queues the automatic label purchase of a paid order.
event.facts.customer.isFirstOrderis empty for a guest order, so the rule does not match a guest. Drop that rule if guests should be held too.
What it does not do
- It does not decide risk. It has no fraud score, no address check and no card check: only the order facts you filter on.
- It does not release the hold. A person releases it from the order, or another automation runs
set_order_hold@1with"hold": false(also guarded). - It does not cancel or refund.
cancel_order@1refunds nothing and skips a paid order. - The approver must be allowed to update order status, because that is the permission the hold uses.
Create it
With the Admin MCP:
get_automation_guidewithtopic: "order-actions", then"facts".validate_automation_definition. Fix every finding.test_automationwithentity: { "type": "Order", "id": "<an order id>" }. The test is built from the order's current data. It shows whether the filter matches and "The order would be put on hold", and changes nothing. An order test also needs permission to view customers.create_automation_draftwithname: "Hold risky first orders".- Tell the merchant to approve it in the dashboard.
With the SDK:
const check = await admin.validateAutomationDefinition(storeId, { definition });
if (!check.ok) throw new Error(JSON.stringify(check.errors));
const draft = await admin.createAutomation(storeId, {
name: 'Hold risky first orders',
definition,
});What the merchant sees
A draft in Settings, then Automations. Once on, a matching order is held and tagged review-first-order, and the managers get a notice with the order number and total. The order stays held until a person releases it. An order that does not match the filter is left alone.
Flag a return nobody answered
An automation that waits 3 days after a return request and notifies the store's managers if it is still unanswered. A validated definition using a wait step and a live current.return value.
Win back lapsed customers
A weekly automation that finds customers who have not ordered for 90 days and tags and emails each one in a loop. A validated definition using fetch and for_each on the clock.