Skip to main content

Code

Use the Code node to write custom JavaScript or Python and run it as a step in your workflow.

Usage

How to use the Code node.

Choose a mode

There are two modes:

  • Run Once for All Items: this is the default. When your workflow runs, the code in the code node executes once, regardless of how many input items there are.
  • Run Once for Each Item: choose this if you want your code to run for every input item.

Supported JavaScript features

The Code node supports Node.js. The Code node supports:

  • Promises. Instead of returning the items directly, you can return a promise which resolves accordingly.
  • Writing to your browser console using console.log. This is useful for debugging and troubleshooting your workflows.

Python

DeepOpinion provides Python support using Pyodide, which is a port of CPython to WebAssembly. This limits the available Python packages to the Packages included with Pyodide. DeepOpinion downloads the package automatically the first time you use it.

⚠️ Slower than JavaScript

I want the readers to read it carefully as it contains many important docs.

Coding in DeepOpinion

There are two places where you can use code in DeepOpinion: the Code node and the expressions editor. When using either area, there are some key concepts you need to know, as well as some built-in methods and variables to help with common tasks.