JavaScript Function

UChat now allows its users to carry out complex flow logic using Javascript action. The users will be able to write javascript code to carry out various complex flows and formulae which are not natively supported by UChat yet.

Selecting Javascript Action Node

Create an Action node block, Click on Advanced Actions and select Javascript Function node.

Javascript Function Node

A javascript function acts exactly like a function. All parameters are first parsed into the javascript block before they can be used. The top part of the action is used for input.

Parameters Name: Add the name of the variable you are parsing

Parameters Value: Add the userfield you want to parse into the javascript function

Test Value: Add a testing value which can be used here to run tests

The function block supports multiple javascript-libraries.

These javascript libraries extent the functionality of the native function block.

 

In the function block, you can write your javascript code.

 

After writing the code, you will always have to return your value since the function block acts as a regular function.

 

Note: Native javascript methods such as console log that require a browser does not work with the Javascript Function node

 

You can map the results of your code to update certain user fields.

 

Note: When handling JSONs, all JSONs have to be first parsed and then be able to used inside the code.

Â