Workflows: Authoring process
Authoring process
Section titled “Authoring process”Start with the business outcome, not the element list.
- Name the outcome:
CreateProjectTask,SendDocumentReminder,ExportReport,ProjectAccessPolicy. - Choose the trigger: button, field change, create/update/delete event, cron, policy, or another workflow.
- List the inputs: current resource, modal fields, request data, selected rows, current user, or schedule payload.
- List the outputs: saved resources, response data, client field updates, files, notifications, or policy constraints.
- Sketch the graph: load, branch, create, set, save, respond.
- Decide sync vs async. UI responses stay sync; long-running jobs become async.
- Add tests for the externally visible behavior.
Pattern: create and save
Section titled “Pattern: create and save”Use source/new, op/set, and action/save when a workflow creates a resource from the current context.
{ "identifier": "CreateProjectTask", "title": "Create project task", "async": false, "entry": "createProjectTask", "elements": [ { "name": "createProjectTask", "type": "event/webhook", "options": { "module": "projects", "refresh_prototype": true }, "set": { "project": "default:", "data": "input:" }, "to": { "default": { "newTask": ["default"] } } }, { "name": "newTask", "type": "source/new", "options": { "module": "tasks" }, "to": { "default": { "setTaskFields": ["default"] } } }, { "name": "setTaskFields", "type": "op/set", "options": { "recipes": { "title": "$data.title", "project": "$project", "status": "\"open\"" } }, "to": { "default": { "saveTask": ["default"] } } }, { "name": "saveTask", "type": "action/save" } ], "events": [ { "identifier": "createProjectTask", "type": "webhook", "module": "projects" } ]}Keep the first version this small. Add branching, notifications, and follow-up work only when the core create path is stable.
Pattern: modal, confirm, save, notify
Section titled “Pattern: modal, confirm, save, notify”Use a modal when the workflow needs additional user input before changing data.
{ "name": "openTaskModal", "type": "action/modal", "options": { "type": "confirm", "layout": "tasks.modal", "checkpoint": true, "autosave_key": "task_create" }, "set": { "taskData": "confirm:" }, "to": { "confirm": { "newTask": ["default"] } }}Follow the modal with source/new, op/set, action/save, and action/notify. Use neutral notification text that describes the result:
{ "name": "notifyTaskCreated", "type": "action/notify", "options": { "toast": { "type": "success", "message": "Task created", "description": "The task was added to the project." } }}Pattern: load, transform, response
Section titled “Pattern: load, transform, response”Dashboard widgets, option loaders, and lightweight API-style calls often load records, transform them with recipes, and return a response.
{ "name": "buildSummary", "type": "op/recipe", "options": { "recipe": "{\"open_tasks\": count($tasks), \"project\": $project.name}" }, "set": { "summary": "default:" }, "to": { "default": { "sendSummary": ["default"] } }}{ "name": "sendSummary", "type": "action/response", "in": { "default": "$summary" }}Keep these workflows synchronous because the browser is waiting for the response.
Pattern: async job with progress
Section titled “Pattern: async job with progress”Long work should not run inside the browser request. A common pattern is:
- A sync webhook validates the request.
action/runstarts an async workflow.- The async workflow reports status with
cast/progress. - The workflow saves the result and sends a final notification.
{ "identifier": "PublishProject", "title": "Publish project", "async": true, "entry": "publishProject", "elements": [ { "name": "publishProject", "type": "event/webhook", "options": { "module": "projects" }, "set": { "project": "default:" }, "to": { "default": { "showProgress": ["default"] } } }, { "name": "showProgress", "type": "cast/progress", "options": { "title": "Publishing project", "total": 3, "progress": 1, "send_to_user": true } } ]}For details, see Async Progress and Jobs and Cast.