Skip to content

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.

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:

ArgumentDescription
dataThe trigger payload — order, customer, HTTP body, scheduled metadata, etc.
headersThe HTTP headers from the trigger request
apiThe JsWorkflows API — fetch, scheduling, state, OAuth, secrets, logging
ConceptDescription
WorkflowA JavaScript class. One file per workflow.
StepA method on the class. The entry point is always start.
TriggerWhat starts a run — Shopify webhook, HTTP request, schedule, or manual test
RunOne full execution of a workflow from trigger to completion
HandleThe unique identifier you give an OAuth connection, used in api.getOAuthToken()
CreditThe unit of billing — one credit per step that executes
  • The start method 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.

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.

Each plan sets a maximum number of active workflows and monthly credits. See Credits & Plans for details.