powered by

Build your first workflow

In about ten minutes, build a workflow that flags every order over £100 for review the moment it's created, and check it worked.

You'll build a workflow that watches for new orders and creates a review task for any order of £100 or more. Along the way you'll use an event trigger, a trigger filter, a Create data step and a template, then test the result and read its job.

Before you start

You need a project and two entities:

Entity Fields
orders customer_email (text), total (decimal), status (text)
order_reviews order_id (integer), note (text)

If you haven't created entities before, see Data modelling.

1. Create the workflow

  1. Go to Workflows and select New Workflow.
  2. Name it Flag large orders and select Create Workflow.

The editor opens with a Start node on the canvas.

2. Add the trigger and its filter

  1. Select Workflow Settings.
  2. Add a trigger with type Event, event EntityCreated and entity orders.
  3. Add a filter condition: field total, operator gte, value 100.
  4. Save the settings.

The filter is checked before a job is created, so orders under £100 won't start the workflow at all.

3. Add the step

  1. Select Add Step and choose Create data.
  2. Set the key to create_review and the entity to order_reviews.
  3. Set the payload:
json
{
  "order_id": "{{ $anythink.trigger.id }}",
  "note": "Order from {{ $anythink.trigger.data.customer_email }} for £{{ $anythink.trigger.data.total }} needs review"
}
  1. Connect the Start node to the step to make it the start step.
  2. Select Save Workflow, then enable the workflow.

{{ $anythink.trigger.id }} is the whole value of order_id, so it's written as a number. The note mixes text and templates, so it's written as text.

4. Check it works

Create an order that should be flagged, and one that shouldn't:

bash
curl -X POST "https://api.my.anythink.cloud/org/$ORG_ID/entities/orders/items" \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{"customer_email":"sam@example.com","total":149.50,"status":"new"}'

curl -X POST "https://api.my.anythink.cloud/org/$ORG_ID/entities/orders/items" \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{"customer_email":"ali@example.com","total":24.00,"status":"new"}'

Then check:

  1. In the workflow, select View Job History. There's one job, for the £149.50 order, with status Success.
  2. Open the job. The create_review step's data shows the review it created.
  3. Open the order_reviews entity. There's one review: "Order from sam@example.com for £149.5 needs review".

The £24 order didn't match the filter, so it left no job.

What you built

Part What it did
Event trigger Started a job whenever an order was created
Trigger filter Skipped orders under £100 before any job was created
Create data Wrote a review, using the order's id and fields from the trigger data

Take it further

  • Notify someone. Add a Send an email step after create_review to email your support inbox, or an Integration step to post to Slack. See Step types.
  • Only flag paid orders. Change the event to EntityUpdated and add a filter condition status changed_to paid. See Triggers and scheduling.
  • Summarise with AI. Add an Integration step using Claude to summarise the customer's order history into the review note. See Workflow recipes.

Next steps

How workflows work Monitoring and testing