- Home
- Integrations
- JavaScript
Custom JavaScript code in no-code automation
Custom JavaScript in nana800 goes into the run custom script block: it runs JavaScript or TypeScript right inside the scheme and passes the result to the next blocks. It works the other way too: the nana800-code-action npm library starts a scheme from the code of your website, app or server. Both blocks are free, you pay only for the other blocks of the scheme and its hours.
Build it in the builder- Block run: $0
- Free every month: $3.50
- No card needed
What you can do
- Reshape data your own way: pick fields from an API answer, filter a list, count an order total
- Write JavaScript or TypeScript with await and return, use the lodash library and the wait(ms) pause function
- Read the results of all earlier blocks and the project variables in your code
- See console.log output in the block result, up to 1,000 lines, to track down bugs
- Start a scheme from your own code in Node.js 18+, in a browser or in React Native with the nana800-code-action npm library
- Pass any data from your code to the scheme and, if you want, wait until it finishes
Blocks in the builder
Custom script
Action · free
Runs JavaScript or TypeScript code in an isolated sandbox. Whatever return gives back lands in result and is available to the next blocks. The block also returns logs, success and error_text. This block is free.
Start from code (trigger)
Trigger · free
Starts the scheme with a call from your code through the nana800-code-action npm library or a plain POST request with your API key. The data you pass arrives in the scheme in the payload field. You can make the call wait for the scheme answer.
How to set it up
- 1
Add the script block
Create a scheme in the builder with the button trigger for testing and add the run custom script block. Write your code in the script field and return the result with return, for example return { total: 5 }.
- 2
Use data from earlier blocks
Block results are available in the NODES object by block name, and project variables are in GLOBAL_ENV. Network, timers and Node.js modules are closed in the sandbox: make API calls with the request block and parse its answer in your code.
- 3
Turn the scheme on and check the result
Turn the scheme on, press the button trigger and open the block result: result holds what your code returned, logs holds the console.log lines and error_text the error message. Fields from result go into the next blocks.
- 4
Start the scheme from your code
Add the code action from code with npm library trigger to the scheme. Create an API key in the nana800 settings, install the library with npm i nana800-code-action and call startTriggerAction with the key, the scheme ID, the trigger block name and your data in payload.
- 5
Keep the scheme on
While the scheme is off, a call from code will not start it. An enabled scheme costs $0.0042 per hour. The API key is tied to your account, so call the scheme from your own server, not from page code that visitors can see.
Templates with this service
- Telegram chat bot with an auto reply
A Telegram chat bot template with no code: the bot receives messages and photos from customers and replies at once. You only need a token, free balance monthly.
Frequently asked questions
Build your first scheme for free
Sign-up is free and needs no card. Every month the balance is topped up to $3.50 for free, enough for about 3,500 runs of basic blocks.
Build it in the builder