The JS node lets you add a small snippet of JavaScript code to your call flows to do things like processes tags and call information. The JS Node supports the ES5 version of JavaScript.
The JavaScript you include in a JS node lets you perform simple calculations and string manipulations. Unlike parsing JS parsing steps in ring tree targets, JS nodes in call flows are not functions, and do not require the code to return anything. Advanced JS functionality is not supported.
Note: The JS Node is included in your subscription, but is not available by default. Contact Ringba support to enable JS node for your Ringba account.
- Node Name: A label that appears at the top of the node with the selected name. This information helps you identify the node in call reporting.
- Script: The JS script to execute.
Example
Formatting the Date
In this example, the JS node changes the format of the date/time of the call from the original ISO format to UNIX timestamp.
You could add a JS node to your call flow after a Gather node to get the ISO value from the date tag, calculate the UNIX timestamp version, and send the new date/time value with the call.
var date = getTag('Date','ISODate');
var dateObject = new Date(date);
var epochTime = dateObject.getTime();
upsertTag('User','epoch',epochTime);