ephemeral is a Twitter timeline grooming program that runs for pretty much free on AWS Lambda. The code is forked from Adam Drake's excellent Harold butler-like bot and refactored for Lambda.
You can use ephemeral to automatically delete all tweets from your timeline that are older than a certain number of hours that you can choose. For instance, you can ensure that your tweets are deleted after one week (168h), or one day (24h).
The program will run once for each execution based on the trigger/schedule you set in AWS Lambda. It will delete up to 200 expired tweets (per-request limit set by Twitter's API) each run.
You will need to create a new Twitter application and generate API keys. The program assumes the following environment variables are set:
TWITTER_CONSUMER_KEY
TWITTER_CONSUMER_SECRET
TWITTER_ACCESS_TOKEN
TWITTER_ACCESS_TOKEN_SECRET
MAX_TWEET_AGE
MAX_TWEET_AGE
expects a value of hours, such as: MAX_TWEET_AGE=72h
You can set these variables in AWS Lambda when you create your Lambda function. For a full walkthrough with screenshots on creating a Lambda function and uploading the code, read this blog post. Skip to setting environment variables at this link.
This handy bash script is included to help you upload your function code to Lambda. It requires AWS Command Line Interface. To set up, do pip install awscli
and follow these instructions for Quick Configuration.