aldrinleal / oneclick-bridge

Simple OneClick Bridge to SNS Topic

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

oneclick-bridge (ocb)

What is it?

A small serverless application written in go that given a topic (created in the template), publishes a message into it from AWS IoT 1-Click.

Sample

See the video at https://youtu.be/YblSiaKV1NQ

For the record, here's a sample 1-click event:

{
  "deviceEvent": {
    "buttonClicked": {
      "additionalInfo": {
        "version": "1.8.0"
      },
      "clickType": "SINGLE",
      "reportedTime": "2021-04-07T03:49:05.968Z"
    }
  },
  "deviceInfo": {
    "attributes": {
      "deviceTemplateName": "clickRequest",
      "placementName": "sample-1click-placement",
      "projectName": "topicana",
      "projectRegion": "us-west-2"
    },
    "deviceId": "P5SJVQ2007JDEVICE",
    "remainingLife": 100,
    "type": "button"
  },
  "devicePayload": {
    "certificateId": "46d9631462ae5e47b847e23b94251188ad76cd6c318b6eb210e963f106a45088",
    "clickType": "SINGLE",
    "remainingLife": 100,
    "reportedTime": 1617767345968,
    "serialNumber": "P5SJVQ2007JDEVICE",
    "topic": "/Devices/Button/P5SJVQ",
    "version": "1.8.0"
  },
  "placementInfo": {
    "attributes": {
      "location": ""
    },
    "devices": {
      "oneClickRequest": ""
    },
    "placementName": "sample-1click-placement",
    "projectName": "topicana"
  }
}

Deploying

(requires go, yarn and serverless framework):

$ go get -v ./...
$ yarn install --frozen-lockfile
$ make && yarn sls deploy

Tools:

Details

TBD

About

Simple OneClick Bridge to SNS Topic


Languages

Language:Go 92.4%Language:Makefile 7.6%