In this page we will create a setup in AWS which includes a S3 for storing static page, Lambda function, CloudWatch event scheduling and DynamoDB for holding upcoming tweets. I have already covered many these individual service on other pages. I have linked them on this page at appropriate places.
Also, you need to register a new application in your Twitter account to use for posting tweets. The next paragraph will tell you the actual integration and after that we will cover each one of the service setup.
How it works?
The main actor here is our Lambda function. Actually, we will have two Lambda functions. One is for handling our web request and other for posting tweets to Twitter.
First, you will load a webpage hosted in S3 bucket. This webpage has a simple HTML form and it has input box to allow you to enter your tweet. When you submit, the message will be sent to API gateway which is integrated with our first Lambda function.
This function will add the received message to a DynamoDB table that we will create shortly. On the other hand, on scheduled basis, an event will be fired from CloudWatch to our second Lambda function. When it is fired, this second function will check for any entry in our DynamoDB table.
If an entry found, then it will post to Twitter. If this was successful, then delete that entry. Also, we will restrict to take only one message from the table. We will make to take older message as new ones are recently added.
How useful was this post?
Click on a star to rate it!
Average rating / 5. Vote count:
No votes so far! Be the first to rate this post.
We are sorry that this post was not useful for you!
Let us improve this post!
Thanks for your feedback!