In part 1 of this series, I described an overview of the IoT Device Incident Management demo. In part 2, we’ll look at the IoT button and how it triggers the Integration Builder flow.
Block Diagram
Recall the block diagram of the application:
IoT Button
The IoT button I used is the AT&T IoT Button. It uses the
AWS IoT 1-Click service to secure, connect and configure the button to trigger an AWS Lambda function.
I’ve created a lambda function to make an API call to an Integration Builder flow set up for a manual trigger that is exposed and secured through AMPLIFY Central as described here.
Recall from part 1 that the IoT button can generate three button events: Single click, Double click and Long click and that those three events are tied to three different actions: warning, error, all clear. These events will simply be passed through to the Integration Builder flow for processing.
The lambda function is shown below:
'use strict'; const AWS = require('aws-sdk'); exports.handler = (event, context, callback) => { callIB(event); }; function callIB(event) { const https = require("https") const data = JSON.stringify(event) const options = { hostname: "xxxxxxxxxxx.apicentral.axwayamplify.com", path: "/IOTDeviceMonitor_sandbox_flow_414271-/executions", method: "POST", headers: { "Content-Type": "application/json", "Content-Length": data.length, "Authorization": "Apikey YOUR-API-KEY-FROM-AMPLIFY-CENTRAL" }, } const req = https.request(options) req.write(data) req.end() }
Note that the hostname, path and API Key are available in AMPLIFY Central when you deploy the Integration Builder API Proxy. The API Key is available in AMPLIFY Central when you set the proxy’s Client Authentication Policy to API Key and create an application that uses the API. This is all described here.
Summary
In part 2 of the Axway AMPLIFY IoT Device Incident Management Demo Breakdown, we looked at how the IoT button is connected to the application using a simple AWS Lambda function using AWS IoT 1-Click service. In the next part, we’ll look at other components of the application.
Learn more about AMPLIFY today.
Follow us on social