Taking control of your Twitter past: Deleting all your Tweets
A common tactic of online harassers is dredging up and sharing their targets’ old social media posts. By taking posts from years ago and removing any connection with their original context, trolls will take a victim’s inside jokes, sarcastic comments, and at-times problematic content from years past to convince others that these victims should be treated with disdain, fired from their jobs, and tormented into silence.
Unfortunately, Twitter, Facebook, Instagram, and other platforms often do not allow users to prune their social media history to regularly remove posts after they’ve grown stale and exceeded their utility to the original poster and audience. Reasons for removing one’s social media past can vary, but regardless of someone’s motivations, we believe that users should at least have a method for removing their submitted content, quickly and comprehensively.
While mass deletion, without canceling one’s account, is not a core function of the Twitter platform, fortunately, Twitter allows developers to programmatically delete tweets and retweets. We have created a tool that will allow users to take control of their Twitter history.
https://github.com/westcountylabs/stweets-of-old

Stweets of Old is a short python script that lets you perform a mass removal of tweets from your Twitter account. This tool was not created for the everyday user as it requires a bit of technical expertise, but if you follow these steps or have a trusted partner like West County Labs help you, you...
... do not need to give access to your account or Twitter archive to third party apps.
... can delete your entire history of tweets & retweets (we don't touch any likes, DMs. or bookmarks). Some other online tools only will delete the 3,000 most recent tweets from your account.
The way Stweets of Old works is by looking at a configuration file for tweets or topics that you want to preserve. When your defined regular expression finds a match in the text of your past tweets -or- when a specific Tweet ID matches any status that you want to save, the script will skip over that tweet and not delete it!
Running this requires you to have a Twitter app registered through the Twitter Developer platform (https://developer.twitter.com/). If you or a partner do not have a developer account, you can contact us at info[at]westcountylabs.com for help in setting up your script.
Follow these steps to run the tool.
Step 1. Request your data archive from Twitter: https://help.twitter.com/en/managing-your-account/how-to-download-your-twitter-archive This can take a day. Any tweets that you create after you receive this archive will not be deleted!
Step 2. From https://github.com/westcountylabs/stweets-of-old copy delete_stweets.py and config.json into a folder on your computer. Then, place a copy of "tweet.js" from your archive into the same folder. Finally, rename “tweet.js” as "old_tweets.json".
Step 3. If you do not have Python3 installed, install Python3: https://www.python.org/downloads/ for your operating system.
Step 4. If you do not have Tweepy (a python library for interacting with Twitter's API) installed, install Tweepy: https://docs.tweepy.org/en/latest/install.html You may need to install pip first: https://pip.pypa.io/en/stable/installing/
As you can see, this tool requires some technical knowledge. If you are having trouble installing python, Tweepy, or downloading the files, please reach out to us for help.
Step 5. Open config.json:
5a. Replace the "precious_terms" with the regular expressions of your choice. Letter case does not matter (We're trying to save people from making mistakes and deleting too much). Also, consider including TwitterIDs for your favorite people that you mention in your tweets.
5b. Replace the "precious_tweets" with the status id of any tweets that you want to save.
5c. Copy and paste your "CONSUMER_KEY" and "CONSUMER_SECRET" from your Twitter Developer application information.

Step 6. Using a text editor like Notepad, replace the first line of "old_tweets.json" with:
{ "tweets" : [
Then add } as the last line of the file.
Step 7. Test run the python script in a terminal or on the command line. On most computers, you will navigate to the folder with your script and run this command:
python delete_tweets.py
If the old_tweets.json and config.json files are found, the terminal will display some information about your configuration and then show a link to connect the tool with your twitter account. Open the activation link in the account for tweet deletion. Copy the verification code back into the console.
Step 8. Enter "TEST" to see the matches to your regular expression. If you don't see the matches you desire, correct your regular expressions in the config.json file.
Step 9. When ready to delete, repeat Step 7 and enter "DELETE" for tweet removal. Why do you have to repeat Step 7? We really want people to be thoughtful before they remove their tweets for good!
You will see a list of Tweet IDs that are being deleted. You can always refer back to your archive if you ever want to reminisce over your past social media musings.
Keep in mind that this tool will clean up your Twitter account and prevent common forms of trolling, this won’t prevent motivated trolls from looking for other potentially problematic posts. In fact, your Twitter account may be archived entirely or in part on archive sites such as the Internet Archive (www.archive.org).
Additionally, be prepared for accusations that you are trying to hide something from the public: remember that - unless you are a President or other government official - you don’t owe anyone access to your social media history. For example:

If you are currently dealing with a legal investigation, consult with your lawyer before removing your history from public view. They may recommend setting your profile to private but leaving old tweets up to show that you have nothing to hide.