Automations
Use verified automation recipes
Select a workflow example for repeated work and verify it in a test organization.
These examples were verified with the workflow execution pipeline. Do not activate an example in production first. Test it with one synthetic record in a test organization.
Mark no-show reservations
Change confirmed reservations to no-show 30 minutes after their start.
workflow: { name: "No-show sweep", trigger: heartbeat }
steps:
- {
name: find,
feature: reservations.list,
query:
{
where: { status: { in: [confirmed] }, starts_at: { lt: "now-30m" } },
limit: 50,
},
}
- {
name: mark,
feature: reservations.update,
each: "${steps.find.rows}",
input: { id: "${item.id}", values: { status: no_show } },
}Cancel old pending reservations
Cancel pending reservations created over one hour ago.
workflow: { name: "Pending reservation expiry", trigger: heartbeat }
steps:
- {
name: find,
feature: reservations.list,
query:
{ where: { status: { in: [pending] }, created_at: { lt: "now-1h" } } },
}
- {
name: cancel,
feature: reservations.cancel,
each: "${steps.find.rows}",
input: { id: "${item.id}" },
}Close stale conversations
Close open conversations with no new message for two days.
workflow: { name: "Close stale conversations", trigger: heartbeat }
steps:
- {
name: idle,
feature: conversations.list,
query:
{
where: { status: { in: [open] }, last_message_at: { lt: "now-2d" } },
},
}
- {
name: close,
feature: conversations.update,
each: "${steps.idle.rows}",
input: { id: "${item.id}", values: { status: closed } },
}Activate customers after a completed reservation
Activate a customer who has a completed reservation and is not active.
workflow: { name: "Activate visiting customers", trigger: heartbeat }
steps:
- name: visited
feature: reservations.list
query:
where: { status: { in: [completed] } }
embed:
{
customer_id:
{ inner: true, where: { status: { in: [lead, qualified] } } },
}
- {
name: activate,
feature: customers.update,
each: "${steps.visited.rows}",
input: { id: "${item.customer_id}", values: { status: active } },
}Archive expired promotions
Archive active promotions after their end date at 03:00 each day.
workflow: { name: "Promotion expiry", trigger: cron, schedule: "0 3 * * *" }
steps:
- {
name: expired,
feature: promotions.list,
query: { where: { status: { in: [active] }, ends_at: { lt: now } } },
}
- {
name: archive,
feature: promotions.update,
each: "${steps.expired.rows}",
input: { id: "${item.id}", values: { status: archived } },
}Qualify a customer after a new reservation
Change the customer to qualified when a reservation is created.
workflow:
{
name: "First booking customer",
trigger: db,
source_table: reservations,
source_event: insert,
}
steps:
- {
name: promote,
feature: customers.update,
input: { id: "${trigger.customer_id}", values: { status: qualified } },
}Check the result
- Prepare one test row that matches the query.
- Confirm the expected row count before activation.
- Run once. Inspect the target row and run history.
- Run again. Confirm that the same row does not receive the action again.
- Deactivate the workflow before you correct an unexpected result.
Use Feature reference to check available features and inputs.