Creating Your First Flows

Creating Your First Flows

Create Your First Flow

In this guide we will start by creating a basic example Flow. It doesn't connect to any external system, the goal is just to get you familiarized with the concept of building and testing Flows. We will use an internal data source, aggregate some values and send the result to the internal MQTT broker.

In the next example we will connect to external systems and introduce more of the features offered by the Crosser solution.

A Flow consists of modules that are connected together to specify the sequence of operations to apply to your data. Data is represented by messages and each module will process messages as soon as they arrive, perform some action and typically produce a new or modified message on its output, which is then processed by the next module(s). A Flow starts with one or several input modules. These can be internal sources, like time triggers or data generators, but also connectors to external systems, such as APIs, databases and PLCs. Next you will have one or several modules to do something with the input messages. Finally you deliver the results to an output module, where the messages leave the Flow. A Flow operates like a pipeline, so multiple messages can be process simultaneously in different modules.
Each module needs to be configured for a specific use case. For input and output modules the main thing is to configure how to connect to the external systems. For analytics modules, that receives and process messages, there are two main categories of settings: 1) Which data to use? Messages typically structured objects with properties and values, so you need to tell the module which data to use as input and where to store the result in the output message. If you want to get a better understanding of messages and properties and how they relate to module settings a good starting point is the first session in the Fundamentals training course. 2) The second type of settings for analytics modules controls how the actual processing will be done on the selected data. For example, which mathematical expression to apply or setting limits in a range filter. For an overview of the analytics module, see this page.

Flows are created and managed in the Flow Studio. You access the Flow Studio using the button in the upper left corner of each page. Once you've built a Flow you can also open it in the editor from the Flows page. For an introduction to the Flow Studio, see here

Follow these steps to start creating your first Flow

  1. Open the Flow Studio using the "Flow Studio" button to the left in the top menu. You should now see an empty Flow.

  2. The starting point is the library of pre-built modules, available on the left side of the drawing canvas by clicking on the  button in the menu bar. There are three categories of modules:
    Input modules - Gets data from internal or external sources, such as time triggers, APIs and PLCs.
    Analytics modules - Process the data in some way, or specifies conditional triggers based on the data.
    Output modules - Delivers processed data or triggers to external systems.

  3. We will start by adding an internal data source to our Flow. Find the Data Generator module in the list and drag and drop in the main Flow page (you can use search to find a specific module). This module can be used to generate different types of test data.

  4. To change module setting, hover over the module with the mouse and click on the cogwheel () button to open the settings panel. 
    The settings panel has three tabs:
    Settings - Module specific settings.
    Common - Settings that are available on all modules. We leave them for now.
    Documentation - Documentation on the module and its settings.

  5. Now you need to add the relevant settings for the Data Generator. Scroll down to the JSON input field and click on "Add example". All other settings you can leave as they are for now.

  6. Now we will add the rest of the needed modules.
    First locate the Aggregate module in the Analytics modules list and drag and drop into the Flow.
    Connect the Data Generator module with the Aggregate module by dragging the connection from the Data Generator module to the Aggregate module.
    Now locate the MQTT Pub Broker module in the Output module list and drag and drop it to the right of the Aggregate module. Then connect the Aggregate module with the MQTT Pub Broker module.
    The Flow should now look like below:

  7. Module settings
    Now we need to add the relevant settings for the Aggregate module.
    Open the settings panel and make the following changes:
    Source Property - Should be name
    Value Property - Should be data.temp
    Target Property - Should be aggregate
    Mode - Should be set to Count
    Count - Should be set to 5

    For the MQTT Pub Broker module, set Topic to foo/bar and Source Property to aggregate.
    Note how the property settings determine how each module use message data.

  8. Now it is time to save your Flow.
    Click Save in the lower right corner to save the Flow. You will now be asked to provide a name for the Flow and a short description that describes what the Flow does. Click Create to store your new Flow.

Next step is to test your Flow, see .

Create Your Second Flow

In the next example we will use some external services. We start by polling a service that delivers random Chuck Norris quotes through a REST API. Then we extract the relevant data from the response and send it to a Slack channel.

Follow these steps to create the Flow


You’ll need the following to complete the tutorial:

  1. A webhook for the Slack channel is needed, read more on how to set it up here. If you don't want to use Slack, try some other notification module, like SMTP Send or Twilio. You can also skip this last step and still get valuable insights.

Building the Flow

  1. Create a new Flow in the Flow Studio

  2. Add an Interval module and set the interval to 0. This module generates repetitive triggers at the specified interval. By setting the interval to 0 and having "Run on start" set to true the module will trigger once when the Flow starts.

  3. Next we will make a request to the Chuck Norris service. The easiest way is to add the dedicated Chuck Norris GET Random Joke module. If you want to try a more generic approach you can also use the HTTP Request module and set the URL to In the next steps we assume you use the Chuck Norris module.

  4. At this stage it's a good idea to test what we've built so far, so we can see what the response from the Chuck Norris service looks like. Start a remote session, enable debugging on the Chuck Norris module and start your Flow. It can be hard to see the full response in the debug window. Use the menu on the message to open it in a separate pop-up window. As you will see you get a rather complex message from this module. The joke that we are interested in is nested in the hierarchy of the message. To reference the joke text we use the following syntax: cn_joke.body.value.

  5. Next we want to use the joke and create a message that we can send to our Slack channel. To do that we will add a Text Template module. With this module you can add generic text to your message and in the text reference data from the incoming messages. Any property references you put inside {} will be replaced by the corresponding value from the messages. Add the following settings:
    Target Property - Set to: data.text
    Template - Set to: Check out this joke: {cn_joke.body.value}

  6. Now run the Flow again but enable debugging on the Text Template module. Make sure you get the expected result on the data.text property.

  7. As the last step will will add an output module, in this case the Slack module. To use this module you need to create a webhook in your Slack account, see the link above for instructions.
    Make the following changes to the settings:
    Webhook URL - Set to the webhook you created
    Channel - Set to the name of the Slack channel where you want to publish your message
    Username - Set to your Slack username
    As you see there is a text field in the module settings where you can enter a message text. If you use this field the same message will be sent each time. In this case we want to use message text from the incoming messages. With this module all settings except the Source Property can come either from the settings or from the incoming message. If you leave a settings field blank the module will expect to find the information on the relevant property in the object assigned to the Source Property. In our case we wanted to take the message text from the message and therefore we assigned the text to the data.text property in the Text Template module and then set the Source Property in the Slack module to data. You can read more about this in the module documentation, by opening the Documentation panel from the module settings.

After completing this exercise you should have built a Flow similar to this:

    • Related Articles

    • New Flows page

      April 28, 2022 New Flows page with categories The Flows page has got a major overhaul with a new look and feel, improved usability and the addition of categories to help you organize your flows. You can now create your own hierarchical categories in ...
    • Test Your First Flow

      Test Your First Flow You now have a Flow and in most cases you want to first test your Flow before actually deploying it. This can be done by setting up an interactive session from within the Flow Studio editor. This will temporarily deploy your Flow ...
    • Messages, Modules and Flows

      The Crosser Edge node is a real-time engine designed to process Messages. A message can be pushed from an external source, such as a MQTT or HTTP client, or it can be pulled from the Edge node using connectors for different protocols/services. ...
    • Monitoring

      Introduction The Monitor section of the Control Center helps you keep track of the status of your deployed Flows and your Nodes. There are four sub-pages that serves different purposes: Overview - As the name suggests this page gives you an overview ...
    • The Flow Studio

      The Flow Studio If you are using Flows built with previous versions of the Flow Studio, please check the "Using Flows built with the old Flow Studio" section below. The Flow Studio is the design tool you use to build and test flows. This is a drag & ...