Skip to main content
NLU Transformers are used to customize the NLU Connectors pipeline. With transformers, you can:
  • Modify the incoming message from the Endpoint before it’s sent to the NLU engine.
  • Adjust the response from the NLU engine before it reaches the Flow execution.
NLU transformers are available for Cognigy NLU, as well as for Alexa, DialogFlow, Microsoft LUIS, and Watson Assistant connectors.

Restrictions

  • NLU transformers operate only on data exchanged with the NLU engine. They don’t modify the prompt or response of an LLM Prompt Node or AI Agent Node.

NLU Code transformer

With the NLU Code transformer, you can write a custom NLU pipeline in the Code Editor.

Transformer Settings

You can control the NLU Code transformer’s behavior by enabling or disabling functions in the Transformer Settings.

Available Modules

  • You can send one HTTP request per transformer execution.
  • You can’t send HTTP requests to other Endpoints.
You can send HTTP requests to external services, for example, third-party NLU engines, from within a transformer. All transformer functions can access the httpRequest module for this purpose. The module is invoked as a function which takes a single configuration object as arguments. This object has the same format as the options object for the NPM module Request.Example:
You can execute Cognigy NLU from within a transformer. All NLU transformer functions can access the getCognigyNlu function. This function takes string as arguments.Example:
SessionStorage is a storage object available to all transformer functions and stays active throughout the session. This object can store variables for later use in other functions or track the conversation state. You can access it using the getSessionStorage function. This function returns a Promise that resolves to the sessionStorage object, which you can use as a JavaScript regular object.Modifying variables inside StorageSession can lead to several problems:
  • Inconsistent State You might change the object in a way that other parts of your application don’t expect, which can cause errors or unexpected results.
  • Asynchronous Issues. Since JavaScript is asynchronous, other operations might try to access the session storage before your changes are applied, causing issues such as reading outdated data.
Instead, make changes locally (in a temporary variable or copy) and then assign the updated value back to SessionStorage.Example:
The following NPM modules are available in the transformer:
You can use the exposed modules console.log, console.info, and console.error in the transformers to display logs on the Logs page.

More Information

Last modified on June 2, 2026