Write javascript step

Write custom JavaScript for any operation inside your automation, from posting to an API to formatting the data of earlier steps, which you can use as variables in the script. Data in axiom.ai is a grid of rows and columns, so return an array of arrays and it becomes the [code-data] token; return anything else and the token is empty. For what the step can do, see JavaScript in axiom.ai and the JavaScript snippets.

You can use this step to:

  • Create custom logic
  • Format data from other steps
  • Use Puppeteer's API
  • Use the Node file system API
  • Click buttons and scrape content
  • Run JS in the browser or in the desktop app

If you use this step for something you need often, tell us: it may become a step of its own.

The Write javascript step with its Write JS editor, the Snippets and Insert Data buttons, and the Run in app switch, outputting the code-data token

How to configure the Write javascript step


Script

Write your JavaScript in the Write JS editor. Click Snippets for ready-made pieces of code, and Insert Data to use the data of earlier steps; only steps above this one are available. Click the expand icon to open the editor full size.

Run in app

Turn the switch on to run the script inside the desktop app rather than in the browser window. That gives it the APIs the app has and the browser does not, such as Puppeteer, the file system and ChatGPT, and it is the better way to send API requests, which often hit CORS errors from the browser.

Guides that use this step