Loom Flow triggers
Loom Flow is Weftstore's workflow app: when something happens in a store, it checks conditions and takes actions. Your app can add its own triggers, so merchants can build workflows on your app's events, like a review left, a loyalty tier reached or a parcel scanned.
How it works#
- 1Declare the triggerGive it a handle, a title merchants read in the trigger list, a description and the fields your events carry. Declare it once (when the app is installed, say); declaring again replaces it.
- 2The merchant builds a workflow on itIn Loom Flow, your trigger is listed under Apps with your app's name. Its fields show up in the variable picker and the condition builder, with your examples.
- 3Fire it when the event happensPost the event's payload. Every workflow that's turned on and starts from your trigger gets a run, which the merchant can follow step by step in the run history.
Both calls need the write_flow scope, with an Admin API token of a custom app or an app installed from the App Store (see Authentication and scopes). Each app has its own triggers: two apps can use the same handle without clashing. Loom Flow must be installed in the store for runs to start; firing a trigger while it isn't (or while no workflow uses the trigger) is not an error, it just starts no runs.
Declare a trigger#
/flow/triggers/{handle}.jsonhandle: 2 to 60 lowercase letters, numbers, hyphens and underscores, starting with a letter or number. The body is the trigger: a title (up to 80 characters), an optional description (up to 300) and its fields. Answers 201 for a new trigger and 200 when it replaced one. An app can declare up to 25 triggers, each with up to 40 fields at each level.
curl -X PUT "https://store.weftgrid.com/api/admin/2026-10/flow/triggers/review-received.json" \
-H "X-Storeloom-Access-Token: $STORELOOM_TOKEN" \
-H "Content-Type: application/json" \
-d '{"trigger":{"title":"Review received","description":"A customer left a review on a product.","fields":[{"key":"rating","label":"Rating","type":"number","example":5},{"key":"title","label":"Title","type":"string","example":"Lovely linen"},{"key":"verified_buyer","label":"Verified buyer","type":"boolean","example":true},{"key":"product","label":"Product","type":"object","fields":[{"key":"id","label":"Product ID","type":"string","example":"cm2prod0001"},{"key":"title","label":"Title","type":"string","example":"Linen shirt"}]},{"key":"customer_email","label":"Customer email","type":"string","example":"[email protected]"}]}}'{
"trigger": {
"handle": "review-received",
"type": "custom:cm2app0001:review-received",
"title": "Review received",
"description": "A customer left a review on a product.",
"updated_at": "2026-10-31T09:12:00.000Z",
"fields": [
{"key": "rating", "label": "Rating", "type": "number", "example": 5},
{"key": "title", "label": "Title", "type": "string", "example": "Lovely linen"},
{"key": "verified_buyer", "label": "Verified buyer", "type": "boolean", "example": true},
{"key": "product", "label": "Product", "type": "object", "fields": [{"key": "id", "label": "Product ID", "type": "string", "example": "cm2prod0001"},{"key": "title", "label": "Title", "type": "string", "example": "Linen shirt"}]},
{"key": "customer_email", "label": "Customer email", "type": "string", "example": "[email protected]"}
]
}
}Fields#
Each field has a key (a lowercase letter, then lowercase letters, numbers and underscores), a label, a type and optionally a description and an example. Examples are what a merchant's test run uses, so make them realistic.
| Type | What it holds |
|---|---|
string | Text. Conditions offer equals, contains, starts with… |
number | A number (or numeric text like "12.50"). |
money | An amount as a decimal string, like the Admin API's prices. |
boolean | true or false. |
date | An ISO 8601 date and time. |
tags | Comma-separated text or a list of strings. |
object | Nested fields: give them in fields. |
list | A list of items; fields describe one item. Workflows can loop over it with For each. |
Fire a trigger#
/flow/triggers/{handle}/fire.jsonThe body's payload is a JSON object of up to 64 KB, ideally matching the fields you declared. An optional event_id (your own id for the event) groups the runs it starts, so a retry is easy to tell apart in the run history. Answers 202 with how many runs were queued, and whether Loom Flow is installed in the store. Runs start in the background within seconds; the call doesn't wait for them. Firing a trigger you haven't declared answers 422.
curl -X POST "https://store.weftgrid.com/api/admin/2026-10/flow/triggers/review-received/fire.json" \
-H "X-Storeloom-Access-Token: $STORELOOM_TOKEN" \
-H "Content-Type: application/json" \
-d '{"event_id":"review-55120","payload":{"rating":2,"title":"Arrived torn","verified_buyer":true,"product":{"id":"cm2prod0001","title":"Linen shirt"},"customer_email":"[email protected]"}}'{
"runs_queued": 2,
"loom_flow_installed": true
}What the workflow gets#
A run's data is your payload under payload, and your app under app. Merchants use it in conditions and in Liquid, for example {{ payload.product.title }} or {{ payload.rating }}, alongside shop.
{
"payload": {
"rating": 2,
"title": "Arrived torn",
"verified_buyer": true,
"product": {
"id": "cm2prod0001",
"title": "Linen shirt"
},
"customer_email": "[email protected]"
},
"app": {
"id": "cm2app0001",
"name": "Product Reviews"
}
}Listing and deleting triggers#
GET /flow/triggers.json lists the triggers your app has declared in the store, and DELETE /flow/triggers/{handle}.json removes one: workflows that start from it stay, but don't start again until it's declared again. An app only ever sees and changes its own triggers. Every endpoint is in the Loom Flow reference.
Errors#
| Status | When |
|---|---|
401 | The token is missing or wrong. |
403 | The app doesn't have write_flow. |
422 | The handle, a field or the payload isn't valid, the app already has 25 triggers, or the trigger hasn't been declared. The body's errors says which. |
429 | Too many requests: see rate limits. |
Limits workflows run under#
- A run takes at most 500 steps, loops included. A Get data step returns, and a For each goes through, at most 100 items.
- A Wait step waits at most 90 days. A step that fails for a passing reason (a server that didn't answer) is tried again up to 5 times before the run fails.
- Changes a workflow makes can start other workflows, at most 3 levels deep, and a workflow never starts itself. Firing your trigger from a webhook that a workflow's change caused counts as a new chain.
- Runs are kept for 30 days, failed runs for 60. Merchants see every run and what each step saw and did under Loom Flow → Run history.