AWS IoT — Twitter Bridge
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
- Create a user account for a specific device and tweet out messages directly to your followers or a specific hashtag (temperature, weather warnings, etc.)
- Create an alert topic and notify end users directly through Twitter.
- Alert admins on any event (new devices, high watermark, etc.) or any alert threshold being reached.
Prerequisites
- AWS IoT Topic which will be used as the trigger for the lambda
- Sign up for a Twitter Developer account
- Create a new Twitter App
- 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
- CONSUMERKEY — Twitter app Consumer key.
- CONSUMERSECRET — Twitter app Consumer secret.
- TOKEN — Twitter app Token.
- TOKENSECRET — Twitter app Token secret.
- 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.