Getting startedIntroduction to Workflow Functions

Introduction to Workflow Functions

Copy page

Run your own JavaScript or TypeScript for your Shopify store - from Shopify Flow, from your ERP over the API, or on a schedule.

Workflow Functions runs your own JavaScript or TypeScript for your Shopify store. A function runs three ways: as the Run Function step in Shopify Flow, when your ERP or another system calls it over the API, or on a schedule. Your code runs in a secure sandbox, can read and change store data you allow, can call other systems, and remembers data between runs.

Use it whenever Flow's built-in actions cannot do what you need: custom calculations, reshaping data, calling an external API, syncing stock and orders with an ERP, or an Admin API operation that would otherwise take a dozen Flow steps.

The Workflow Functions dashboard with the setup guide, runs, plan usage and success rate
The dashboard: a setup guide for your first function, then runs, plan usage and success rate for the period you pick.

What you can do with it

What your code looks like

Every function exports one default async function that receives (input, ctx):

export default async function (input, ctx) {
  ctx.log("running with", input)
  return { ok: true, received: input }
}
  • input is the JSON the function is called with: the Input field of the Flow action, the body of an API call, or the saved test variables for a scheduled run.
  • ctx.log(...) writes to the run's logs.
  • ctx.fetch(url, options) calls other systems over HTTPS.
  • ctx.shopify.graphql(query, variables) calls the Shopify Admin API, when the function has Needs Shopify data on.
  • ctx.storage keeps data between runs.
  • secrets.NAME reads a secret you saved on the Secrets page.

Whatever you return becomes the result: the action output in Flow, or the output of an API call.

The sandbox

  • A fresh sandbox for every run. Variables do not carry over; use ctx.storage for anything you want to keep.
  • No Node.js APIs. There is no require, process, file system or raw fetch. Network access goes through ctx.fetch only.
  • Limits per run. 5 seconds, 128 MB of memory and up to 20 outbound requests. Work in batches rather than one call per item.
  • Your access token never reaches your code. Shopify Admin calls go through our server with a short-lived token that is valid for that one run and only for the permissions you granted.

Around the app

Page What it is for
Dashboard Setup guide, runs, plan usage, top functions and recent failures
Functions Create, edit, test, duplicate and delete functions
Templates 85 verified templates, by category and by how they run
Permissions Grant or revoke the store data your functions may read and write
Secrets Encrypted values you read in code as secrets.NAME
Storage What your functions keep with ctx.storage, and files
History Every run with status, input, output, logs and errors
Developer API keys, the MCP server for AI agents, AI providers and GitHub
Help Support, documentation links and plans

Every page ends with a link to its guide here.

Plans

Plan Price Runs (rolling 30 days) Storage
Free $0 500 5 MB, 500 keys
Grow $35 / month 15,000 250 MB, 25,000 keys
Unlimited $100 / month Unlimited 1 GB, 100,000 keys

Every plan includes all features and unlimited functions. Runs from Flow and scheduled runs count toward the plan; test runs in the editor and runs through the API do not. Over your allowance, you can keep going with Extra runs (pay as you go).

Next steps