Welcome to Application flow

An application, also referred to as an application program or application software, is a computer software package that performs a specific function directly for an end user or, in some cases, for another application. An application can be self-contained or a group of programs. The program is a set of operations that runs the application for the user.

Application concept

Schilan bot platform defines application as finite state machine. Each bot custom application is list of Message - Answer pairs. The best analogy is Request - Response in HTTP protocol.

  • The Following Concepts Are Supported:
    • Variables
    • Branching
    • Functions
    • Web Hooks And API Calls
    • Regex Validation
    • Responsive Forms (Adaptive Cards)

MessageNode

MessageNode is equivalent to node in finite state machine. MessageNode defines bot activity and Call user to action. There are various MessageNode types.

  • MessageNode is defined by two attributes
    • How it will be presented (text, image, form or combination)
    • What is expected answer (closed options, text with predefined regex, form filling etc)

Concept

This is most common situation, when system ask question and expects feedback (option or free text) MessageNode text can be static (plain text) or dynamic (parsed as function result)

How to read description

Left image shows editor graph. The Image on right side shows a bot presentation.

GitHub Logo

### Response Depending on the answer you can set a response message. This response can be static (plain text) or dynamic (parsed as function result)

Text with image

To present image in combination with text message just set image url

GitHub Logo

CHOICE Type

Pure analogy for this concept is closed question in questionnaire. System expects predefined feedback. GitHub Logo

Hint for usage

Depending on bot channel this list can be presented with different style. Good UX practice is to keep limited number of options (2-5). In case of more options think about question redesign.

FREETEXT Type

Very often we need user input in free text form. We can setup regex rule for user input. If input does not match Regex message will be repeated. It is possible to validate input dynamically (based on some external system). GitHub Logo

Hint for REGEX

System offers few the most common regex on form. However you can write own regex by edit question JSON options.

APICALL Type

You can manage that Api call is called in background by setting API parameters.

GitHub Logo

Hint for API call

System offers few the most params (URL, METHOD, PARAMS). Good practices is to wrap external services with own api functions to avoid security pitfalls. However, if you need extra parameters in header it is possible by editing question JSON options. Good practice is to store api output in variable. To see more go to Advanced section.

ADAPTIVE_CARD Type

To achieve full application user experience check Adaptive cards . Schilan gives you opportunity to integrate Adaptive card by simple copy json code. Adaptive cards can be used for data presentation and data collection. Collected data are in json format and stored in variable. To see more go to Advanced section.

GitHub Logo

Hint for ADAPTIVE_CARD

Pay attention of adaptive card version. Adaptive card designer will show you last supported version for Microsoft bot framework.

Special option [JUSTGO]

After adaptive card execution or api call good practice is usage of predefined response [JUSTGO]. Bot engine will just proceed to next step.

To see more go to Advanced section.

Variables

In computer programming, a variable or scalar is an abstract storage location paired with an associated symbolic name, which contains some known or unknown quantity of information referred to as a value; or in simpler terms, a variable is a container for a particular set of bits or type of data. Schilan platform use variable to store data collected from user. Schilan variable's type is inferred by its value, and can change according to its value. In general all your variables are Json object. To simplify variable operations in schilan, there are three basic types. NUMBER, STRING, OBJECT.

Each MessageNode has own auto-generated GUID. Each MessageNode user interaction is saved in ${guid}. But this is not user friendly approach.

Friendly name

Each MessageNode can have friendly var name. Here is one example for MessageNode options:

{
    "txt":"^\\s*[a-zA-Z,\\s]+\\s*$",
    "api":null,
    "adaptive_card":null,
    "varName":"varVal1"
}

This code block is used for MessageNode type FREETEXT with given Regex ^\\s*[a-zA-Z,\\s]+\\s*$ and variable varVal1. To access to this value use ${@varVal1}

Friendly name

Pay attention! Friendly name has to be unique in Bot scope!.

If variable is loaded with json data (typical for adaptive cards forms) , use dot notation to get value

    ${@varName.data}

Math notation

Friendly name are much better than the ugly guid code. But, Schilan give you additional UX with Math notation of variable. You can just put {x} in MessageNode and use it in your formula. Important, {x} can live only in current MessageNode This is common situation for making immediate branching or validation condition.

Check this image:

GitHub Logo

MessageNode asks user to enter to rate REACT knowledge. This is free text and user must enter number. Depending on the entered value a different branch will be activated.

    {x}==5 // React knowledge is perfect, go and ask him some Ego check questions
    {x}>5 // This is not correct, show response and ask again
    {x}>=1 && {x}<=4 //This is common situation go to next question

Math notation is awesome. So natural for writing conditions.

Conditions

Conditions are statements that are created by the programmer which evaluates actions in the program and evaluates if it's true or false. If-then-else statement allows conditional execution based on the evaluation of an expression

  • In Schilan, conditions are TRUE or FALSE expressions interpreted and evaluated as expression in C#.

    • Common use is after text input
    • Can be complex
    • Can be converted as string
    • Can use schilan functions
    • Can be used in string functions

Examples

    {x}>5 //Logic check after input

    {Math.Round({x})<60 && ${@varName.SeniorDeveloper}  // This is complex expression with more than one variable

    "{x}".Length>0 // If x is represented as string. 

    RANDOM()>{x}  // Using function in expression

    "|red|green|blue|".Contains("|{x}|") // Correct string function. 

Expression precedence

In case of logical overlapping first TRUE condition will be resolved. For example {x}>10, {x}>7. If user enter a number 11, upper order executes first.

Note

Good practice is to create mutually exclusive conditions. Otherwise, be careful with order.

GitHub Logo

Use mouse to drag options and set order.

Functions

Functions are "self contained" modules of code that accomplish a specific task. Functions usually "take in" data, process it, and "return" a result. Once a function is written, it can be used over and over and over again. Functions can be "called" from the inside of other functions.

Predefined functions

Textblock starts with @@. It is directive to perform function evaluation in text body Currently supported functions "MIN", "MAX", "SUM", "LEN", "RANDOM", "COALESCE", "IIF", "APIGET", "PICKONE", "SYS"

Interpretation directive @@

Use @@ at the beginning of the text to tell schilan to do proper interpretation.

Check image:

GitHub Logo

MessageNode with function started with @@

This directive can be placed in option field also.

Here is example:

GitHub Logo

Value in a yellow bubble is interpreted by calling the function. Function use parameter {x} . Powerful.

MIN

MIN(arg1;arg2;...) Returns Minimum

    MIN(1;3;5;${@varName}) 

MAX

MAX(arg1;arg2;...) Returns Maximum

    MAX(1;3;5;${@varName}) 

SUM

SUM(arg1;arg2;...) Returns SUM

    SUM(1;3;5;${@varName}) 

LEN

LEN(arg1) Returns length

    LEN(${@varName}) 

RANDOM

RANDOM() Returns random number between 0 and 100

    RANDOM() 

COALESCE

COALESCE(arg1;arg2;...) Returns first non empty value in string

    COALESCE(${@var1};${@var2};no entry) 

IIF

IIF(condition;argT;argF) Returns second or third argument depending on condition

    IIF(${@varNam1}>10; true statement; false statement)

APIGET

APIGET(apiUrl;apiData) Returns API GET method output

    APIGET(https://schilan.com/API/Values/1;1)

PICKONE

PICKONE(arg1;arg2;...) Randomly select one argument from list

    PICKONE(welldone; very nice; perfect; )

SYS

SYS(|DotNet static expression|) Return value generated by dotNet expression

SYS function is special function which calls static functions from dotNet framework.

SYS(|Math.Round(Math.PI,2)|)  //Return 3.14

SYS(|DateTime.Now.AddYears(1).Year|) //Return next year number

Warning

Be careful with this function. We recommend to use it only for simple .net commands. For complex functions external function called by APIGET function is better solution. To see more go to Advanced section.

More about functions

Function nesting is supported. Check examples

Example Return
MAX(1;2;MAX(1;9);4;MIN(6;MIN(7;MAX(3;12));8);0) 9
IIF(MAX(7;MIN(9;12))==9;IIF(12>1;super;bad);very bad) super
IIF(SYS(|Math.Round(Math.PI,2)|)==3.14;MAX(1,2);error) 2

Syntax constraints

Some characters are reserved due to fact that function parser use it for interpretation. Reserved words in programming languages are good analogy for it. Escape character for “ has to be \” Semicolon is reserved for delimiter Brackets are reserved for Functions

Warning

We have to use a replacement only if the message starts with @@

Symbol Replacement string
( asci_050
) asci_051
; asci_059

Here is one example:

    @@
    IIF({x}>5; __asci_050__nice__asci_051__ ; bad__asci_059__  ) //If x>5 returns (nice) else return bad;

Note

Message is interpreted in a typical script manner. Do not expect rich debugging options. Instead, check advanced section to get best practice and avoid errors

Advanced

It this section we will create some typical application scenarios. There's more than one way to do it (TMTOWTDI or TIMTOWTDI, pronounced Tim Toady) is a famous programming motto. We will explain all schilan concepts during developing application. Our demo application is part of playground. try it on this link

Bot definition

GitHub Logo