Routine Builder
Overview
The Routine Builder is used to build routines in Workflows, Bots, Schedules, and SLAs. This section explains how to build a routine within the mentioned processes.
Routines are used to configure various actions within a company. For example, you can automate the sending of an email or a message, create a task, or change a workflow from one state to another.
Check out the list of automations that you can include in your routines.
Test your routines with the automation log.
Routine builder in settings panels:

Routine builder in workflows:

The settings panel shows a visualization of the routine that has been created. A routine is built by a set of stages or steps that can function in different ways according to the chosen type. In general, stage types can do the following:
- help with configuration
- make decisions based on context
- network request
- interact with the user
- edit workflow components
- update workflow components
Routine Setup
Below you will find the description and notes for each field in the Routine Builder's settings panel.
Field | Description | Notes |
---|---|---|
Initial State | Select the stage that initializes the routine. | The list shows the stages that have been created so far in this particular routine. You can fill in this field after you have added the stage or stages. |
Max Iterations | Specifies the maximum number of stages the routine can go through. | Make sure looping stages are taken into account when specifying the maximum number of iterations. |
Add Stage | Adds a stage to the routine. | The code and stage type must be specified. After that, the settings for the selected stage type will be displayed. |
Code | Stage identification name | This field only allows lowercase letters, underscores and should always start with a letter. |
Type | Select the stage type. | The dropdown menu lists all the available stage types. Hover over the name for a brief explanation. Click here for more information. |
Version | Select the stage type version. | Available versions will appear in the dropdown menu. For more information, click here. |
Stage Type Configuration
After selecting + Add Stage, choose among the various stage types that are made available and configure them for use within the routine.
The Type field has a dropdown menu with a list of all the available stage types. If you hover over the name, a brief explanation of the function will be displayed.
Once the type is selected, its specific settings fields will be displayed (an example is displayed below).
- Go to the Routine Stage Types section for a complete list and description of stage types.
- On the backend, stage types use COTLang (Cotalker Script Language) for settings fields. Depending on your needs, you can input any text characters and even use HTML or COTLang on the various settings fields.
Variables declared within a stage routine are always read by the system as strings.
Therefore, if you are to use a function in relation to a variable, such as to cast a number as an integer, that function must be used when the variable is being used, and not when the variable is being declared or defined.
For example:
The function[cast=>parseInt]
should not be used when declaring the variable as shown below:{
"key" : "lastStock",
"value" : "$CODE#property#qty|[cast=>parseInt]"
},
{
"key" : "actualStock",
"value" : "$VAR#lastStock|[math=>add=($VALUE#qty)]"
},But should rather be used when the variable is used, as shown below:
{
"key" : "lastStock",
"value" : "$CODE#property#qty"
},
{
"key" : "actualStock",
"value" : "(($VAR#lastStock)|[cast=>parseInt])|[math=>add=($VALUE#qty)]"
},
Since stage type fields have a COTLang underlying, certain characters must be escaped within all stage settings fields (except the source code in the Custom Javascript Code stage type).
- If the text input is wrapped in triple backticks
```
, only`
need to be escaped using a backslash. For example:\`
. - Otherwise,
= | ( ) [ ] #
must be escaped. Example:\=
Stage Type Example
For example, if you choose the Send gif stage type, the following fields appear:

- Options: In this example, the Send gif stage type has three options or fields: Search, Channel, and User.
- Required Fields: The required fields are outlined by a red box (Search and Channel).
- General Field Description: The field highlighted in red has its name at the top left (in this case: "CHANNEL"). Next to it, you can find the field's specifications ("REQUIRED") and the input type (COTCHANNELID). In italic letters, at the bottom of the box, is the explanation of the expected input ("ID OF THE CHANNEL TO WHICH THE GIF WILL BE SENT").
Run Routine

The Run Routine button is a blue button found in the Routine Builder. This button opens up an automation log that will help you test and debug your routines while still building them.
To learn more about the log information shown in Run Routine, please refer to Automation Log.
Run Routine is not a "playground" or "sandbox". The routine will actually execute all the steps. So, for example, if you program the routine to send an email, it will really send the email. You can insert mock data into the Context editor to avoid mishaps.
Best Practices
Routines associated with state changes.
A task can change from one state to another through different means, e.g., a state start form, a survey trigger, the task view, a routine-stage bot, the action button, or an API request. If a routine is to be associated with the state change, it is highly recommended to add the routine in the State Change and not through other means, like a survey or a routine-stage bot.