Make scenario building
Use when creating a new Make scenario or editing an existing one — finding modules, connections and account-dependent values, wiring the flow, saving through scenario_create or scenario_patch. Not for explaining, running or debugging a scenario, or for API-call shells.
By- name:
- make-scenario-building
- description:
- Use when creating a new Make scenario or editing an existing one — finding modules, connections and account-dependent values, wiring the flow, saving through scenario_create or scenario_patch. Not for explaining, running or debugging a scenario, or for API-call shells.
Make scenarios — creating and editing
The tool descriptions carry each tool's rules; this skill carries the order of operations and the decisions the tools cannot make. A straight-line scenario needs nothing beyond the workflow below. Load a reference only when its trigger applies.
Ground rules. A 403 means the whole connection must be re-authorized with every permission — never one
tool. A short text remark beside a result's data is context for that result: use it to move toward the
user's goal, and tell the user when it matters. scenario_create/scenario_patch make one save each: put
everything one change needs in one call, and read a refused write's errors as a free dry run. Say what you
resolved an ambiguous value to ("the Sales channel", "next Monday") before the call that acts on it. Details
and the refusal contract: make-scenario-reference, when something is refused.
Build a new scenario
- Pin the design in words the user agrees with: every app by name (ask when they name a category — "email", "a form", "AI"), what starts it, what moves where, what happens to non-matching items.
environment_get→organizationId/teamId.app_findwith the user's words, once per goal. Given an instant and a polling trigger for the same source, say which you chose and why.module_specfor every planned module in one call,schemas: true— it gives each module's exactconfigshape and itsdynamicpaths.- Connections: reuse an id from
connection.existing; otherwise oneconnection_createfor every app, hand over the link,connection_getwhen the user says they are done. module_field_resolveeverydynamicpath independsOnorder, copyingvalueintoconfig. A polling trigger's start point is the/datapath — ask "existing items or from now?" before resolving it. (module_options_getis the same lookup keyed bymodule_spec'sdynamicFieldsand aconnectionId; use one or the other per field, not both.)- Compose the flat list: your ids, one
root: "main", everything elsefollowsorparent, oneconfigper module,filterfor a plain continue-or-stop gate. Google Sheets, Gmail, Make AI Tools or date math involved → App gotchas first. scenario_create,autoActivateoff unless asked. Fix everything inerrorsand resubmit; relaywarnings.- Verify, then
scenario_activate. On-demand:scenario_runwithinputs. Polling/scheduled: activate,scenario_run,scenario_execution_get. Webhook: the user sends one real request —scenario_rundoes not exercise a webhook. Then givehttps://<zone>.make.com/<teamId>/scenarios/<scenarioId>.
Edit an existing scenario
scenario_getfor structure andlastEdit;scenario_module_getonly for the modules you will change.- Adding modules:
app_findandmodule_spec(schemas: true)as above; resolvedynamicpaths against the module's currentconfig. - One
scenario_patchwithexpectedLastEditand every operation the change needs. Send only theconfigdomains you changed. Fix every{{<id>.field}}reference a removed or moved module leaves dangling in the same call. - A module added in a call gets its id on save, so wiring onto it is a second call with the returned
lastEdit. Verify from the response'smodulesecho.
A webhook whose payload is unknown
payloadShape: "learned" in module_spec, or a bare gateway:CustomWebHook: create with the trigger alone →
the user sends one real request (or scenario_trigger_learn first) → scenario_trigger_inspect →
scenario_patch the rest. Do not activate a webhook scenario whose fields nobody has seen.
Decisions the tools leave to you
- Filter vs if-else vs router. Skip non-matching items and nothing else →
filter. Non-matching items need their own action →builtin:BasicIfElse(+builtin:BasicMergeto rejoin). Several arms that may all fire →builtin:BasicRouter. - Do not over-build. No error handlers, aggregators or variables unless the design needs them.
References — load only on the trigger
| Trigger | Reference |
|---|---|
| Mapping a trigger's or on-demand input, a whole bundle or an array element; a mapped field came back empty | Mapping |
| A value must be transformed (dates, text, arrays, conditionals) | IML functions |
| More than a straight line: routers, if-else + merge, multi-condition filters, iterating, aggregating | Flow control |
| The scenario is on-demand, calls another scenario, or is called by one or by an agent | Subscenarios |
| Placing a Make AI Agent module with tools | AI agents |
| A run must remember earlier runs (dedup, counters), or a payload needs a fixed schema | Data stores |
| The user asks for retries or fallbacks, or failure/data loss is unacceptable — most scenarios need none | Error handling |
| Finalizing a Google Sheets, Gmail or Make AI Tools config, or a date expression | App gotchas |
A complete scenario_create call to pattern from |
Examples |
Open this reference as its own page
AI agents in a scenario
When an agent, and when not
| The step needs | Use |
|---|---|
| The same output for the same input — sync, transform, notify | ordinary modules, filters, if-else |
| AI-generated content with fixed parameters — summarize, translate, classify into known labels | an AI provider's own module (OpenAI, Anthropic, Make AI Tools) |
| Judgment over which of several tools to use, how often, with what arguments | ai-local-agent:RunLocalAIAgent |
An agent is non-deterministic, slower and costlier than the alternatives; choose tasks you would trust an intern with. It only knows its training data — live or account-specific information (weather, inventory, a CRM record) reaches it only through a tool; without one it guesses or refuses.
The agent module
ai-local-agent:RunLocalAIAgent (confirm the version with module_spec). Its connection is the AI provider
(parameters.makeConnectionId — Make AI Provider, OpenAI, Anthropic, Gemini, and others; reuse from
connection.existing). The provider is locked once the agent exists. config.mapper:
message(required) — the per-run input, usually mapped from upstream ({{1.text}}).systemPrompt— role, goals, rules, steps. The single most important field.defaultModel— dynamic: resolve withmodule_field_resolverather than typing a model id. Unless the user names a model, pick a mid-tier one (mediumon a Make AI Provider connection) and leavereasoningEffortunset orlow. A provider's flagship model orhigheffort multiplies the cost of every run: one test run on a flagship has cost hundreds of dollars in credits.threadId— a stable conversation id (a chat thread id, a ticket id) gives the agent memory across runs; leave it empty for stateless runs.files,modelConfig(recursionLimitsteps per call,tokenLimit),timeout,outputType("text"or a structured schema) — only when the user needs them.
The agent emits one output bundle per run regardless of how many tools it called. Knowledge files and MCP-server tools are configured in the Make UI, not here.
Tools are arms
Each tool is a nested flow hanging off the agent: its first module carries
parent: {moduleId: <agent id>, kind: "tool", index, label, description}. label is the tool's name
(required — it is what the agent calls), description is what tells the agent when to use it; write both
the way you would for any tool-calling model.
Inside the tool's flow, a field the agent should fill at run time maps to the agent's id:
{ "id": 5, "module": "weather:ActionGetCurrentWeather", "version": 1,
"parent": { "moduleId": 2, "kind": "tool", "index": 0, "label": "Get current weather",
"description": "Returns current weather for a city. Use when the user asks about weather." },
"config": {
"mapper": { "type": "name", "city": "{{2.city}}" },
"restore": { "expect": { "city": { "extra": { "aiHelp": "City name, e.g. London, UK.",
"aiInstruction": "Take the city from the user's message." } } } }
} }
"type": "name"is fixed — set by you."city": "{{2.city}}"is AI-decided — the agent (id 2) supplies it. Give every AI-decided field anaiHelp(format hint) and, where the choice is not obvious, anaiInstructionunderconfig.restore.expect.<field>.extra; without them the agent has no guidance.- A
filter-type field of a tool module (a search module'sfilterinconfig.mapper, not the arm's own routefilter) is AI-decided per condition: the operandbof the n-th AI-decided condition is{{<agentId>.filter[n]}}(n from 0, in filter order) andconfig.restore.expect.filter.extra.aiInstructionis an array whose entry n is that condition's instruction. The engine reads only that node — an entry keyed under a condition or operand (filter[0][0].b) never reaches the agent. - Tool modules that authenticate use their own connection parameter as usual.
- One module per tool is the simple case. For multi-step tools, make the tool arm a
scenario-service:CallSubscenarioto an on-demand scenario with declared inputs and outputs (see Subscenarios) — the declared interface becomes the tool's argument and result shape. - Editing a tool's name or description later is
scenario_patch→arm_setwithkind: "tool".
Replying to the caller
A webhook-triggered agent scenario whose caller expects the answer in the HTTP response must end with
gateway:WebhookRespond mapping the agent's output — ReturnData never reaches a webhook caller.
The complete call is in ai-agent-with-tool.json.
<!-- Modified by Automation Skills on 2026-11-24: relative links to files that were not copied now point to the original repository. -->Open this reference as its own page
Common app gotchas
Write-time validation is static: it checks shapes and known option lists, not what the app will do with the value. Each item below saves cleanly and surfaces only on the first run.
Google Sheets
valueInputOptionis required onaddRow/updateRowand lives inmapper, notparameters. Always set"valueInputOption": "USER_ENTERED"; onaddRowalso"insertDataOption": "INSERT_ROWS", or writes can land on the same fixed row every run.- Row values are keyed by zero-based column position —
"values": {"0": "…", "1": "…"}— never by column letter. Letters do not error; they write to the wrong place. (The app's own row-matching filters do use letters — a different field, do not cross-apply.) - Reading a row's columns is
{{1.`0`}}(column A),{{1.`1`}}(column B) — backticked zero-based indices. WithincludesHeaders: trueheader-named fields exist too, but they break when a header is renamed. Row metadata:{{1.__ROW_NUMBER__}},{{1.__SHEET__}},{{1.__SPREADSHEET_ID__}}— the natural way to write back to the row a trigger produced. spreadsheetId/sheetIdare account data. Resolve them withmodule_field_resolvewhenmodule_speclists them asdynamic; if a lookup is refused, do not guess an id or assumeSheet1— state the assumption or ask.
Gmail vs the other Google apps
Gmail (google-email:*) authenticates with a different connection type than Sheets, Calendar and Drive.
module_spec's connection.existing is already scoped per module — read it per module and never tell a user
"you're connected to Google, so Gmail is covered". Note that some Gmail modules name the connection parameter
account rather than __IMTCONN__; configurationSchema says which.
Make AI Tools (ai-tools:*)
model is required and has no default. With a Make AI Provider connection use the tier slugs "small",
"medium", "large" — a provider model id such as "gpt-4o-mini" is rejected. Users without that connection
get the same result from the provider's own app (OpenAI, Anthropic, Gemini) via connection_create, which
does take provider model ids. When module_spec marks model dynamic, resolve it instead of assuming.
Dates in IML
No startOfDay()/endOfDay() — build boundaries as {{formatDate(now; "YYYY-MM-DD")}}T00:00:00Z and
…T23:59:59Z. Everything else about dates is in IML functions.
Open this reference as its own page
Data stores and data structures
A scenario forgets everything between runs. A data store is the memory: a small keyed table the built-in Data store modules read and write. A data structure is a named field schema: it shapes a store's records, or types a webhook's payload so later modules can map named fields.
Default to none. Need one only when a run must know what an earlier run did (seen this email already? running total?) or several scenarios share a lookup table. A one-off transform needs neither.
Order of operations
Dependencies run structure → store → scenario, so create in that order.
A new scenario gets its own new store. A store another scenario writes to is that scenario's state:
sharing it mixes records, breaks both dedup keys, and a later cleanup deletes data the other scenario needs.
Reuse an existing store only when the user names it or explicitly asks to share one (a shared lookup, below).
A store that merely looks similar by name or fields is not a match — the data_store_list check the tool
descriptions suggest is for finding the store the user named and avoiding a duplicate name, not for picking
one yourself.
data_structure_create, preferably from a realsamplepayload rather than a hand-writtenspec. Skip entirely for a store whose records need no fixed shape. Reuse a structure only when it belongs to the store the user asked to share.data_store_createwith the structure's id, a name that ties it to this scenario, and a modestmaxSizeMB.app_findfor the operation ("add a record to a data store", "check if a record exists") → take the Data store module names from the result, never guess them →module_spec(schemas: true).- Put the store's id in the module's
datastoreparameter, in the samescenario_create/scenario_patchcall as the rest of the design.
State the store and structure names you picked or created before the scenario write that uses them.
Patterns
- Dedup. Key = the source item's stable id. Look the key up →
filteron "does not exist" → process → add the record with that key. Add after processing succeeds, or a failed run marks the item as seen. - Counter / running total. Get the record → compute the new value in the mapper → update the record.
Not safe under parallel runs; set the scenario to sequential (
settings_set) when the count must be exact. - Shared lookup — only on an explicit request. One scenario maintains the store; others only read it. Say which scenario owns writes.
- Typed webhook payload. A structure from a real sample, assigned to the webhook trigger with
scenario_patch, gives later modules stable field names and (withstrict) rejects malformed requests. Still learn one real request first when nobody has seen the payload — see the webhook section of the skill.
Changing or removing
data_structure_updatereplaces the whole spec — include every field that must survive.data_store_delete/data_structure_deletefirst report which scenarios still use the target. Relay that list and get an explicit yes before calling again withconfirmed: true; deleted records do not come back.
Open this reference as its own page
Error handling
Default to none. Make stops a run on the first error, records it, and deactivates the scenario after repeated failures — that is the right behavior for most automations, and it keeps failures visible. Add handlers when the user asks for retries, fallbacks or "never lose a record", or when a failed run has a real cost (payments, data sync, customer-facing replies). Do not propose them for a notification scenario. Any handler, even an arm that only notifies, also turns off Make's in-run retry of a temporary connection error on that module: the first error goes straight to the arm.
Shape: an error handler is an arm
An error handler hangs off the module whose failure it handles: parent: {moduleId: <that module>, kind: "errorHandler"} — a single flow, no index. Any modules can run in the arm (notify, log), and it ends with
a directive that decides what happens to the run:
{ "id": 3, "module": "stripe:CreateCharge", "follows": 2, "config": { "…": "…" } },
{ "id": 10, "module": "slack:CreateMessage", "parent": { "moduleId": 3, "kind": "errorHandler" },
"config": { "mapper": { "channel": "C0ALERTS", "text": "Charge failed for {{2.email}}" } } },
{ "id": 11, "module": "builtin:Ignore", "version": 1, "follows": 10, "config": {} }
Routers and directives themselves cannot carry a handler. scenario_get reports handlers as modules with
parent.kind: "errorHandler"; module_spec confirms every directive below.
| Directive | Effect on the failed item | config |
Use when |
|---|---|---|---|
builtin:Ignore (Skip) |
Drop it, keep processing the rest | none | Non-critical step; losing the item is acceptable |
builtin:Resume |
Continue after the failed module as if it produced substitute values | mapper: the substitute output, keyed by the failed module's output fields |
A safe default exists |
builtin:Break (Retry) |
Store the run as an incomplete execution and retry later | mapper: {retry: true, count, interval} (interval in minutes) |
Transient failures — rate limits, outages |
builtin:Commit |
Stop the run, keep everything done so far | none | Partial progress is valid |
builtin:Rollback |
Stop and revert transactional (ACID) modules | none | All-or-nothing; only reverts modules that support it |
The editor names builtin:Ignore Skip and builtin:Break Retry; use those names with the user. Match
the directive to the failure kind: connection and rate-limit errors → Retry; bad data → Resume or Skip; a
misconfigured module → fix the config, no handler helps.
Raising errors deliberately
builtin:ThrowError (mapper: {message}) fails the run with status: error; builtin:ThrowWarning records
a warning and continues. The common use is guarding a "successful but empty" result before the scenario's
output module: a router with one arm filtered on result exists leading to scenario-service:ReturnData (or
gateway:WebhookRespond), and another arm filtered on notexist leading to ThrowError. Without it a run
whose AI step returned nothing reports success.
Scenario-level settings
scenario_patch's settings_set writes the execution settings that interact with errors: maxErrors
(consecutive errors before Make deactivates the scenario), dlq (store incomplete executions), sequential
(process one run at a time — a stored failed run then blocks the queue until it is resolved), autoCommit,
dataloss, confidential. Change them only on request; the defaults are what most scenarios should keep.
Things to say to the user
- Retry (
builtin:Break) anddlqcreate incomplete executions that someone has to retry or discard in Make — this surface cannot do that (make-scenario-reference, refusal contract). A sequential scenario with stored failures stops processing new data until they are handled (isWaitingOnIncompleteExecutionsinscenario_get). - A webhook-triggered scenario with
maxErrorsset deactivates on the first error, not after N. The exception is a scenario that answers its caller (agateway:WebhookRespondanywhere in the flow): only configuration or blueprint errors deactivate it; every other error goes back to the caller and never counts towardmaxErrors, so a failing one keeps running and using credits. Rollbackonly reverts modules marked transactional; a non-transactional write earlier in the run stays.
Open this reference as its own page
Flow control
Every shape below is expressed in the same flat module list scenario_create and scenario_patch take: a
module either follows another or starts an arm with parent: {moduleId, kind, index}. Nothing is ever
nested inside another module's JSON. module_spec confirms every module named here and its config.
Bundles: why multiplicity matters
A module runs once per incoming item ("bundle"). Search and list modules return one bundle per result — they are implicit iterators: everything after them already runs per item, so do not add an iterator. A module that returns one bundle with an array inside needs an explicit iterator before per-item processing. Every downstream module after an iteration point runs N times; an aggregator closes the loop back to one bundle.
Filter — a gate on one module
{ "id": 2, "module": "slack:CreateMessage", "follows": 1,
"filter": { "name": "Paid orders only", "conditions": [[ { "a": "{{1.status}}", "o": "text:equal", "b": "paid" } ]] },
"config": { "…": "…" } }
conditions is an array of arrays: outer entries OR-ed, inner AND-ed, each {a, o, b}. Operators are
typed by kind — text:equal, text:notequal, text:contain, text:startwith, text:pattern,
number:equal, number:greater, number:less, number:greaterorequal, date:greater, date:less,
boolean:equal, array:contain, exist, notexist (no b for the last two). A blocked item stops
there — every module downstream on that path skips it silently, with no error and no output.
Use a filter, not a router or if-else, when the only requirement is "proceed if…". Never put a filter on the first module of an if-else branch: the engine deletes it. Put the condition on the branch instead.
Router — every item goes down every arm
{ "id": 2, "module": "builtin:BasicRouter", "version": 1, "follows": 1, "config": {} },
{ "id": 3, "module": "slack:CreateMessage", "parent": { "moduleId": 2, "kind": "route", "index": 0 },
"filter": { "name": "High value", "conditions": [[ { "a": "{{1.amount}}", "o": "number:greater", "b": "1000" } ]] }, "config": { "…": "…" } },
{ "id": 4, "module": "google-sheets:addRow", "parent": { "moduleId": 2, "kind": "route", "index": 1 }, "config": { "…": "…" } },
{ "id": 5, "module": "google-drive:uploadAFile", "follows": 4, "config": { "…": "…" } }
- Arms are indexed from 0 with no gaps and run sequentially in index order; a filter on an arm's first module decides whether that arm runs for an item. Several arms can run for the same item.
- Routes never rejoin. A module on one route cannot reference a module on another.
- Use it for fan-out (log AND notify AND archive), not for a mutually exclusive choice — that is if-else.
If-else and merge — the first matching arm runs, arms can rejoin
{ "id": 2, "module": "builtin:BasicIfElse", "version": 1, "follows": 1, "config": {} },
{ "id": 3, "module": "slack:CreateMessage", "config": { "…": "…" },
"parent": { "moduleId": 2, "kind": "branch", "index": 0, "label": "Urgent",
"conditions": [[ { "a": "{{1.priority}}", "o": "text:equal", "b": "urgent" } ]], "mergesTo": 5 } },
{ "id": 4, "module": "google-sheets:addRow", "config": { "…": "…" },
"parent": { "moduleId": 2, "kind": "branch", "index": 1, "label": "Everything else", "mergesTo": 5 } },
{ "id": 5, "module": "builtin:BasicMerge", "version": 1, "follows": 2, "config": {} },
{ "id": 6, "module": "zendesk:UpdateTicket", "follows": 5, "config": { "…": "…" } }
- Conditions are evaluated in index order; the first match wins. The last arm without
conditionsis the catch-all "else". Order arms from most to least specific. - To continue as one flow after the branches, place
builtin:BasicMergedirectly after the if-else (followsthe if-else id) and setmergesToon every arm that rejoins. Modules after the merge reference the merge module's id. LeavemergesTooff and each arm simply ends. - Merge's own
config.outputs/config.filters(one entry per merging arm) normalize differing branch outputs;{}/[]passes the branch bundle through unchanged. Their length must match the number of merging arms — validation refuses a mismatch. - A router or another if-else cannot follow an if-else inside the same branch scope.
Iterator — one bundle per array item
{ "id": 3, "module": "builtin:BasicFeeder", "version": 1, "follows": 2,
"config": { "mapper": { "array": "{{2.attachments}}" } } }
Downstream modules reference the item's fields on the iterator's id ({{3.fileName}}). Many apps ship a
specialized iterator (e.g. an email app's "iterate attachments") — prefer it when app_find lists one.
builtin:BasicRepeater (mapper: {start, repeats, step}, output i) generates N bundles from nothing.
Aggregators — many bundles back into one
The feeder is the module whose bundles start the loop (an iterator, or an implicit iterator such as a
search). It goes in parameters.feeder, as a module id. Bundles between the feeder and the aggregator are
not forwarded — anything needed downstream is collected explicitly in the aggregator's mapper.
| Need | Module | config |
Output |
|---|---|---|---|
| Items into one array | builtin:BasicAggregator |
parameters.feeder; mapper = the fields to keep per item ({"email": "{{3.email}}"}); flags.groupBy (IML, one output bundle per distinct value), flags.stopIfEmpty |
array |
| Joined text | util:TextAggregator |
parameters.feeder, parameters.rowSeparator ("\n", "\t", or "other" + otherRowSeparator); mapper.value |
text |
| Sum / avg / count / min / max | util:FunctionAggregator2 |
parameters.feeder, parameters.fn; mapper.value |
result |
| Rows into a table | util:AggregateAggregator |
parameters.feeder; per module_spec |
per module_spec |
Validation refuses a feeder that does not point at an upstream module. An iteration with no aggregator
means every module after it runs per item — deliberately fine for "notify per row", wrong for "send one
summary".
Variables
util:SetVariable2 (mapper: {name, scope: "roundtrip" | "execution", value}) stores a value the rest of the
run reads back as {{<setVariableId>.<name>}} or via util:GetVariable2 (mapper: {name}). Rarely needed:
mapping straight from the upstream module is simpler and cheaper.
Choosing
| Situation | Use |
|---|---|
| Skip items that do not match, nothing else to do | filter |
| Exactly one of several actions per item, then continue together | if-else + merge |
| Several independent actions, possibly all for one item | router |
| One bundle holding a list, act per element | iterator |
| Many bundles, one message / payload / total | aggregator |
| Repeat a fixed number of times | repeater |
Open this reference as its own page
IML functions and expressions
IML is the expression language inside {{…}} in mapper values, filter conditions, and
flags.groupBy. Everything below is built in. Only use what is listed here — a misspelled or invented
function saves fine and fails every run with "Unknown function". Custom (user-defined) IML functions exist in
Make but cannot be created on this surface; a scenario that already uses one reads back fine, a new one has to
be written in the Make editor.
Syntax
- Arguments are separated by semicolons:
{{if(1.status = "active"; "Yes"; "No")}}. - Straight quotes only (
"), never typographic ones. - Field names with spaces or leading digits go in backticks:
{{1.\Customer Name`}}, `` {{1.0`}} ``. - Array indexing is 1-based:
{{1.items[1]}}is the first item. - Logical operators are the symbols
&(and) and|(or) — the wordsAND/ORdo not parse. - Comparison:
=,!=,<,>,<=,>=. Arithmetic:+,-,*,/,%. - No inline JSON (
{key: value}) and noset()— build objects with the module's own fields instead.
General
| Function | Returns |
|---|---|
if(expr; a; b) |
a when expr is true, else b |
ifempty(a; b) |
a unless empty, then b |
switch(expr; v1; r1; v2; r2; …; else) |
the result matching expr |
get(object; path) |
the value at a variable path (use dot access for static paths) |
pick(object; k1; k2; …) / omit(object; k1; …) |
the object with only / without those keys |
equal(a; b) |
equality test |
Text
length, lower, upper, capitalize, startcase, trim, replace(text; search; replacement),
substring(text; start; end) (0-based), split(text; sep), indexOf(text; value), contains(text; search),
toString(value), stripHTML, escapeHTML, encodeURL, decodeURL, ascii(text; removeDiacritics),
base64, toBinary, md5, sha1, sha256, sha512, replaceEmojiCharacters(text; replacement).
To put a JSON object into a text field: {{toString(1.json)}}.
Dates
| Function | Notes |
|---|---|
formatDate(date; format; [timezone]) |
e.g. "YYYY-MM-DD", "YYYY-MM-DDTHH:mm:ssZ" |
parseDate(text; format; [timezone]) |
string → date |
addDays / addHours / addMinutes / addSeconds / addMonths / addYears(date; n) |
negative n subtracts |
setDate / setDay / setMonth / setYear / setHour / setMinute / setSecond(date; value) |
out-of-range values roll over |
- A full datetime is one
formatDatecall with a format containing the literalT; never concatenate separately formatted date and time parts. - There is no
startOfDay()/endOfDay(). Day boundaries are{{formatDate(now; "YYYY-MM-DD")}}T00:00:00Zand…T23:59:59Z— the one sanctioned date + literal-time concatenation.
Numbers
round, ceil, floor, trunc(n; decimals), abs, min, max, sum, average, median,
parseNumber(text; decimalSeparator), formatNumber(n; decimals; decSep; thousandsSep) — its defaults are a
comma decimal separator and a period thousands separator, so always pass both explicitly — stdevS, stdevP.
Arrays
length, first, last, map(array; key; [filterKey]; [filterValues]), join(array; sep),
contains(array; value), add, remove, sort(array; order; key), reverse, shuffle, merge,
slice(array; start; end) (0-based), flatten, distinct(array; key), deduplicate, keys(object),
toArray(collection), toCollection(array; keyField; valueField).
Variables and keywords
Variables: now, timestamp, pi, random, uuid, executionId.
Keywords: null, true, false, emptystring, emptyarray, space, tab, newline, nbsp,
carriagereturn, ignore (treat the field as empty), erase (clear the field).
Open this reference as its own page
Mapping
The one reference form
A config.mapper value is an IML expression that references an upstream module's output by that
module's id — the id assigned in the flat module list:
{{1.email}}— fieldemailfrom module 1{{3.items[1].name}}— first item'snamein module 3'sitemsarray (indexing is 1-based){{1.\Customer Name`}}` — a field with spaces or special characters, in backticks{{`1`}}— module 1's whole output bundle (a bare{{1}}does not parse)
There is no {{input.x}}, {{trigger.x}}, or bare {{x}}. Those silently resolve to nothing rather than
erroring — the most common wrong guess on this surface.
The trigger owns the run's input
Whatever module holds root: "main" receives the run's injected data as its own output bundle: a
webhook's parsed payload, or an on-demand scenario's declared interface.input values. Reference it by that
module's id like any other: if scenario-service:StartSubscenario is id 1 and the scenario declares an input
city, the reference is {{1.city}}. See Subscenarios for why the root of an
on-demand scenario has to be a real starter module for this to work at all.
Knowing what is available to map
module_spec(schemas: true) returns outputSchema — the fields one produced item carries, when known
statically. That covers most action and search modules.
Some modules' output depends on their own configuration (a Google Sheets trigger's columns depend on the
selected sheet; a webhook's fields on what was sent). For those outputSchema is absent and no tool on this
surface pre-resolves output field names — module_field_resolve resolves input paths only. Options:
- map the fields the app is known to produce (Sheets:
{{1.`0`}}for column A — see App gotchas), then run once and confirm; - for a webhook, learn the payload first (
scenario_trigger_learn→scenario_trigger_inspect); - build, run once, read the real bundle with
scenario_execution_module_get, then fix the mapper.
Mixing literals and references
{
"city": "{{1.city}}",
"greeting": "Hello, {{1.name}}!",
"status": "active",
"processedAt": "{{formatDate(now; \"YYYY-MM-DD\")}}"
}
A fixed value usually belongs in config.parameters if configurationSchema lists it there; mapper is for
values that vary per item. Functions and operators are in IML functions.
Gotchas that validation does not catch
- Empty string is a write. On update-style modules, omit a key you do not intend to touch —
""writes an empty value downstream.module_config_setreplaces the wholemapperdomain you send, so rebuild it fromscenario_module_get's copy, not from memory. - Removing or moving a module strands its references. Every
{{<id>.field}}pointing at it stops resolving with no error. Fix them in the samescenario_patch. - Cross-arm references do not resolve. A module on one router route cannot read a module on another route — only what ran upstream of it in the same path.
- Array into a single-value field — use
first(),last(), or an index; a field that expects one value receiving an array is a run-time failure, not a validation error.
Open this reference as its own page
Subscenarios and on-demand scenarios
The on-demand shape
A scenario meant to be run on request — from scenario_run, from another scenario, or as an AI agent's
tool — has scheduling: {"type": "on-demand"}, a top-level interface: {input: [...], output: [...]}, and
exactly this frame:
id 1 scenario-service:StartSubscenario root: "main" receives the declared inputs
id 2… whatever the scenario does follows the previous module
id N scenario-service:ReturnData last produces the declared outputs
StartSubscenariois not optional. Its output bundle is the run's input: a declared inputcityis{{1.city}}downstream.scenario_createaccepts a plain action module in the root position without complaint, but then nothing receives the inputs and every reference to them resolves to nothing.ReturnData's mapper is keyed by the declared output names. Nothing checks that everyoutput[].namehas a matching key — a missing or misspelled key silently returnsnullfor that output on a run that reports success. Check the mapper againstinterface.outputbefore calling the build done.interfaceis a sibling ofmodules, not a field on either module. Required inputs are allowed only on an on-demand schedule.app_findunder-serves this search — ask for "start scenario when called by another source, receive scenario inputs" rather than "on-demand trigger", or name the two modules directly tomodule_spec.
The example on-demand-subscenario.json shows the complete call.
Calling one scenario from another
scenario-service:CallSubscenario in the parent: config.parameters.scenario is the child's id,
parameters.shouldWaitForExecutionEnd picks synchronous (true — the parent waits and gets the child's
declared outputs as this module's output) or fire-and-forget (false — no outputs come back). The mapper's
fields are the child's declared inputs; resolve them with module_spec(schemas: true) after the child exists.
- Same team only. The child must be active and on-demand to be callable.
- Split a scenario into subscenarios when it is too large to reason about, or when the same steps are needed from several parents. Calls through this module do not consume credits.
scenario-service:RunScenariois the older replacement-pending module; preferCallSubscenario.
Where the outputs actually go
| Caller | Gets the outputs from |
|---|---|
scenario_run on the on-demand scenario |
its response outputs |
a parent's CallSubscenario (sync) |
that module's output bundle |
| an AI agent using the scenario as a tool | the tool result |
| an HTTP client posting to a webhook trigger | nothing — ReturnData does not reach a webhook caller. End that flow with gateway:WebhookRespond instead |
Symptoms of getting it wrong
- Every output
nullon a "successful" run: wrong root module, orReturnDatakeys do not match the declared output names. scenario_runrejects theinputs: the error names the declared interface — align the keys, do not guess again.- Generic
BlueprintValidationErrorwith no field: usually a non-starter module in the root of an on-demand scenario.
More in this playbook
Safe to turn on
Use this skill when an agent or person is about to create, change or enable an automation inside someone else's account or a shared environment: "create this workflow", "build it in the customer's account", "turn it on", "go live", "deploy this automation". Produces a proposal the human approves, an automation created in the off state, and a short list of what only the human can finish.
Workflow buildingMITn8n agents
Design n8n AI agents the right way. Use when building or editing any @n8n/n8n-nodes-langchain.* AI node — an AI Agent, LLM chain, Text Classifier, or Information Extractor — and whenever the user mentions AI agents, LLM with tools, tool calling, $fromAI, system prompts, agent memory, sessionId, structured/JSON output, output parser, RAG, vector store, a chat assistant/bot, or human-in-the-loop review. Covers Agent-vs-chain-vs-classifier choice, the model/memory/tools/outputParser slots, tool names/descriptions as prompt, structured output with autoFix, memory, RAG, human review, and chat topologies.
Workflow buildingMITn8n agents
Design n8n AI agents the right way. Use when building or editing any @n8n/n8n-nodes-langchain.* AI node — an AI Agent, LLM chain, Text Classifier, or Information Extractor — and whenever the user mentions AI agents, LLM with tools, tool calling, $fromAI, system prompts, agent memory, sessionId, structured/JSON output, output parser, RAG, vector store, a chat assistant/bot, or human-in-the-loop review. Covers Agent-vs-chain-vs-classifier choice, the model/memory/tools/outputParser slots, tool names/descriptions as prompt, structured output with autoFix, memory, RAG, human review, and chat topologies.


