Javascript
Overview
The JavaScript connector enables your Leena AI Agents and workflow designers to run custom JavaScript code directly within automation workflows, giving teams the flexibility to implement bespoke logic, transform data, and bridge gaps between other connectors without waiting on engineering effort.
JavaScript is a widely used programming language for building application logic and processing data. The JavaScript connector allows Leena AI to execute purpose-built code as a step within a workflow — for example, reshaping data passed between systems, performing calculations, formatting values, or applying conditional business rules — so process owners can tailor automations to their exact requirements.
API Details
Unlike most Leena AI connectors, the JavaScript connector does not integrate with an external third-party API. Code is executed within Leena AI's own secure, sandboxed runtime. Each execution runs in an isolated environment subject to a fixed execution time limit, with a curated set of common utility libraries made available to the code (see Execute JavaScript code).
Setup
The JavaScript connector does not connect to an external system and therefore does not require any authentication credentials, API keys, or OAuth configuration. A connection must still be created in order to enable the connector for use within workflows.
Prerequisites
Before setting up the JavaScript connector, ensure you have:
- Access to your Leena AI workspace with connector management permissions
- Familiarity with writing basic JavaScript, for the teams who will author the workflow code
Get credentials
The JavaScript connector does not require any external credentials or API keys. Because code runs within Leena AI's runtime rather than against a third-party service, there are no credentials to obtain or configure.
Add connection
Here is how to add a connection on Leena AI:
- Log in to your Leena AI workspace
- Navigate to Settings > Integrations
- Search for "JavaScript" and select it from the list to add it as a new connector
- Save the connector to create the connection — no credential or configuration fields are required
Once the connection is created, the JavaScript connector can be used as a step within your workflows.
Actions
The following action is supported for the JavaScript connector:
Execute JavaScript code
Runs a custom JavaScript function as a step within a Leena AI workflow and returns its result to subsequent steps. Workflow designers can use this action to implement custom logic that is not covered by out-of-the-box connectors. Here are some common use cases:
- Data transformation: Reshape, filter, or reformat data passed between two systems
- Custom calculations: Compute values, totals, or derived fields on the fly
- Conditional logic: Apply bespoke business rules to drive downstream workflow decisions
- Formatting and parsing: Convert between formats such as JSON and XML, or normalise dates and strings
The code must define an execute function; the value it returns becomes the output of the action. Asynchronous code is supported. Any values supplied under Arguments are passed to the execute function in the order in which they are added. The following utility libraries are available to the code without any import: Lodash, Axios, Luxon, Node.js crypto, Buffer, and xml2js. Each execution runs in an isolated sandbox and is subject to a 60-second execution time limit.
Input Parameters
Here are the input parameters required to set up this action:
Mandatory
| Name | Description |
|---|---|
| Code | The JavaScript to run. Must define an execute function whose return value is used as the action's output |
Optional
| Name | Description |
|---|---|
| Arguments | An ordered list of values passed as arguments to the execute function, in the sequence in which they are added |
Response
Upon successful execution, the action returns the value returned by the execute function, which can be referenced by subsequent steps in the workflow. If the code throws an error or exceeds the execution time limit, the action returns an error with the corresponding message.
Updated 3 days ago
