Subscribe to the data streams and access real-time data on your web/mobile/IoT apps.
3.
Publish alerts to the alert channels with a defined severity level. Subscribers will get notified in the form of SMS/Email/Push.
4.
Define cloud actions that can be called from other IoT devices/web applications.
Installation
Use npm to install the iotflows.js module:
1
npm install @iotflows/iotflows-js
Copied!
Usage
loadIoTFlows
This function will create and initialize an IoTFlows instance. This is an async function and you would need to use 'await' to ensure proper initialization.
var iotflows =awaitloadIoTFlows('API_KEY_USERNAME','API_KEY_PASSWORD');
Copied!
Make sure to change API_KEY_USERNAME and API_KEY_PASSWORD with the proper credentials obtained from IoTFlows console. These credentials can be either one of these options:
1.
A Device API Key that has permission to interact with the resources available in its project, or
2.
An Organization IoT API Key that can have read-only or read/write permissions to the entire organization resources
3.
A User Client that is authorized to interact with the permitted resources of the user. This option is most useful when you need to build a web or mobile app. For this option, you need to register your Application in IoTFlows and authenticate users using OAuth2. With the obtained JWT, you can perform a Basic authentication HTTP request to generate a User Client.
Publish data stream
To publish a real-time data stream, you need to pass these parameters in a json object: