---
title: Integrating Waylay with the Blues Notehub
description: Learn more about Waylay and how to integrate it within your IoT solution.
source_url: https://dev.blues.io/blog/waylay-integration-blues-notehub/
canonical_url: https://dev.blues.io/blog/waylay-integration-blues-notehub/
markdown_url: https://dev.blues.io/blog/waylay-integration-blues-notehub.md
---

# Integrating Waylay with the Blues Notehub

![Integrating Waylay with the Blues Notehub banner](https://dev.blues.io/images/blog/posts/waylay-integration/banner.png?v=6d4cb3db)

July 12, 2023

## Learn more about Waylay and how to integrate it within your IoT solution.

- [Data Routing](https://dev.blues.io/blog/tag/data-routing)
- [Cloud](https://dev.blues.io/blog/tag/cloud)

[![Pradeep](https://dev.blues.io/images/blog/authors/pradeep.jpg?v=e589f9e0)](https://dev.blues.io/blog/author/pradeep/)

[PradeepVLSI Chip Testing Engineer](https://dev.blues.io/blog/author/pradeep/)

I'd like to introduce you to [Waylay](https://www.waylay.io/), an external data routing service that makes "things" smarter than ever.

![waylay](https://dev.blues.io/images/blog/posts/waylay-integration/waylay.png?v=14692588)

Data sharing and visualization are critical components of the IoT. The [Blues Notecard](https://blues.com/products/notecard/) is a great option for sending data via cellular directly to [Notehub](https://notehub.io/), which is a secure cloud service from Blues. The Blues Notehub allows for [routing of Notecard data](https://dev.blues.io/notehub/notehub-walkthrough.md#routing-data-with-notehub) to external systems:

![notehub routing options](https://dev.blues.io/images/blog/posts/waylay-integration/routing.png?v=f3524f1f)

> **Note:**
>
> Use this [tutorial](https://dev.blues.io/guides-and-tutorials/routing-data-to-cloud.md) to learn more about Notehub data routing.

While we can get the data from Notehub via routes, the data is raw, so we need a broker to visualize it. Depending on the provider, we can visualize the data in many different ways. [Waylay](https://www.waylay.io/) is an option that is a bit different from other providers.

## What is Waylay?

Waylay is a simple IoT automator that can get data from a physical device or software connectors, and it can help us to visualize data feeds.

![waylay integration](https://dev.blues.io/images/blog/posts/waylay-integration/waylay-integration.gif?v=47f5b98a)

While it's similar to other IoT platforms, in Waylay we have access to additional features. Here is a simple walkthrough:

- [**Data Connector**](https://docs-io.waylay.io/#/features/data_ingestion/)**:** A data connector defines where the IoT data comes from. Using Waylay, you can get data from many different endpoints, including sensors, software systems, and other devices.
- [**Automation Editor**](https://docs-io.waylay.io/#/features/rules/)**:** This allows us to create our action trigger system based on incoming data.
- [**Waylay Storage**](https://docs-io.waylay.io/#/features/storage/): Waylay comes with a built-in data storage unit. Your data can be saved directly into Waylay's storage bucket.
- [**BYOML**](https://docs-io.waylay.io/#/features/byoml/) (**B**ring **Y**our **M**ode**L**)**:** This feature allows you to run Machine Learning or other data science models within the Waylay platform.
- [**Waylay Dashboard**](https://dashboard-io.waylay.io/): The Waylay Dashboard provides a clean and simple UI to display real-time data through a set of widgets.

![waylay features](https://dev.blues.io/images/blog/posts/waylay-integration/waylay-features.png?v=8baf0ae0)

Let's look at how we can integrate Waylay with the Blues Notehub.

## Connect Notehub to Waylay

[Create a new user account on Waylay](https://login-io.waylay.io/sign-up). Then we have to associate **Data Resources** with a particular customer name (customer name is metadata here, which helps us to develop a dashboard).

![waylay account](https://dev.blues.io/images/blog/posts/waylay-integration/waylay-account.png?v=6ea93519)

Next, we'll add [Webscripts](https://www.waylay.io/articles/feature-release-waylay-webscripts) that access our Notehub through an http/https endpoint for data. Add a new **Webscript** by selecting it from the main menu. Add the following code to the body, giving it the name "Get-Note":

```js
async function handleRequest (req, res) {
  if (!req. body) {
    // No body found
    return
  }

  // Parse body if needed
  let payload = req.body
  if (typeof payload === 'string' || payload instanceof String)
    payload = JSON.parse(payload)

  /*
  You can do some processing of the payload over here.
  */

  // Post values to our resource 
  waylay.data.baseUrl = 'https://data-io.waylay.io'
  await waylay.data.postSeries('replace_with_resource_id', payload, { store: true, forward: true })
    .catch(e => console.error(e.message))

  res.sendStatus(200)
}
```

This block of code will receive a routed event from Notehub.

![waylay event](https://dev.blues.io/images/blog/posts/waylay-integration/waylay-event.png?v=69c2c221)

Copy and paste that Webscript's URL into a new Notehub "General HTTP/HTTPS Request/Response" route:

![waylay notehub route](https://dev.blues.io/images/blog/posts/waylay-integration/notehub-route-https.png?v=52f013cd)

Now, let's simulate sending some Notecard data from the [Notecard Simulator](https://dev.blues.io/terminal/):

![notecard simulator](https://dev.blues.io/images/blog/posts/waylay-integration/notecard-simulator.png?v=2f2b6b65)

Now, keep an eye on the data log from Waylay's resource page:

![waylay log](https://dev.blues.io/images/blog/posts/waylay-integration/waylay-log.png?v=fe020e54)

## Implementing a Rules Engine in Waylay

The [Waylay Rules Engine](https://www.waylay.io/publications/the-waylay-rules-engine) is made up of many plugs (e.g. sensors or actuators) and the inference engine:

- **Sensors**: Software-defined sensors can collect data from both physical sensors and databases or APIs.
- **Actuators**: Software-defined actuators that can perform a variety of tasks such as sending messages, emails, and so on.
- **Inference Engine**: When a sensor is executed, the Rules Engine infers the outcome, which might lead to the invocation of other sensors or actuators.

The following is an example rule engine template. Depending on your application, you can add as many as you desire.

![waylay rules engine](https://dev.blues.io/images/blog/posts/waylay-integration/waylay-rules-engine.png?v=af81bdf6)

To add a new rule and trigger condition, navigate to the **Templates** area in your user console and click the **Add Template** button. Alarms are a handy tool that allows you to examine or monitor abnormalities and alerts based on data.

To create a **basic alarm flow**, we will be adding the necessary blocks from the blocks menu and then configure them.

1. Add a **Stream** block, uncheck *execute on tick* and check to *execute on data*, then select your resource of choice.

2. Add a **Condition** block, uncheck *execute on tick* and check to *execute on data*, then select your resource of choice. In the condition field, write up the condition in the following format

   ```unknown
   ${nodes.stream_1.rawData.stream.replace_metric}
   ```

3. Add an alarm block and insert a trigger condition as you want. Our condition looks like this:

   ```unknown
   ${nodes.stream_1.rawData.stream.temp}  > 30
   ```

4. Then select the alarm type (CRITICAL, MAJOR, MINOR, or WARNING), and create an alarm type. When you debug, it will display the live data flow.

   ![waylay alarm](https://dev.blues.io/images/blog/posts/waylay-integration/waylay-alarm.png?v=dbca0cfa)

   Consult the [Waylay documentation](https://docs-io.waylay.io/#/features/rules/) for additional information.

5. Once your Notehub data is in the Waylay log, go to the **Task** window and create a new task using the templates you just generated.

   ![waylay task](https://dev.blues.io/images/blog/posts/waylay-integration/waylay-task.png?v=f6580646)

6. The next step is to design some charts to display the data. Go to the **explore** window and add some charts.

   ![waylay charts](https://dev.blues.io/images/blog/posts/waylay-integration/waylay-charts.png?v=a945d865)

Now that we have a visual display in our console, let's build a dashboard for an even better view of data.

## Creating a Waylay Dashboard

1. Head to the [Waylay Dashboard](https://dashboard-io.waylay.io/) and log in.

2. Start a new organization by clicking the plus symbol `(+)`. When creating your Resource, you must have used the same customer name as the name of the company.

   ![waylay organization](https://dev.blues.io/images/blog/posts/waylay-integration/waylay-org.png?v=384b0014)

3. Create a new application dashboard by selecting **log in as admin**. Then, by clicking the Plus icon, make a new dashboard and user group.

   ![waylay dashboard and group](https://dev.blues.io/images/blog/posts/waylay-integration/waylay-group.png?v=c502b932)

4. Next, navigate to the **Config** page and add a new device (select the correct device resource). Click the **Add Device** button.

   ![waylay add device](https://dev.blues.io/images/blog/posts/waylay-integration/waylay-add-device.png?v=cb1efe4f)

5. After adding the device, enter the **Graph** window and create various gauges and charts based on your data requirements.

   Choose the widget type, add information, and then pick the widget attributes by clicking the Plus icon.

   ![waylay widget](https://dev.blues.io/images/blog/posts/waylay-integration/waylay-widget.png?v=ffaec49c)

Waylay also allows you to share your dashboards using the **public dashboard** function. It allows you to easily share Notecard data with others.

*Here is my example public dashboard:*

![waylay public dashboard](https://dev.blues.io/images/blog/posts/waylay-integration/waylay-public-dashboard.png?v=0e21deed)

## Conclusion

Data sharing and visualization are dominating the IoT and Waylay provides several unique capabilities and options for improved data routing. We can take [Cellular IoT with Blues](https://dev.blues.io/cellular-iot/) to the next level with the assistance of Waylay.
