Update - 17/10/2020
I have pushed an update to the repository which adds the following:
- Automatically archive deleted tweet data before deleting it
- Archiving happens to a bucket that is created as part of the SAM template, to a
jsonl(JSON Lines) file.
- It will append new tweets in the form of JSON objects on a new line
- I've also parameterised the SAM template to make deployment with environment variables a bit easier using
sam deploy --parameter-overrides
Something I've wanted to do for a while is apply some sort of automatic cleanup to my Twitter account. To automatically delete tweets older than a certain age.
Why? Because I've always seen tweets as ephemeral, tweets typically are short lived on people's timelines and often require context of something going on at the time to fully understand.
Additionally, there's just a hygiene factor of having less publicly available information out there. Yes, deleting tweets from my timeline doesn't erase them from the internet, they can and some are probably archived somewhere, but it reduces their accessibility.
So I wrote a script which runs on a daily schedule as an AWS Lambda to check for tweets older than 180 days and deletes them. There are services that do this, but I'm not terribly comfortable giving that kind of access to my account to third parties and there are typically limitations on what those services will do.
If you're interested in running this in your own AWS account and have a bit of patience (I've not provided thorough instructions) - the source is available below.