Configuring a workflow in code
Write workflows in the code editor using export default async function(ctx), configure execution tiers, and test with sample input.
Prerequisites: Your First Integration. Basic JavaScript familiarity.
Opening the code editor
Go to Integrations → Workflows.
Click Create Workflow.
The workflow editor opens with three panels.
Screenshot: Full workflow editor showing all three panels — Configuration (left), Code (center), Test (right).
The three panels
The code editor consists of three panels which are as follows:
1. Configuration
Name
Workflow identifier (required). Example: "sync-contacts"
Description
What the workflow does. Shown in the workflows table.
Execution Tier
Instant (sync, max 60s), Standard (async, default), or Long (extended)
Execution Timeout
Max time before timeout. Slider: 1s–2min range for Instant tier.
Retry Policy
Toggle on/off. When on, failed executions retry automatically.
2. Code editor
The editor shows workflow.js with a default template:
Every workflow exports a default async function that receives ctx — the context object.
3. Test panel
Two tabs:
Test — run the workflow with sample input
Docs — reference documentation
The Test tab has:
CTX.INPUT — JSON input your workflow receives
CTX.HEADERS — optional HTTP headers
Run button — executes the workflow without saving
The ctx object
Your workflow receives a context object with:
input
The incoming data — request body from a webhook, event payload, or scheduler context
headers
HTTP headers from the incoming request (if triggered by webhook)
Writing a workflow
Example: Process incoming contacts
Example: Conditional logic
Testing
Click the Test tab in the right panel.
Enter sample JSON in CTX.INPUT:
Optionally add headers in CTX.HEADERS.
Click Run.
The output appears below — check the result matches your expectations.
Toggle between Test (sample data) and Real mode if available.
Screenshot: Test panel with sample input JSON and the output result after running.
Choosing an execution tier
Instant
Synchronous — caller waits for the result. Max 60 seconds. Returns result inline.
API endpoints that need a response, quick lookups, simple transforms
Standard
Asynchronous — returns immediately, executes in background.
Data syncs, multi-step processes, most workflows
Long
Extended async — for large data volumes and long-running processes.
Batch imports, full data backfills, large report generation
The Workflows table has filter tabs for All | Instant | Standard | Long so you can filter by tier.
Creating the workflow
Once your code works in testing:
Fill in Name and Description in the Configuration panel.
Select the appropriate Execution Tier.
Set Execution Timeout (default: 1 minute for Instant).
Toggle Retry Policy if you want automatic retries on failure.
Click Create Workflow (bottom of the Configuration panel).
The workflow appears in the Workflows table with status active.
Screenshot: Workflows table showing the newly created workflow with active status.
Editing an existing workflow
Go to Integrations → Workflows.
Click on the workflow name in the table.
The code editor opens with the existing code.
Make your changes, test them, then save.
What you've learned
The three-panel code editor layout (Configuration, Code, Test)
The
ctxobject structure (input,headers)How to write workflow logic in JavaScript
How to test with sample data before creating
How to choose the right execution tier
How to create and edit workflows
Last updated
Was this helpful?

