Writing JavaScript in Make

Executing JavaScript in Make is simple but requires attention to detail. The following NPM modules are available for in your code. Here are some further tips:

JavaScript Execution in Make
JavaScript Execution in Make

1. Accessing Input Variables

Inputs passed to your script are accessible as an input object. If you're passing multiple variables, it’s recommended to structure them as a JSON object for clarity and ease of use.
Input Field
Input Field

2. Use a return Statement

Your JS code must include a `return`, statement to output data back to the workflow. Without it, the code will not function as expected.
Code Field
Code Field

3. Set the Return Response Type

Ensure your return values have the correct type, such as a text, object, binary, or array, depending on your needs.
Return Type
Return Type

4. Working with Make Collections

If you're passing a Make collection as input, use the Transform to JSON module to convert it before using it in your JS code.

CustomJS Make Inline JS
CustomJS Make Inline JS

For a deeper dive into common mistakes and troubleshooting tips, visit our troubleshooting guide.