Moment.js
Moment.js
You can use the moment.js module for parsing, validating, manipulation and displaying dates.For more information, see the Moment.js Documentation.
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.Lodash
Lodash
Lodash DocumentationCognigy.AI also supports the utility library Lodash within Code Nodes.You can use any Lodash function within a Code Node. See their documentation for further information.In this example we’re extracting the last element of the
Usage
You can call functions of the Lodash module by using the following syntax:Example
The following example shows a typical use-case and syntax of the Lodash module.favouriteFoods
array and sending it as an output message.Messenger Platform
Messenger Platform
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:Text Cleaner
Text Cleaner
Usage
Within a Code Node, you can invoke thegetTextCleaner
function, which retrieves an instance of the Text Cleaner class.
This class provides access to various text-cleaning functions.ParametersParameter | Type | Description |
---|---|---|
locale | string | The locale for which to instantiate the class. For example, ‘de’ or ‘en’. |
options | object | See below for the config options. |