Skip to content
EN
Open app

For AI assistants: this page as plain markdown is at https://docs.voicelogica.ai/raw/workflow-nodes/code.md, and https://docs.voicelogica.ai/llms.txt lists the docs by topic, one file each, small enough to read whole. Read those rather than this HTML page.

Run Custom Code

2 min read
Copy as Markdown
View as MarkdownOpen the raw .md file.md

Run Custom Code runs JavaScript or Python in the graph. Prefer a short transform - not a long HTTP client when Connect To External Service exists.

Run Custom Code Language Code Parameters
wn-codeExpand
LanguageREQUIRED
JavaScript or Python.
CodeREQUIRED
Use Insert variable (or {{) for previous outputs. The returned object is stored in result by default. Variables are written into the code before it runs: put text in quotes ("{{node_1.customer_name}}") and numbers or objects without them ({{node_3.api_response}}). There is no args object.
Parameters
+ Add Parameter - declare keys from the returned object for {{node_X.name}} downstream.
  1. Add Run Custom Code after a node that produces data.
  2. Pick language, write the function, declare parameters you need later.
  3. Save & go live.
Why does the Run Custom Code node say Code is required?

The code editor of Run Custom Code is empty. Write JavaScript or Python that returns an object, then add a Parameter for each key of that object you want to use in later nodes.

What does the red «Failed N× in a row» strip on a Run Custom Code node mean?

The node failed on its last N real runs (calls or events, not test runs), so the workflow stopped at it each time. After 3 failures in a row, the company’s notification emails (or the admin) get one email with the workflow, the node and the error, at most once a day per node.

  1. Open the node and read the error in the email.
  2. Fix the code, then run Test on the workflow.
  3. Save & go live. The strip goes away after the next successful real run.