# Workflows
A Workflow creates a connection between a set of operations (each operation follows a particular flow) and defines the activation function.
For each workflow object, you will provide a match property that determines whether this is the workflow that needs to be executed at this time.
Each message that comes from RELE.AI, is being initialize with a workflow run.
To determine which workflow to run for each message, we use the Match attribute.
Match includes three properties: callback, input, weight and ignoreOnNext.
# Callback & Input
Callback and input are two parameters that are related to each other.
callback is used as the comparison method, and input is used as a value that are being compared to according to the comparison method.
Callback can be one of the following values:
match_any
exact_match
match_by_regex
match_by_opreation_key
contains
Using the contains
callback attribute as part of some example workflow configuration:
match:
callback: contains
input:
- /search
- /pesquisa
- /suche
- /recherchez
- /busca
When the message /search
is sent,
RELE.AI will recognize that there is a perfect match here because the message value contains one of the values in the input and a maximum rating will be given for this workflow.
Using the match_any
callback attribute as part of some example workflow configuration:
match:
callback: match_any
And this example incoming message with value of:
Some hello world message!
The rank function will give the value of each workflow.
Assume that in the given organization there was no workflow that found a match for the incoming message. In this case, the workflow defined as match any will serve as a fallback if there was no better match - and its execution will begin.
# Ignore on next attribute
ignore_on_next determines whether this workflow should not be rematched after it was executed once.
By default the flag is true
.
# Weight
The weight property allow you to prioritize one workflow over the other.
For example, suppose we want to define a workflow that ends a session for each incoming message with the value of /exit
, regardless of whether we are in the middle of another workflow run.
match:
callback: contains
weigth: 2
input:
- /exit
- /salida
- /sortie
- /ausfahrt
- /saída
In this case, even though you are running a different workflow, the message will throw you into this specific workflow.
NOTE
If the weight value is not provided, the default value for it is 1, so the weights of the rank function will not be affected.
# Creating a Workflow
The following is a full example of an Workflow config. It creates a simple "Hello World" workflow within RELE.AI.
# define the type of the configuration
type: Workflow
# define the match operation
match:
# define the matching method compare
# to the incoming message value
callback: contains
# list of matching options
input:
- /exit
- /salida
- /sortie
- /ausfahrt
- /saída
# define weigth for incoming message
weight: 2
# define the display name
display_name:
en: Drop Session
# the app identifier
key: hello-world
# Attribtues
Attribute Name | Type | Description |
---|---|---|
type | string | Define the configurations type. Full list of support types can be found here |
match | Match | Define the match options for specific workflow. |
display_name | DisplayName | The workflow's display name. |
key | string | A config identifier - must includes only a-b or 0-9 or _ |