AWS IoT Button: Send POST request to Google Firebase

AWS IoT Button was introduced by Amazon as the developer version of it’s dash button.

The AWS IoT Button allows user to associate with an AWS Lambda instance to run some code snippet while press the button – either play with other AWS service such as Amazon SNS or integrate with your own service.

The button press has 3 types: single, double and long which can be found from the Lambda event.

Here is a simple code gist to demonstrate sending a POST request to Google Firebase client while the button is pressed:

(Keep in mind that AWS Lambda doesn’t have the npm install for your node.js code function – which means you have to upload a zipped file which contains the node.js node_modules folder as dependency)

Smartthings SmartApp send downstream cloud message with Google Firebase

smartthings-logo-horizontal.b229e786

  1. Follow instruction at Smartthings to create and configure the SmartApp.
  2. Follow the document to subscribe the things event. An example at github shows a sample code snippet of a working SmartApp – provides a HTTP GET API interface to list all the available things and the data.
  3. Also, follow the Firebase document to setup the client device SDK and note down the client device token, and the firebase server key.
  4. Write an event data handler to process the event and send downstream message by http POST. Sample code can be seen below.

Node.js send downstream cloud message with Google Firebase

Here is an instruction of using Node.js to send JSON data payload to a client device with Google Firebase Cloud Message service.

firebase_logo

  1. Setup and Configure Google Firebase on the client device (Android, iOS). An Android sample of integration of Firebase core and message can be found here. Locate and note the client device token, and the firebase server key.
  2. On Node.js server side, sending downstream message to Firebase API with NPM package “request“. Sample code can be seen below.
  3. Detail information is documented here (downstream message) and here (Message description)  at Firebase website.