The Custom Code node in Cobalt enables users to execute custom code within workflows. Users can leverage their preferred programming language to create custom logic and functionality.

Node Functionality

Custom Code node is like a code executor within workflows. It can:

  • Modify structure of the data received;
  • Perform operations on data;
  • Filter data;
  • Use supported external JS libraries in code;

To know more about all the libraries supported, refer here.

  • Any other operation that you want to using code;

Custom Code Input Fields

To get started with Custom Code, first provide the Input Parameters as a key-value pair that you want to use in code and then select your preferred language.

In the Code section, the user can write their own custom code which they want to get executed within the yourFunction.

Supported JavaScript Libraries & Usage

The full list for the supported npm modules can be found below. If you don’t see the module that you want, contact us and we will get that added.

How to use Libraries

To know how you can use these external libraries in your Custom Code function, refer to the examples below for axios and lodash.

const axios = require('axios');

async function yourFunction(params) {
    const res = await axios.get("https://genshin-impact.up.railway.app/characters");

    return{
        data: res.data
    }
}