AWS IoT — Twitter Bridge

TensorIoT Editor
TensorIoT
Published in
2 min readDec 22, 2017
“Twitter is like sending out cool telegrams to your friends once a week” — @ TomHanks

This post gives a quick overview one of our applications listed under AWS Serverless Application Repository. Its free, try it!

This serverless application provides a bridge between AWS IoT and Twitter for your devices to send messages to Twitter. The code and details are available at https://github.com/TensorIoT/sar-iot-twitter-bridge

What is AWS Serverless Application Repository?

The AWS Serverless Application Repository is a collection of serverless applications ranging from code samples and components for building web and mobile applications to back-end processing services and complete applications. Each application is packaged with an AWS Serverless Application Model (SAM) template that defines the AWS resources used. The Serverless Application Repository enables you to quickly deploy these code samples, components, and applications for common use cases such as web and mobile back-ends, data processing, chatbots, IoT, and more. There is no charge to use the Serverless Application Repository — you only pay for the AWS resources used in the applications you deploy.

Check this launch video for more details.

Use Cases

  1. Create a user account for a specific device and tweet out messages directly to your followers or a specific hashtag (temperature, weather warnings, etc.)
  2. Create an alert topic and notify end users directly through Twitter.
  3. Alert admins on any event (new devices, high watermark, etc.) or any alert threshold being reached.

Prerequisites

  1. AWS IoT Topic which will be used as the trigger for the lambda
  2. Sign up for a Twitter Developer account
  3. Create a new Twitter App
  4. Copy Consumer Key (API Key), Consumer Secret (API Secret), Access Token, Access Token Secret from ‘Keys and Access Tokens’ tab.

NOTE — Keep the “Consumer Secret” a secret. This key should never be human-readable in your application. This access token can be used to make API requests on your own account’s behalf. Do NOT share your access token secret with anyone.

Setup

You will need the following information from the previous steps and configure them in the template.yaml file

  1. CONSUMERKEY — Twitter app Consumer key.
  2. CONSUMERSECRET — Twitter app Consumer secret.
  3. TOKEN — Twitter app Token.
  4. TOKENSECRET — Twitter app Token secret.
  5. IncomingTopic — The topic that will be used as the trigger for the lambda.

Use

The following Input Format is expected from the IoT Topic to trigger the Twitter workflow

{
"deviceID": "deviceID123",
"incomingText": "Text From Device"
}

License

This is released under the MIT license. Details can be found in the LICENSE file.

--

--