, ,

thethings.iO IoT Blinders Retailer Manager

If you sell your digital product via distributors and retailers, thethings.iO’s Blinders are for you. The Blinders tool provides privacy and security to your retailers and suppliers and all their network of sub-retailers. Let’s learn more!

What is thethings.iO Blinders?

Imagine you are a thethings.iO customer with smart lightbulbs you wish to sell to retailers such as Walmart and Amazon. You sell 1 million lightbulbs to Walmart and Amazon. People then buy them and set them up with your app, giving you their email.

Now, when you will sell another product in the future, you will not need your retailers any more probably. You will sell directly to the customers through their emails and with marketing campaigns tailored to the clients of your current solutions.

This is obviously a problem for your retailers, who just lost customers, a lot. Most likely, your retailers would have realized this could happen and never would have made a deal with you in the first place. That means you never would have had any business to begin with either. So now what? How can you ensure privacy and security for your retailers? 

At thethings.iO, we have created a tool to solve this problem: the Blinders Retailer Manager. This tool “closes the blinds on you” to protect the retailer’s customers’ information and also lets you give the retailers a dashboard for them to manage your products. The Blinders tool also allows retailers to have a network of sub-retailers, each with their own dashboard.

For example:

Now imagine you are Amazon. You have two branches, Amazon US and Amazon Europe. You have 50 products, 25 for each location, but you want Amazon US to see their only 25 and Amazon Europe to see their only 25. With thethings.iO’s 

Blinders, you can make them each their own separate login where they can only see their products.  Now, you are Amazon Europe and you want to give 10 products to Spain for only them to view. You can do the same thing, creating a tree like this one:

The thethings.iO Blinders solution for retailers is a very complete solution to empower your retailers and partners with a top-notch IoT solution.

Do you want to try it? Just contact us at hello at thethings.iO.

, ,

Using Geofencing with thethings.iO

What is geofencing?

Geofencing is a technology that allows you to create geographical boundaries and set up triggers based on location information.

For example, you could send a message to someone when a “thing” has entered or left a specific area defined by your geofence.

Some of the great uses of geofencing include location tracking, monitoring assets, alerts when assets enter/leave, monitoring turnaround time, and more!

Setting up geofences with thething.iO’s IoT platform

Creating geofences

To create a geofence, go to “things” in the sidebar, then click on details next to one of your products (it does not matter what product, the geofence made under one will show up under the others). Then scroll down to the bottom of the page and (1)click the tab “Geofencing.”

Once there, you can (2)click either the polygon or the square to draw your geofence. If you choose polygon, remember to click the first point again to close the shape.

(3)If you select one of the shapes you have already drawn, you have the option to “update geofence” or “delete geofencing”.

(4)You also have the option to change the look of the map to best suit your needs.

When you are finished drawing your geofence, you will be prompted to give it a Name and Tag. You can make the Name whatever you choose, but make sure the Tag is “geo_” followed by the location. For example, “geo_barcelona” (This format will make execution easier later).

Putting tags on a “thing”

Now that you have a geofence, you will want to tag some of your “things” to that geofence. To do this, click back over to the (1)“things” tab, and (2)click details next to one of your things.

Next, click “+Add Tag”. Give this tag the same tag name as you gave to the geofence. For example, I will give this tag the name “geo_barcelona”, to tie this “thing” to my Barcelona geofence.


Making your geofences execute a Job

In order to use your new geofences, you will want to create a Job. Jobs are Javascript code that can be executed once every hour or once a day depending on what you set their Frequency to.

Creating a new Job

To create a new Job, go to “Cloud Code” in the sidebar, then find the section that says “Jobs” and click the “add job” button in the upper right. Give it a name, assign it to the correct product and set its frequency. Now, let’s talk about the code.

Understanding this Job

Here, I have provided an example and explanation of what your Job could look like to get your geofences working.

Overview: This Job goes through all of your “things” under a product and compares their “geo_” tags to the geofences you have made to check if your “thing” is inside/outside one or more geofences. If it is inside/outside one or more geofences, it will send an email to you saying what geofences your thing is inside/outside and it will update any widgets that are using the “alert_inside-outside” resource we will talk about later.

This Job has four functions: job, getGeofences, checkPosition, and checkInsiders.

job: Makes all your “things” under this product available to work with in the rest of the helper functions and calls the helper functions

getGeofences: Makes your geofences avaliable to work with

checkPosition: First, checks to see if a “thing’s” tag matches any of the geofences’ tags. For every match, it checks to see if the “thing” is inside/outisde that geofence. If so, it writes that to the geofencesInside/geofencesOutiside array, respectivaly. It does this for every “thing” under this product.

checkInsidersOutsiders: checks to see if a thing is inside/outside a geofence using the geofencesInside and geofencesOutside arrays you just created. If so, creates a resource that says what geofences the “thing” is inside/outside, and creates a strings of all the geofences a thing is inside/outside and sends this string in an email. It does this for every “thing” under this product.


function job(params, callback)
 ], function(err, res) {
    if (err) return callback(err);
    callback(null, res);

function getGeofences(things, callback)
 async.eachLimit(things, 10, (thing, next) => {
    thethingsAPI.getGeofences(thing.thingToken, (err, geofences) => { 
       if(err) return next();
       thing.geofences = geofences;
 }, (err) => {
 callback(null, things);

function checkPosition(things, callback)
 console.log("======== CHECK POSITION =========");

 async.eachLimit(things, 10, (thing, next) => { 
    thing.geofencesInside = [];
    thing.geofencesOutside = [];

    if(!thing.hasOwnProperty('tags') || !thing.hasOwnProperty('geofences')) return next(); 
    if(!thing.description.hasOwnProperty('geo')) return next(); 
    for(let i=0; i<thing.tags.length; i++){ 
       if(thing.tags[i]._id.startsWith("geo_")) { 
          for(let j=0; j<thing.geofences.length; j++){ 
             if(thing.tags[i]._id === thing.geofences[j].tag.toLowerCase()){ 
                if(geolib.isPointInside({latitude: thing.description.geo.lat, longitude: thing.description.geo.long}, thing.geofences[j].points)){ 
                   console.log("INSIDE --> "+thing.geofences[j]);
                   console.log("OUTSIDE --> "+thing.geofences[j]);

 }, (err) => {
 callback(null, things);

function checkInsidersOutsiders(things, callback)
 let resultInside = [];
 let resultOutside = [];

 console.log("##### CHECK INSIDERS & OUTSIDERS #####");
 async.eachLimit(things, 10, (thing, next) => {

    if (thing.geofencesInside.length > 0)
    console.log("this thing is inside of a geofence");
       var txt_geofenceInside = "";
       for (let i=0; i<thing.geofencesInside.length; i++){
          if (txt_geofenceInside!= "") txt_geofenceInside +=", ";
          txt_geofenceInside += thing.geofencesInside[i].name;
       thing.insideFences = txt_geofenceInside;
       console.log("WRITE RESOURCE");
          key : 'alert_inside-outside',
          value : "Inside: "+txt_geofenceInside
       thethingsAPI.thingWrite(thing.thingToken, { values: resultInside }, {lib:'panel'}, next);
    if (thing.geofencesOutside.length > 0)
       console.log("this thing is outside of a geofence");
       var txt_geofenceOutside = "";
       for (let i=0; i<thing.geofencesOutside.length; i++)
          if (txt_geofenceOutside!= "") txt_geofenceOutside +=", ";
          txt_geofenceOutside += thing.geofencesOutside[i].name;
       thing.outsideFences = txt_geofenceOutside;
       console.log("WRITE RESOURCE");
          key : 'alert_inside-outside',
          value : "Outside: "+txt_geofenceOutside
       thethingsAPI.thingWrite(thing.thingToken, { values: resultOutside }, {lib:'panel'}, next);
    if (txt_geofenceInside !== undefined || txt_geofenceOutside !== undefined) {
       console.log("thingToken: " + thing.thingToken + ", Inside: " + thing.insideFences + ", Outside: " + thing.outsideFences);
 }, (err) => {
 callback(null, things);

Testing your Job

If you want to run some tests manually, you can click on Developers in the sidebar>Developer’s Console. Now on the edit screen for your Job, scroll down and find the button “Preview“.

Click this, and all of your logs will show up in your Developer’s Console. You will also see new data on your geofencing widget in your Insight Dashboard which we will set up next.

Geofencing with your Dashboards

Your geofences will automatically show up on the maps in your main dashboard.

You can create a map by doing the following:



If you have an Insight Dashboard set up with your map widget, you can click on one of the “things” to get a closer look.

For more information on the magic of Insight Dashboards, check out this blog post.

Now, let’s make a widget on our Insight Dashboard that shows us where this “thing” has been.

Once in the Insight Dashboard you wish to edit, click the add widget “+” icon, and do the following:

Note: you don’t need to click Realtime, because the widget will update automatically every hour or every day depending on what you set the Frequency to in your Job.

Under Custom Parameters, you may want to set a limit to the number of entries you will see in the widget. For example, I set mine to 10 values.


Don’t worry if the data looks odd; the data you see when editing an InsightDshboard is randomly generated because you are building a template.

Now save your Insight Dashboard and you are ready to use it!

When on your Main Dashboard, click on one of the “things” in the widget connected to this Insight Dashboard and you should see the results of where this thing has been in terms of the geofences you connected it to.


I hope you enjoyed this tutorial! Feel free to contact us if you have any questions on thethings.iO IoT platform.

, ,

How to Setup your Insight Dashboard

When you log into your thethings.iO IoT platform, the first thing that you see is your Main Dashboard. This dashboard is here to give you the main overview of all of your things. However, sometimes you need to see more specific information about your things. For this reason, we’ve created the Insight Dashboard feature. If you need to see a high level vision of all your IoT project but then deep-dive into the details of one specific thing don’t miss this tutorial. Let’s see what it’s all about!

Main Dashboard and Insight Dashboards in more detail

The Main Dashboard is where you can see broad information about all of your products.

You can create widgets that give your information about a product. However, if you want a dashboard that gives you a closer look into something, you can create an Insight Dashboard. For example, you may want to set up an Insight Dashboard that gives you a closer look at errors. Say you have a table on your Main Dashboard with errors. Now with your Insight Dashboard built, you can click on the “thing” with the error in the Main Dashboard and it will take you directly to that “thing’s” Insight Dashboard. You can create Insight Dashboards under each product.

The difference between products and things

For the purposes of thethings.iO, “Products” are the categories and “things” are the actual things that you have. For example, if you had a set of GPS trackers that would be the “product”, and each GPS tracker would be a “thing”.

The Insight Dashboard is a template, and the template can be used for whatever “things” you choose. This means you can specialize as much or as little you want, pulling up every “thing” under one template or pulling each “thing” up under its very own template.

Example: You have a bunch of buttons with different data, either gsm cell data or gps data. Here, your product is “buttons” and each button is one “thing.” Let’s say you wanted to use a different Insight Dashboard depending on the source of data the button uses. Then you need two Insight Dashboard templates, one for gsm cell data and one for gps data, so that you can customize each Insight Dashboard template by data type. Then when you click on each thing, the thing (which knows by what it’s tag tells it) will go to its specific Insight Dashboard.

Creating Insight Dashboards

To create an Insight Dashboard, go to “things” in the sidebar and then click details on one of the products you see there. Once there, midway down the page, you will see a section that says “Insight Dashboards”. There, you can click “+Create Dashboard, and don’t worry, you can have as many Insight Dashboards as you want!

Adding widgets to your Insight Dashboard

Next click action>edit on the Insight Dashboard you want to edit.

An alert like this will probably pop up here reminding you that this dashboard is a template, thus whatever you change will affect how you view every “thing” using this template. 

When you first open your brand new Insight Dashboard, it will have autogenerated a sample for you(with sample data as well) to show you many of the features available. You can go through and delete these if you like. In addition, when editing or creating your Insight Dashboard, all the data you see is sample data.

Now, let’s create a map to show you how you can personalize your dashboard.

Remember your “Resource” is what you see here under “things” in the side bar>details>a thing at the bottom of the page>details. For example, ctm_payload, geolocation, and msg are my options for resources for this “thing”:

When you’re done editing your Insight Dashboard, don’t forget to save!

Connecting an Insight Dashboard to a widget on the Main Dashboard

Get the Insight Dashboard’s ID

Once you have created the dashboard, you will see it along with its unique ID appear there in the table of Insight Dashboards(things in the sidebar>details next to the product you would like>find the Insight Dashboard table midway down the page>copy the id next to the Insight Dashboard you would like to use). We will use this ID to link a widget on the Main Dashboard to your new Insight Dashboard.

Add The Insight Dashboard’s ID to a widget in the Main Dashboard

In the Main Dashboard that you can get to from the sidebar. Click the “edit dashboard” icon, then the wrench icon in the top, right corner of your widget. Then, click “customize it” and scroll to the bottom. There you will see a spot to set the Insight Dashboard ID. Just paste the ID there, and click done!

Try it out!

Now when you click on a thing in this widget, you will have the option to view more about this thing under the template of your Insight Dashboard. For example, I clicked on the white marker above, and now when I click on Insight Dashboard, it will take me to this following screen, which shows this “thing’s” data under the Insight Dashboard template we just created. Magic!

I hope you enjoyed this tutorial! Feel free to contact us if you have any questions on thethings.iO IoT platform.

, ,

How to connect Thingstream with thethings.iO

In this tutorial, we will set up a Thingstream Button with thethings.iO IoT platform so that when we click the button, it’s GPS location will be sent to thethings.iO and can easily be seen on a map! This tutorial will walk you through setting up your button, creating a flow in Thingstream, sending data to thethings.iO, and then visualizing your data with your thethings.iO insight dashboard.

Find here the video tutorial or scroll down in order to read the step-by-step.

Let’s get started!

First steps

Go to Thingstream and activate your button. Make sure your button says active next to it.

If it doesn’t say “active”, you can follow the steps here in a video on activating your button.

Then, click on the button and look at the “IMSI” number and the “identity” number, these are what we will use in the future to send the button’s specific id with it to thethings.iO.

Creating a thing on thethings.iO IoT platform

First, we must create a “thing” so that we can have a way to listen to our button.

Go to “things” on the sidebar(1) and then click “Create new ioT product”(2). For this project, we will be using the JSON format.

Once your thing is created, click details and let’s take note of some things. In the top left corner, we see “Product ID” and “Hash”.

These are what we will use in the http request to tell Thingstream to send the information to this “thing” on thethings.iO.

You can learn more about http/s and JSON here in a past blog post.

Creating a flow on Thingstream

For this project, it will be best to begin with a template so, within Thingstream’s site, click on flows > create flow > from flow library > Thingstream button > Email CSDK Tracker Lctn. This flow will give us a starting point. You can change the name if you want, and then click edit to personalizing it!

Make the flow look like the following by putting “http request” where “location mail” is and adding “msg.payload” to help you with troubleshooting later. 

Understanding the flow

Now, let’s take a closer look at the flow. What kind of data the “GPS or GSM” node takes in, either GPS data or GSM cell data, will affect which path the flow takes. In each path, we are going to organize our data with a msg.payload that we can send with our http request to thethings.iO.

Organizing the data

Next, let’s change the “Prepare GPS…” node. We will add in “externalId”, “identity”, and “timePushed”. The first two will identify what button was pushed and the later will tell when it was pushed. You can also delete the addition of the url if you choose because thethings.iO will offer you with an even better, more functional map :).

Tip: If you are extra curious and want to see what values are available to you in “msg”, you can change your Id value(here “externalId”) to msg and see what it prints when it comes up in thethings.iO.

var gps = msg.payload['gps-location'];
var lon = gps.lon;
var lat = gps.lat;
var source = 'GPS';
msg.payload = {
return msg;

We will make similar changes to the “prepare GSM…” node.

var lon = msg.payload.longitude;
var lat = msg.payload.latitude;
var source = 'GSM cell data';
msg.payload = {
return msg;

Making the http request

Finally, that leaves the “http request” node. For this one, make sure the method is set to POST and the return is “a parsed JSON object”. For the url, we will follow this pattern:


Remember your productId and hash will come from your thing on thethings.iO site. The “idname” we will set to “externalId” and the fname will be the name of our function (which we will write next); let’s call it “thingstream-parser”. Thus, your url should look something like this:


You can learn more about http/s and JSON here in a past blog post.

Creating a function for your “thing”

To create a function, go to thethings.iO site, and click “cloud code” in the sidebar. Then click “Add Function”.

Once here, give the function a name. It must be the same one as you used in your http request so in our case, that’s “thingstream-parser”. Then, assign your function to a “thing”, this should be whatever “thing” you have been using to represent your button on thethings.iO site.

Now, change the code to look like this:

function main(params, callback){

var result = [
 "key": "geolocation",
 "value": params.payload.source,
 "lat": params.payload.lat,
 "long": params.payload.long
 "key": "$geo",
 "value" : {
 "type": "Point",
 "coordinates": [params.payload.long, params.payload.lat]
callback(null, result);



More on the $geo and geo keys can be found here in one of our previous blog posts about how to geolocalize things on a map.

You can also include a console.log of the payload which you will be able to see in the “developer’s console” (“developers” in thethings.iO sidebar > “developer’s console”) every time you click your button.

Testing your button

Deploying the flow for your button

We’re almost ready to click the button! Let’s deploy our flow. Make sure you are looking at your flow on the Thingstream site, then in the upper right corner find and click Deploy > Deploy Test > A Thing > then your button > Deploy.

Click the button!

We’re now ready to click the button! It may take some time for the button to send the http request after being clicked so be patient and let it do it’s thing :). Usually you will see the color green when it is first clicked, then yellow when it is trying to make a connecting, blue when it has made then connection and finally pink when it is talking to the server. If all goes well it will let out a cheerful “beep!” and flash green to tell you that it’s done. At this point, you should see the message


in the debug window of your flow.

Reading your data on the thethings.iO site

To get to your data, click on “things” in the sidebar, find your “thing” and then click “details”. Towards the bottom of the page, you should see your IMSI number from the button there under “Names”. Click “details”. Now you should see a screen like this.

Under “ctm_payload”, you can see all the payload messages you sent with your button.

Under “geolocation”, you can view the map, or view the list view.

Personalizing your button data with thethings.iO dashboard

First, let’s create a map of all of our buttons under our Button “thing”.

On “Customize It”, you may want to change map-type and enable polygons(this will make the map have arrows that show you in what direction the button has traveled).

Now, let’s create a table that shows when each button was last pressed.

Here’s what we have so far! These are just a few examples of all the cool things you can do with your insight dashboard. Feel free to explore some more!

Here are a couple link’s to some tutorials for customizing your dashboard even more:

I hope you enjoyed this tutorial! Feel free to contact us if you have any questions on thethings.iO IoT platform.


Connect anything to thethings.iO IoT platform with HTTP/S and your JSON

On this post we would like to show you how to connect anything using HTTP/S and your JSON. We used to get contacted by IoT developers and companies who were having devices already connected with their own JSON structures. Usually they wanted to move to thethings.iO IoT platform, so this is the reason why we created the HTTP subscription gateways.

The HTTP subscription gateways enables developers to send data to a unique URL without need to deal with thingTokens, activations among others. We provision automagically all the devices identified with an ID or name to thethings.iO in a simple way.

Find below the video tutorial with an example or find here the HTTP subscription documentation.

Step by Step tutorial

First of all, create a thethings.iO IoT platform account. Go to https://thethings.io and follow the steps. In addition, try to fill the information during the first session so we will be able to help you more.

After that, go to create a Product at the Things Manager. Select JSON as a type of product. Once created, then click on Details of the created Product.

Now it’s important to learn to create the subscription URL. The base path for the subscription is:


Get the Product ID and the Hash defined on the Details box of your recently created Product at thethings.iO. With these values you will be able to generate the correct HTTP subscription URL. The subscription URL will be followed by the parameters idname and fname. The idname parameter will define the name that the ID of the device will have inside the JSON coming in the body (e.g. in LoRa dev_id, in Sigfox idname, etc). The fname parameter will define the name of the function developed on Cloud Code that will parse the JSON sent in the body (e.g. http_parser). The final URL should be something like this:


After that, this is the moment to create the function on Cloud Code to parse the JSON sent to thethings.iO. Let’s imagine that you are going to send the JSON file:

{"id": "1234", "temperature": "10"}

For that type of JSON you will need a function on Cloud Code like this:

function main(params, callback){

var result = [
"key": "temp",
"value": params.payload.temperature

callback(null, result);

All the data coming at the JSON is coming into the object params.payload. That means that if you have a complex JSON, just use the object params.payload to find all your data and store it at thethings.iO with the key-value JSON needed at thethings.iO.

From now, you will be receiving the temperature and store it as temp, so you are ready to create a dashboard and more with thethings.iO. BTW at the video we used Postman to simulate a device sending data. Nevertheless we have clients using this technique to connect LoRa connectivity services, Sigfox, BLE gateways and others.

Use thethings.iO the most simple enterprise IoT platform. And feel free to send us questions and contact us in case we have to help you more!

, ,

Internet of Things; Why? Because we can…

IoT - The Big Bang Theory

Everyone knows the comedy show The Big Bang Theory. We knew everyone was talking about the Internet of Things, but to our surprise, an episode of this hit comedy show suggests the main characters, Leonard and Sheldon, connect their flat lights and stereo using an X-10 system.

You can notice this in the video:


For anyone out there wondering why this is done, the most famous nerds of The Big Bang Theory have a simple answer for you: “Because we can.”

Technology is always growing and advancing for one main reason: convenience and simplicity. We use technology to make our lives easier. We are always looking for ways to efficiently use our time and technology provides that incentive for us. The Internet of Things also does this; it has become a big part of our daily lives whether we realize it or not.

We provide simple ways to help companies and developers connect to the internet in a timely and easy manner through our APIs.

Don’t forget to follow us on Twitter and be sure to check out our #IoTFriday blog!


, ,

How To Start With Internet of Things #IoTFriday

Welcome to the new edition of IoTFriday at thethings.iO. A lot of people have ask us how to get started with the Internet of Things. Today I would like to talk about what you can learn or do to get into the IoT. It depends on what you do, ideas you have and what you want to learn. Enjoy the new #IoTFriday video.

During this #IoTFriday, we proposed 3 different situations depending on if you are a designer, a programmer, or a business man with a lot of amazing ideas.

If you are a designer our suggestions are to design something useful that solves a problem in your daily life. After that, print your design with a 3D printer. Finally, learn how to code to continue working on your solution.


If you are a developer our first suggestion is first to buy electronics such as Arduino, Raspberry Pi or Intel Edison and begin the coding process. Learn how these IoT platforms work;  it’s quite simple and the most important part is to have fun programming things. Finally, developers always need to meet a designer.

If you are a business person, create a nice idea and think of the best way to scale it. If you have a business idea related with the Internet of Things that scales, meet with developers and designers to make it happen.

Feel free to write in the comment area below if you have any questions or comments! We will do our best to respond promptly. If you need to test our back-end solution, write us a message to thethings.iO.

Don’t forget to follow us on Twitter and be sure to check out our #IoTFriday weekly blog!


Learn Electric Imp in 5 minutes #IoTFriday

Welcome at the new edition of the IoTFriday at thethings.iO. Today let me show you a quick overview about how to learn Electric Imp, in a little bit more than 5 minutes. With this quick introduction we show how to blink up the Electric Imp, what is Squirrel and how to program devices and agents. Enjoy!

BTW now you can connect Electric Imp with thethings.iO with the official library!

The main part of the Electric Imp platform are the Imps. The Imps are these tiny modules (some with SD card size if they are developers edition) with CPU, memory and WiFi plugged with electronics through a shield and the GPIOs for sensors and actuators.

To blink up the imps and connect them to the Internet, is needed to BlinkUp them with a patented system that flashes the Electric Imps through the mobile device display. That means, that the WiFi SSID and password is transmitted through blinks.

These imps are connected to the Electric Imp cloud through the WiFi, and every one has an agent running on the cloud that attends the events that affect the device.

Electric Imp SD card developer edition

Electric Imp SD card developer edition

The Web IDE from Electric Imp is simple but it works effectively. The console and the agents are running very well (usually). During next days we are going to publish theThings.IO Electric Imp libraries and code examples.

Sign up at thethings.iO and eel free to send us comments and feedback and even topics for the next IoTFriday