This article will take you through step by step to create your first simple work flow using our 'Person might speak language' Knowledge Map. 

The Knowledge Map referenced can be found in the following article with a downloadable .rbird file

The components used will be: 

It may also be useful to familiarise yourself with the JSON path & Rainbird Responses article

The finished flow will look like this: 

End to End flow
End to End flow

Steps to build

Step 1: Create a new flow

Step 2: The first component is a Control - OnStart. This is a simple trigger that allows you to manually start the flow without further trigger requirements.

Step 3: Create a Rainbird - Start component and connect the 'out' port of the OnStart to the 'in' port of the Rainbird Start. This will allow you to start a session against a Rainbird Knowledge Map. 

Step 4: Next you will need to select the environment or 'Base URL' where your model is hosted, your Accounts API Key and the Knowledge Map ID for the relevant model. Your API Key is found in the Rainbird Studio under your Account Details and the KMID is found by clicking on the Knowledge Map name in the studio and selecting 'View Knowledge Map ID'.

Step 5: Create a Storage - Get component and connect the Rainbird - Start 'out' port to the Storage - Get 'in' port. Storage allows you to have data stored and accessible to your flows. You can create separate storages in Rainbird however everybody starts with a Default Storage. 

For this flow you will need to add some data to our storage that you can then inject into your model. The data will need to look like this for ease of following this guide:

Data in the Rainbird Storage
Data in the Rainbird Storage

When configuring the Storage - Get component simply select the default store and enter the 'Key' to match the data entered. In this case the key is 'livesIn'. 

Step 6: Add a Rainbird - Inject component and connect the Storage - Get 'out' port to the Rainbird - Inject 'in' port. The Rainbird - Inject component has 3 requirements: 

  1. The Base URL which can be selected from the menu to the right of the field
  2. The Session ID, this is also selectable a from the menu as an output of the Rainbird - Start Component
  3. The data. You create the required Triple (Subject, Relationship, Object) using CSV (comma separated values). For this flow you are going to inject a fact on the relationship 'lives in' which needs to match the relationship in the Knowledge Map exactly. You can chose any subject, in the example below I have chosen 'Dave'. The object is coming from the value we got from the Storage - Get component.
The inject component with a triple formed as CSV
The inject component with a triple formed as CSV

Step 6: Add a Rainbird - Query component and connect the Rainbird - Inject 'out' port to the Rainbird - Query 'in' port. This is how you query the Knowledge Map. 

You will again require the Base URL and the Session ID (see Step 5). This time our triple is broken into 3 fields (Subject, Relationship, Object). 

Subject: The Subject that matches the inject above, in my case 'Dave'. 

Relationship:  'might speak' - again this must match the Knowledge Map exactly. 

Object: This remains blank for this example as it is what we are asking Rainbird to find out. 

The query component
The query component

Step 7: Add a Storage - Set component and connect the Rainbird - Query 'out' port to the Storage - Set 'in' port. This will take the result from Rainbird and set/store it in our Rainbird Storage. 

Choose the storage area required and Key to store it against. In my case, i'm using the default storage and i've set my Key to 'SpeaksResult'. 

Next you need to tell the flow where to get the result from to assign as the Value. To do this you can select from menu on the right again, the variable you are looking for comes from the query component and is called 'Query: Results'. 

Once selected as a variable you can then refine this further by using the JSON path as so: 

  1. Click on the Query: Result variable to open a panel called 'Variable Modifier'.
  2. Choose the JSON Path modifier
  3. Set the path to [0].object (for more details see the Rainbird & JSON Path article)

This will return only the most certain Language name (the one at position 0 in the array) rather than the whole JSON API response. 

Step 8: Start your flow! 

As we are using the OnStart component the flow will start once you click the start flow button. After a few moments you should see a new Key and Value appear in your chosen storage with the Language the person might speak. 

Remember: this is an unattended model, so if you provide a country that the model doesn't know about Rainbird may want to ask a question and this won't work with this flow. The countries available in the model are: England, France and Switzerland.

 

Continue with Workflow Hello World - Downloadable Model  ➡️