Cloud Actions
The steps below example illustrate how to set up a Cloud Action to process events from a Cloud Stream:
- Navigate to Device > Cloud > Actions.
- Click Add Cloud Action.
- Set Source type to Stream.
- Click on Stream and select the stream from which to process events.
- Click on Action name and enter a meaningful name to identify the Cloud Action.
- (Optional) Set Input to Get HTTP response. This template illustrates how to send an HTTP request to an external API. For additional information see POSTing Data via Webhooks below.
- (Optional) Set Log to Log a variable. This will write information about the event to the console.
- (Optional) Set Output to Send a device command. This will send a command to the device. The default implementation sets some text on the LCD screen.
function(event) {
...
return {
"/my_company/devices/my_device/:command": [{"elems" : { lcd : { txt1 : "textHere" }}}]
}
}
The Output can also be set to Write to Stream. For additional information see Simple Forwarding below.
- Click Continue.
- Modify the code as required for your cloud action.
- Click Create Cloud Action to create the Cloud Action.
Updated almost 5 years ago