Create a function
In the dashboard, organization Owners, Admins, and Partners can create, edit, run, pause, clear history, or delete Scheduled Functions.1
Choose a starting point
Open Developers → Scheduled Functions and select New job. Start blank or choose Re-score stale leads, Tag inactive, or Round-robin unassigned.
2
Set the schedule
Enter a name, choose a frequency, confirm the timezone, and continue. You can edit the cron expression and timezone later.
3
Define the lookup scope
Select the leads, AI agents, and hosts that the code needs. Narrow the lead query and set the maximum number of leads loaded per run.
4
Write and save the code
Implement
onSchedule(ctx), add environment variables for secrets, and save to deploy the current code and schedule.5
Preview, run, and monitor
Preview the cohort, run with a controlled input, and inspect the output. Leave the function active only after the result, logs, requests, and effects match your intent.
Configure the schedule
The editor provides presets for every 5 minutes, every 15 minutes, hourly, every 4 hours, and daily execution. Select Custom to enter a five-field cron expression. The timezone controls when calendar-based expressions run. For example,0 9 * * * means 09:00 in the function’s selected timezone, not necessarily the browser’s timezone. The schedule preview asks the server to calculate the next occurrences so you can verify both values together.
Select the lookup scope
Nexor resolves the lookup scope immediately before each tick. The function receives data from the same organization only. The lead lookup can filter by:- active, historic, or all leads;
- Agent and stage;
- campaign;
- assigned user or unassigned leads;
- name, email, or phone search;
- a moving created-at window in hours or days; and
- sort order and a per-run lead limit.
ctx.leads during a run.
AI agents and human hosts are optional lookup groups. Include them only when the code reads ctx.agents or ctx.hosts; otherwise those arrays are empty.
Read the run context
Every scheduled tick receives actx object with this structure:
The runtime also provides
env, axios, fetch, console, and helpers. helpers.uuid() creates a UUID, helpers.now() returns the current timestamp, and helpers.daysAgo(n) returns a timestamp relative to the run.
Write controlled effects
Effects are buffered while the JavaScript runs. Nexor applies them after a successful execution and scopes every mutation to the organization that owns the function.
If the function throws or times out, its buffered effects are not applied. Calls already made with
axios or fetch cannot be rolled back, so make external writes idempotent.
Use environment variables
Cloud Functions and Scheduled Functions use the same organization-level environment variables. Read a value asenv.NAME, and never place a token directly in the function source.
The dashboard masks stored values after save; the list shows the name, not the value. Creating, replacing, or deleting one redeploys all saved Cloud Functions and all active Scheduled Functions so their bindings stay current.
Run and inspect safely
Save and deploy pending edits before selecting Run. The run dialog offers two inputs:- Live cohort resolves the saved lookup immediately before execution.
- Custom ctx sends the JSON you provide instead of resolving the saved cohort.
Use the public API
REST keys can use the Scheduled Functions endpoints. MCP keys needworkflows:read for reads and previews, and workflows:write for creation, updates, execution, deletion, and clearing history.
List Scheduled Functions
Read the functions available to the organization.
Create a Scheduled Function
Create code, schedule, timezone, and lookup configuration.
Preview a schedule
Validate cron and timezone against the next occurrences.
Preview a cohort
Count and sample the leads selected by a lookup.
Run a Scheduled Function
Start a live execution whose effects may apply.
List runs
Inspect execution history programmatically.