Skip to main content
In a Code Node, you can use a selection of predefined NPM modules. On this page, you’ll find all the necessary information to run these modules in a Code Node.
You can use the moment.js module for parsing, validating, manipulation and displaying dates.

Usage

In a Code Node, call the following function:

Example

the following example gets the current UTC time and date and outputs it back to the contact.
For more information, see the Moment.js Documentation.
Lodash DocumentationCognigy.AI also supports the utility library Lodash within Code Nodes.

Usage

You can call functions of the Lodash module by using the following syntax:
You can use any Lodash function within a Code Node. See their documentation for further information.

Example

The following example shows a typical use-case and syntax of the Lodash module.
In this example we’re extracting the last element of the favouriteFoods array and sending it as an output message.
XML-js DocumentationIn case you want to parse XML data, you can use this module.

Usage

Within a Code Node, you can call the following method:

Usage

Within a Code Node, you can invoke the getTextCleaner function, which retrieves an instance of the Text Cleaner class. This class provides access to various text-cleaning functions.ParametersConfig Options
ReturnsInstance of the Text Cleaner class.
Last modified on June 10, 2026