Twitter purge automatically deletes old tweets from your timeline.
- Protect your privacy
- Reduce your digital footprint
- Don't let your old tweets come back to haunt you
Note 🚧 This product is still in development. Use at your own risk. Deleting Tweets is irreversible.
- Sign up and create a project on the Twitter Developer Portal
- Create a new Project and App (select any environment). Make sure to save your API keys!
- Set up 'User authentication settings'
- App Permissions: Read and Write
- Type of App: Confidential
- Enter any Callback URI and Website URL (e.g. this Github repo). We're not using this.
- No need to save Client Id & Secret. We're not using this.
- Go to your 'Keys and Tokens' > Generate Access Token & Secret
- go to Keys and tokens to (re-)generate Access Token and Secret. Make sure to save these keys!
- Make sure that after generation your Access Token & Secret are created with read and write permissions
- Save the keys to your
.env
file
NOTE: The App runs on the Twitter account that you've used to create the developer account & API keys.
Your .env
should be placed in the root of this project and contain the following keys.
TWITTER_API_KEY=''
TWITTER_API_SECRET=''
TWITTER_ACCESS_TOKEN=''
TWITTER_ACCESS_TOKEN_SECRET=''
The root of this project contains a settings file to configure the purge.
Note 🚨 If you fork this repo to run this on your own account, make sure to update to default (empty) values.
The default should be something like
"since_id": null,
"purge_after": 180,
"whitelist": [
"tweet_id"
]
since_id
gets updated after each runpurge_after
is the amount of days that tweets get deleted. Please note that the Twitter API limit is capped at 3200. Depending on how often you tweet, this could affect the purge.whitelist
is a list of tweet ids to you want to keep. Even if it passed your purge date.
You can run a purge manually using the following command.
yarn start
The cron job in .github/workflows
will automatically run on daily basis. Make sure to configure repository secrets with the same variables as your .env
file.
The Twitter API only returns the last 3200 tweets. This is likely insufficient for most accounts. In order to delete historical tweets, you need to download an archive of your data.
This might take up to 24 hours. Once you have your data, add it to the root of this project with the name archive.zip
.
Note 🚨 Make sure you rename your archive to
archive.zip
or exclude it in.gitignore
.
You can run a full archive purge using the following command.
yarn start:archive