Automation Basics

Learn how to format your automation and write in plain, natural English

Intro to Formatting Your Automations

No need to learn how to code or use drag-and-drop interfaces anymore. Kognitos allows you to write your automations in plain English!

When you are writing an automation, there is some basic grammar you need to follow in order to ensure your automation runs as intended. You'll notice this grammar should fall inline with how you would naturally write a statement in English, and we encourage you to first write it how you would normally communicate it, and give that a try first!

✌️

Remember Koncierge is there to help you build or troubleshoot!

If you are writing an automation, and are not sure what the next steps may look like OR you forgot what the grammar may look like for an action, you can use Koncierge to help you build more effectively!

Building Your Automation

When using Kognitos, we write our automations within the Playground. The playground has some nice suggestion features as well that will guide you when building the automation. As well, the playground visually helps you understand when steps are nested under another step by visually spacing out your automations.

Example of how the Playground formats your automation

Example of how the Playground formats your automation

Declaring Facts (Objects)

Kognitos allows you to declare objects so that you have a name to reference them by when you want to use them. Within Kognitos, we refer to these objects as Facts. Facts can we some text, a number, even an object like a document. Think of this as defining a variable if you are familiar with software development.

Share facts with Kognitos by just telling it, like so:

The fname is "Pink Floyd"

You can then check that Kognitos understands by asking:

The fname (-> responds with "Pink Floyd")

Facts can have adjectives to distinguish them from one another

The big fname is "Led Zeppelin"
The big fname (-> responds with "Led Zeppelin")
the green booking is 5.3
the small red booking is 4.3

Facts can be in list form

the coupon codes are "CVV", "COW23" and "SUM22"
John's email addresses are [email protected], [email protected] and [email protected]

Dates, numbers and strings are all supported as facts

John's age is 21
John's bank balance is $120.20
the interest rate is 1.25

the deadline is "16th Dec 2023"
the deadline is today

You can even declare a “variable/identifier” to act as a placeholder

imagine a VM
the VM's name is "Windows"

Using something as something else

use "01.01.2022" as the invoice's date
the invoice's date is "01.01.2022"
the invoice's date (-> responds with "01.01.2022")

In the above example, the first two statements are equivalent

Declaring the type of a thing

Salesforce is a CRM
Salesforce's user is [email protected]
A CRM is a database
all databases
the databases's users

Here, we declare two facts. The Kognitos brain understands based on the above that Salesforce is a database and will respond with Salesforce as an answer to all databases. Further, when asked to list all the users of all the databases, it will list [email protected] because Salesforce is a database.


Keywords When Writing an Automation

When writing your automation, there are certain keywords that you'll frequently utilize. If you feel like you are running into grammar issues for a phrase you feel should be expected, feel free to reach out to Kognitos directly at [email protected], or post your feedback in the Discussions section of the documentation.

Get Keyword

get is a word that signals to Kognitos that some input is needed or that we are retrieving a value from something.

get the document's fields
get the first line in the document

The Keyword

We use the quite often in Kognitos to convey a new object we will be working with. We continue using the to denote the words immediately after are an object that we are referencing.

get the document's fields as the fields

When we use the keyword the, Kognitos knows to expect an object we are going to work with.

Converting a thing to another form (as a Y)

get the file as a scanned document
the file is a scanned document
use the answer as a date

In the above examples the file is converted (or attempted to be converted to) a scanned document and the answer is converted to a date. The Kognitos brain knows how to convert between common types but can be easily taught to convert between new types.

Comparison facts

andy's age is 21
john's age is 22
jim's age is 20
the people are andy, john and jim

age is how old or how young something is

the youngest person out of the above
the oldest person out of the people

Kognitos knows how to compare some common types. However, if a custom comparison is needed to be taught, it can be done as above. In the above example it learned that it needs to look at the ageproperty of things to figure out if they are younger or older than each other.


Calculating

Kognitos can be used to calculate various amounts of information in a workflow. All you need to do is tell it what to calculate using plain english.

John's salary is 150000*1.2+1000
send "Your new salary is {John's salary}" to John

-1.3*((10*3)*2.1/3.4)^2.3
say the answer

Looping Through Data

When building an automation, you may run into a scenario where you want to repeat similar behavior for multiple items; we call that sequence of instructions a loop. So when you process each item in a set, we call that looping through a set.

Some examples of when we would need a loop are when we want to processes attachments in an email, convert the total amount for each line in a list of line items to a new currency, or loop through all the different names of recipients for an email. To process each item, we want to tell the automation "complete the following actions for each object".

To instruct the automation we are starting a loop, we follow the structure of using the keywords process and as follows.

The key phrase we would write in Kognitos to start a loop is:

process each XXXXX as follows

So we could write this as:

process each document as follows
process each file as follows
process each word as follows

Then once we have declared we are starting a loop, any instruction we would like our automation to follow for each item we are loping through, we would write underneath and indent each line.

For example:

process each document as follows
	get the document's invoice number
	get the document's fields

By indenting the lines after process each document as follows, Kognitos will know which instructions to follow for each item.

It is very important to remember to indent when looping through objects in your automation!

And again, in Playground, it will be formatted in a way to make it very clear which instructions relate to looping through the items:


Decision Logic

Your automations can also make decisions based on logic. The words ifthen, and else are important in commanding the automation how to make decisions in workflows. See examples in more detail below.

if then Logic

To write a decision point in your automation we use the format:

if CONDITION then
  TAKE THE ACTION

So for example:

if the number of team members < 10 then
	send "Let's have lunch outside!" to the team members

Here are some other examples of possible conditions:

if the name is bob then
  ...
if the employee's address contains "USA" then
  ...
if the amount * 1.2 > 5000 then
  ...
if the amount is the balance due then
  ...
if the employee's age >= 18 then
  ...
if the employees's age >= 18 then
  ...
if the loan amount > 100000, the maximum loan amount, or 1.2 * the bank balance then
  ...
if the loan amount < 200000 and the maximum loan amount then
  ...
if the loan amount and the bank balance < 20000 then
  ...
if the name is "mary" or "bob" then
  ...
if (the name is not "mary" or "bob") and (the address contains "USA") then
  ...
if the employee's address is unknown then
  ...
if the employee is angry then
  ...

if then else

If then statements allow you to say "if this condition is met, do this", using an else statement can increase your options when the automation is running. For example:

if the number of team members < 10 then
  send "Let's have lunch outside!" to the team members
else
  send "Meet you in the cafeteria!"

In this example, the automation reads "If the number of team members is less than 10, then send 'Let's have lunch outside'. But if the number of team members is 10 or more, send them 'Meet you in the cafeteria'". Else allows you to add a condition of what to do if the condition is NOT met.

Nesting if then Statements

More levels of business logic complexity can be handled:

if the partner is "partner a" then
  use 0.1 as the rate
else
  if the partner is "partner b" then
    use 0.2 as the rate
  else
    use 0.4 as the rate

Note that else is optional can be omitted if not needed.

👍

Just like with loops, remember to indent your actions following an if then statement

Stop and terminate

Sometimes, in a procedure you may want the automation to stop working on a specific item in the batch based off a condition. You can do that by simply saying stop.

if the partner is unknown then
  stop

If you want the computer to stop the entire automation and not just the specific item being processed in the batch,  use terminate.

if the partner is unknown then
  terminate