This flow uses M2X to retrieve temperature data and triggers a text message alert.
This flow retrieves the temperature data pertaining to Las Vegas from an outside source. If the temperature exceeds the value you define, the flow triggers a text message alert; if the temperature does not exceed the value you define, the data is stored in the M2X.
- http request
In order to use the M2X node, log in to the M2X environment and create the API Key and the Device ID.
Define a data source blueprint for the las_vegas_temperature stream; define the unit degrees as Celsius.
Create an account at http://www.twilio.com /. Enter the values for Account SID and Token according to the instructions of the twilio node.
- inject node – Triggers the http request which is repeated according to the time interval you define.
- http request – Configures the GET method and the URL used to receive Las Vegas weather info.
- function node – Parses the response and extracts the current temperature.
- switch node – Based on the defined temperature threshold, determines whether to initiate a text message or to store the data in the M2X.
- function node – Creates an object in order to store the data in the M2X.
- M2X node – Routes incoming messages to the M2X store.
- function node – Configures the text message which is sent if the temperature exceeds the threshold.
- twilio node – Configures the connection to twilio which enables sending the text message.
This flow uses the following links to get Las Vegas weather info: