An Azure Function that fires daily and deletes your Tweets and Twitter likes that are older than 14 days, and disables retweets from everyone you follow.
This can be adapted to work as an AWS Lambda or Cloud Function if you're more familiar with those platforms.
- Install Azure function CLI tools
brew tap azure/functions brew install azure-functions-core-tools
- Install dependencies
npm install
- Set environment variables in Azure or by copying
local.settings.example.json
aslocal.settings.json
. Then set the values using Twitter API keys and tokens, which you'll need to create in order for your tweets and likes to be deleted. - Optionally, install the Azure Functions extension for Visual Studio Code. If you use the extension for deploying, you'll need .NET in your path.
By default, tweets and likes older than 14 days are deleted. To change this number, update the oldestAllowedDate
variable in TwitterTimer/index.js
If there are tweets you want to keep forever, add their IDs to TwitterTimer/tweetsToSaveForever.js
. These tweets won't be deleted even if their older than the defined threshold.
npm start
- Then make a
POST
request tohttp://localhost:7071/admin/functions/TwitterTimer
with a JSON body of{}
You can deploy this Function to Azure a number of ways. I use Visual Studio Code.
In Visual Studio Code, via the Azure Functions extension:
- Click the Azure icon in the sidebar, then sign in if you haven't already
- Click the "Deploy to Function App..." icon