Integrating the IBM Watson IOT platform with Mendix

Mendix Community
7 min readJul 13, 2022


Integrating the IBM Watson IOT platform with Mendix (Banner Image)
Integrating the IBM Watson IOT platform with Mendix

The internet of things (IoT) offers companies countless possibilities to conduct more intelligent operations. Connecting everyday things embedded with electronics, software, and sensors to the internet enables them to collect and exchange data. The devices/asset which is connected is virtually equipped with sensors that are transmitting data to the cloud. There is no shortage of potentially revolutionary ideas out there, but there are still few IoT examples to draw inspiration from.

Bluemix is IBM Watson’s cloud platform which supports many products and services including Compute Infrastructure and Services, Internet of Things, data analytics, mobile application services, storage, and more. It is compatible with MQTT Protocol, HTTP, and REST APIs.

In this blog, let’s take a look at how to set up an IBM Watson account and to receive data from IBM Watson in your Mendix app. In this blog, I will explain to you how to connect a Water level sensor with IBM Watson.

Why connect a water level sensor to the internet?

We need to connect a water level sensor to the internet, as we have a use case to monitor the water tank in our house to make sure we are aware of our water use. As we don’t know when the tank is going to be empty, in this scenario we will connect a sensor to detect the water and visualize the tank’s data on our mobile device.

Steps to achieve

Step 1: You need to have a sensor in hand for testing and identifying the Device ID, Device Type, and Authentication Token from the sensor.

For Example:

Device Type: ‘WaterLevel’Device ID: 00:00:5e:00:53:afAuthentication Token: 123456789

Step 2: To create an IBM Watson Account go to & click Create an account as shown below,

Step 3: To use any service on the IBM platform we need to have a resource list. Create an Internet of Things Platform Resource from the Catalog section or Create resource list button on the right corner and select Internet of Things platform.

Note: Note down your Location name (OrgID), it will be needed in future

Step 4: Select the Internet of Things Platform resource from : Resource list → Service and Software -> Click Launch

Step 5: Select the Org id and enter the username (IBMid) and password to launch our IoT platform. you should now see the Dashboard of our IoT platform as pictured below.

Step 6: To enable the communication between Mendix, sensors and IBM Watson, go to the security tab and set the security level as TLS Optional.

Step 7: Now we need to have a device that can to be set up in the Watson IOT platform, to do that Click ‘add device’.

Step 7: Enter device type and device ID which is your IoT device’s information in the Identity wizard.

Step 8: In device information, there will be some pre-filled data, leave it as it is and click next. Enter the device authentication token (8-digits long) of your device on the security page & click next.

Step 9: Click Finish to complete the device setup and note down all your device credentials.

Device Credentials will be displayed after clicking finish, make a note of all values.

Step 10: Switch on your sensor, so that it will connect to Wi-Fi and send data to your IBM Watson account. You can see the data coming to IBM Watson as an event.

Step 11: Click Generate API Key from Apps in the navigation.

Step 12: Give a description of your choice and click next.

Step 13: In the permission tab, select Standard Application and click Generate API

Step 14: Note down your API key and authentication token, which is the user name and password from the MQTT client in Mendix

For Example:

API Key: a-xxxx-xxxxxAuthentication Token: xxxxxxxxxxxx

Subscribe to your Mendix app with the IBM Watson IOT Platform (Subscribe to events)

Step 1: Download MQTT Client from the Mendix marketplace.

Step 2: We need to Subscribe to the Device via IBM Watson, so create a microflow and add the Mqtt subscribe activity-> Connect this microflow to a button from the Home page.

Configure the MQTT SUbscribe activity as follows:

Broker Host: ‘’Broker port : 1883Broker Organization: You’re Organization IDTime Out: 6000Username: a-xxxxx-xxxxxPassword: xxxxxxxxxxxxTopic Name: ‘iot-2/type/” DeviceType”/id/”DeviceID”/evt/status1/fmt/json’Qos : At_Least_Once_1

Step 3: Create On Message Microflow: Create Import with Mapping activity and call the import mapping

Step 4:Create JSON structure which we received from IBM Watson as JSON format.

Set your Mendix app’s REST publish log level to trace in order to see incoming messages and their data.

Step 5: Create Import mapping using the JSON structure we are receiving from IBM Watson.

Step 6: Click the subscribe button, so that it will connect with IBM Watson and start receiving data. You can see the results in the logs.

Step 6: Display the data in Mendix using a graph, however you would like to visualize the data, here are some screenshots from my app.

Finally, we were able to see a live feed of the tank’s water level!


Mendix allows us to connect IoT devices from the AWS IOT platform, IBM Watson, the Things Network, and more. Every object can be connected to the internet using sensors to transmit data and Mendix provides even more features to connect the devices using fewer steps — which makes our lives easier as developers.

Will see you in the next article!

Read More

From the Publisher -

If you enjoyed this article you can find more like it on our Medium page. For great videos and live sessions, you can go to MxLive or our community Youtube page.

For the makers looking to get started, you can sign up for a free account, and get instant access to learning with our Academy.

Interested in getting more involved with our community? Join us in our Slack community channel.



Mendix Community

Software Engineer - Certified as Advance Mendix Developer