General applications
Operators
if
The 'if' operator controls conditional branching.
{
"if": {
"expression": "${myVar} == '1'",
"then": [],
"else": []
}
}
switch
The "switch" and "case" operators help manage complex conditional operations and branching operations.
{
"switch": {
"variable": "${getIvrDigit}",
"case": {
"1": [],
"2": [],
"3": [],
"default": []
}
}
}
while
The logic works the same as in programming languages. The first time applications in the [do] block are executed without condition checking. Subsequent times, they are executed only if the condition is true.
{
"while": {
"condition": "${myVar} < 10",
"maxSteps": "1000",
"do": [
{
"log": "log is ${myVar}"
},
{
"js": {
"data": "+${myVar} + 1",
"setVar": "myVar"
}
}
]
}
}
condition - the condition, written considering JavaScript syntax.
maxSteps - the global parameter controls the maximum number of steps within the block (done so that if, for example, a loop is called again from a 'goto' statement later in the schema, the schema does not get stuck in a loop). If not specified, the default value is 1000.
do – an array of applications that will be executed in a loop.
Triggers
disconnected
Executes a set of applications after the main script has finished. Declared once at the beginning of the script.
commands
Commands currently only affect all `recvMessage` in the schema. If a command is executed, then the `recvMessage` timeout is updated.
Functions
function
Combine a set of applications into a named function. Declared at the beginning of the script.
execute
Execution of a previously declared function by its name.
Variables
set
Assigning variables to a channel.
export
Exporting variables to the operator's side, as well as to the statistics.
unSet
Unsetting a variable.
Utility applications
calendar
The application allows checking the current time against the working calendar. The value is saved into a variable.
cache
The application allows working with data in memory or on a Redis server.
httpRequest
Performing an HTTP REST request and processing the result (get JSON)
js
Executing arbitrary JavaScript code with the return of the result into a variable.
math
An application for working with mathematical functions
fn
random
: returns a random number from arraymin
andmax
: can be used to find the lowest or highest value in a list of argumentsround
: rounds a number to the nearest integerceil
: rounds a number up to the nearest integerfloor
: rounds a number down to the nearest integer
string
An application for working with strings.
fn
length
: returns the length of a stringindexOf
andlastIndexOf
: returns the index of (the position of) the first or last occurrence of a specified text in a stringsearch
: searches a string for a specified value and returns the position of the matchslice
: extracts a part of a string and returns the extracted part in a new stringsubstring
: is similar to slice. The difference is thatsubstring
cannot accept negative indexes.substr
: is similar to slice. The difference is that the second parameter specifies the length of the extracted part.replace
: replaces a specified value with another value in a stringtoUpperCase
ortoLowerCase
: A string is converted to upper case or to lower casecharAt
: returns the character at a specified index (position) in a stringcharCodeAt
: returns the unicode of the character at a specified index in a stringsplit
: A string can be converted to an array with thesplit
functionreverse
: Reverse the provided stringbase64
: base64 encoder / decoderMD5
: Computes a digest from a string usingMD5
algorithmSHA-256
: Computes a digest from a string usingSHA-256
algorithmSHA-512
: Computes a digest from a string usingSHA-512
algorithm
markIVR
Allows saving an array of values into a variable, which will be accessible in the history.
topicExtraction
For determining the topic of the received message: a chat message, speech-to-text on IVR.
Where:
limit – optional, default is 4, these are the most recent messages from the chat or recognition during the call.
definedTopic – which variable to store the response (topic).
score – which variable to store the confidence score.
messages – used for all types except chat/call.
userInfo
The application allows retrieving a value from a user object based on the phone number.
setGrantee
Grant channel permissions to the user identified by the specified ID.
schema
Execute an external schema by its identifier.
softSleep
Pause script execution for the specified number of milliseconds.
sql
The application is available exclusively for dedicated or proprietary Webitel servers. It allows executing a query in the database and returning the result into a variable.
list
Checking for the presence of a subscriber in the list and performing actions.
listAdd
Add a subscriber to the list.
log
Output additional information to the log file of the applications.
goto
Jump to a named label.
monoPay
Jump to a named label.
Application parameters
The data of applications can be invoked both independently and as a parameter of another application.
tag
Set a named label in the script.
async
Executing an application without blocking.
break
Interrupts script execution.
limit
Allows interrupting the loop after passing the specified amount indicated in the 'max' attribute. Exiting is done to the named label specified in the 'failover' attribute.