Overview
JsWorkflows is a workflow automation platform for Shopify merchants. You write plain JavaScript — there is no visual drag-and-drop builder and no locked-in action library to constrain what you can call or how you structure your logic.
How it works
Section titled “How it works”Each workflow is a JavaScript class. You define one or more step methods on the class. JsWorkflows handles triggering, scheduling, execution, run tracking, and connections to external services.
class Workflow { async start(data, headers, api) { // your code runs here }
async nextStep(data, headers, api) { // scheduled steps run here }}Every step method receives three arguments:
| Argument | Description |
|---|---|
data | The trigger payload — order, customer, HTTP body, scheduled metadata, etc. |
headers | The HTTP headers from the trigger request |
api | The JsWorkflows API — fetch, scheduling, state, OAuth, secrets, logging |
Key concepts
Section titled “Key concepts”| Concept | Description |
|---|---|
| Workflow | A JavaScript class. One file per workflow. |
| Step | A method on the class. The entry point is always start. |
| Trigger | What starts a run — Shopify webhook, HTTP request, schedule, or manual test |
| Run | One full execution of a workflow from trigger to completion |
| Handle | The unique identifier you give an OAuth connection, used in api.getOAuthToken() |
| Credit | The unit of billing — one credit per step that executes |
Execution model
Section titled “Execution model”- The
startmethod is always the entry point, regardless of trigger type. - To run additional logic later, call
api.scheduleNextStep()— this schedules another step method to run after a delay. - Multiple
scheduleNextStep()calls in one step create parallel branches (fan-out). - Each branch executes independently. A run is only marked complete when all branches have finished.
- Steps that use
api.waitForEvent()pause the run until an external signal resumes it.
Workflow lifecycle hooks
Section titled “Workflow lifecycle hooks”Two optional methods can be defined on the Workflow class:
class Workflow { async start(data, headers, api) { ... }
async onWorkflowComplete(api) { // Called when the entire run (all branches) finishes successfully }
async onWorkflowError(err, api) { // Called when a step throws an uncaught error }}Both hooks receive a restricted api: getOAuthToken, google, slack, log, dedupe, and runStore are available. scheduleNextStep, waitForEvent, and csv are not.
Plans and limits
Section titled “Plans and limits”Each plan sets a maximum number of active workflows and monthly credits. See Credits & Plans for details.