Command Set

This feature allows you to assign dynamic values to nodes based on data from the automation process. Use the {{}} symbol and expand it with information that corresponds to each specific data type.

Name
Details
Variables

table

Extracting Data from a Table.

table.columnName

variables

Extracting Data from a Variable.

variables.variableName

loopData

Extracting Data Within a Node Loop.

loopData.loopId

globalData

Extracting General Data from a Scenario.

globalData

prevBlockData

Extracting Values from the Previous Block.

prevBlockData

googleSheets

Extracting Data from Google Sheets.

googleSheets.referenceKey

spreadSheets

Extracting Data from a Spreadsheet.

spreadSheets.referenceKey

When defining a set of instructions, you must follow the format {{keyword}} and replace the word keyword with the specified source of information. This allows the automation to distinguish between static and dynamic data.

Suppose you have a variable named listname in the process, and its value is an array of objects. You want to send this variable to the API using an HTTP request .

[ 
    { "name": "Telegram", "url": "https://telegram.org/" },
    { "name": "X", "url": "https://twitter.com/" }, 
    { "name": "Etsy", "url": "https://www.etsy.com/" } 
]

You can use the following set of instructions within the content section of the HTTP Request node :

{{variables.listname}}

But what if you want to use the url property of the first element in the array as a value in the node?

To do this, you can use the following set of instructions :

{{variables.listname[0].url}}

In that set of instructions, 0 refers to the first element of the array. If you want to retrieve the second element of the array, replace it with 1, or use 2 when you want to retrieve the third element, and so on.

How to accessing other data within the set of instructions

To access other data within the set of instructions, you need to use square brackets ([]) to reference the data.

Example : When you want to multiply the value of the variable salary by 12 using the $multiply function :

{{$multiply([variables.salary],12)}}

Or, when you want to get the length of the bang1 array using the $getLength function:

{{$getLength[bang1]}}
Function

All predefined functions or operations always start with the $ prefix, such as :

$funcName(param)

And here is a reference list of functions available in Automation :

$date(date, dateFormat?)

To retrieve or format the date, this function has two parameters, with the second parameter being optional.

If you want to format the current date, you can pass dateFormat as the first parameter directly, like this :

{{$date('dd-MMMM-yyyy')}} And the result will be : 14-September-2023

You can view all available date formats on this page.

For the date parameter, you can refer to valid date formats from the MDN page.

Example :

{{$date("dd/MM/yyyy-hh:mm aaaa") }} // 01/10/2023-05:00 p.m
{{$date("dd/MM/yyyy-hh:mm aaaa") }} // 01/10/2023-11:00 a.m
{{$date("dd/MM/yyyy-hh:mm aaaa OOOO") }} // 01/10/2023-11:00 a.m
{{$date("timestamp")}} // 132424534

$rand(min?, max?)

This function generates a random number (including either an integer or a decimal) or creates a number within the range between the minimum min and maximum max parameters.

Example :

{{$rand()}} // 23
{{$rand()}} // 13.333333
{{$rand(0, 10)}} // 6
{{$rand(0, 10.4)}} // 2.24234234

$randint(min?, max?)

Generate a random integer or a number within the range between the minimum min and maximum max parameters.

Example :

{{$randint()}} // 23
{{$randint()}} // 13

{{$randint(0, 10)}} // 6
{{$randint(0, 10)}} // 2

$getLength(str)

Getting the length of a string or an array

Example :

// Getting the length of a string
{{$getLength("testing")}}  // 12
// Getting the length of an array (table)
{{$getLength([table])}}  // 4
// Getting the length of the "text" column in the second row
{{$getLength([table.1.text])}}  // 99

$getOTP(secret)​

This function accepts a parameter in the form of a string and generates an OTP (One-Time Password) from that string. Typically, this function is used when you need to generate an OTP for Two-Factor Authentication (2FA).

Example :

{{$getOTP("qwjke234ewrh3249wei")}} // 123456
// Getting an OTP from a variable with 2FA
// a=qwjke234ewrh3249wei
{{$getOTP([variables.a])}} //123456

$randData(text)​

A function for generating random data, where you simply pass a set of instructions as a parameter. For example, $randData("?l") will generate a random lowercase letter, such as a .

Supported Set of Instructions :

  • ?l : Lowercase letter

  • ?u : Uppercase letter

  • ?d : Number

  • ?f : Lowercase + Uppercase letters

  • ?s : Symbol

  • ?m : Uppercase letters + Number

  • ?n : Lowercase letters + Number

  • ?a : Any character

You can also combine them. Such as $randData("?u?l?l?l?l?d?d@gmail.com") This function will generate an email in the format : abc@gmail.com

Example :

{{$randData("?d?d")}}   // 11
{{$randData("?l?l?l?d?d@gmail.com")}}   // abc@gmail.com
{{$randData("?d?u?s?l?l?s?a?m")}}   // qe7Q@do*?sds

$randDate(minDate?, maxDate?, dateFormat?)​

This function generates a random date within the range of the minDate and maxDate parameters, formatted according to the specified dateFormat .

Example :

{{$date("2023-10-01", "2023-10-05", "DD MMMM YYYY")}}  // 3 October 2023
{{$date("2022-10-01", "2023-10-01", "DD MMMM YYYY")}}  // 13 December 2022

$randPick(data)​

This function selects a random element from the data array of the data variable. This function is commonly used when you pass an array into the function.

Example :

data =["a","b", "c"]
{{$randPick([variables.data])}} // b
Variable

Variables are stored in the form of an object, with the variable name serving as the key of that object.

{
   "url": "https://google.com",
   "numbers": [100, 500, 300, 200, 400]
}

Retrieving the value of a variable url: Instruction : {{ variables.url }} Result : https://google.com

Retrieving the value of a variable numbers: Instruction :{{ variables.numbers }} Result : [100, 500, 300, 200, 400]

Retrieving the value of a variable numbers: Instruction : {{ variables.numbers.0 }} Result : 100

JavaScript Expression

Automation also supports JavaScript in expressions. However, when writing JavaScript, you must add the !! symbol as the initial empty value in the node's text field.

Example : From that number, it is : {{variables.number}} To !! that number, it is : {{variables.number}} And you can also use the available functions just like JavaScript functions.

Example :

Using Available Functions :

{{$getLength(table)}} //11
{{$randData("?d?d")}} // 99

Retrieving the Last Row of a Table :

{{table[table.length - 1].columnName}}

Retrieving the Current Timestamp :

{{Date.now()}} //1666237704022

Accessing Loop Data and Index :

// Looping Through Loop Data
{{loopData.loopId.data}}
// Looping Through Index
{{loopData.loopId.$index}}

Last updated