How to Host your Twitter Archive on Github

Posted by

Did you know that you can request for an archive of all your tweets? You can even publish your Twitter archive online and have it auto-updates with your latest tweets for free!

Wanna know how? This is possible due to the amazing work of Martin Hawksey. (More on that below). It’s really rather simple. You download your Twitter archive, put it in a Github repo and publish to Github pages!

For someone who’s never used Github before, I’ve broken down the instructions into 14 steps with detailed screenshots that you can follow along.

Total time required: 30 minutes (for non-Github user)

Here’s an outline of the steps.

Step 1: Request for your Twitter archive from Twitter.
Step 2: Open this Google Apps script, and grant it the necessary permissions with your Google Account.
Step 3: Authenticate with your Twitter account.
Step 4: Create a Github account if you don’t have one.
Step 5: Authenticate access to Github.
Step 6: Set up a new repository called Twitter.
Step 7: Download the Github for Desktop App.
Step 8: Clone the repository.
Step 9: Move the Twitter Archive files that you just downloaded into this folder.
Step 10: Commit to Master and Publish Branch.
Step 11: Set your Repository in the Google Apps Script.
Step 12: Schedule your automatic updates.
Step 13: Enable Github Pages
Step 14: Check that your Twitter Archive published on Github Pages

Sound intimidating? Take a deep breath and let’s go!


 

Step 1: Request for your Twitter archive from Twitter.

(Hint: it’s under Settings)

twitter-archive

 

Step 2: Open this script, and grant it the necessary permissions with your Google Account.

 

Step 3: Authenticate with your Twitter account.

Step 4: Create a Github account if you don’t have one. 

Step 5: Authenticate access to Github.

Setup Github Authentication

Step 6: Set up a new repository called Twitter.

Step 7: Download the Github for Desktop App.

Click on set up in desktop and download and install the Github for Desktop App.

Setup your repository in desktop

Step 8: Clone the repository.

Open the Desktop App. Go back to Github and click on Set up in Desktop App again. Open link in app and click on the blue Clone button to clone the repository.

What this does is it sets up a folder called Github/Twitter in your local hard drive (see Local Path in above screenshot).

Step 9: Move the Twitter Archive files that you just downloaded into this folder. 

 

Step 10: Commit to Master and Publish Branch.

Once the files are moved, you will see that the files in your Github desktop app. Add a Summary and description to what you’ve done, and hit the blue “Commit to master” button. This is important! If you don’t add a Summary and a description, you will get an error message that says “Cannot publish unborn HEAD”.

Once the files are committed, hit “Publish Branch” on the top black menubar.

Add a Summary and Description

 

Once the files are committed and published, head back to Github.com and check your repo – you will see that the files have been added.

Step 11: Set your Repository in the Google Apps Script

After adding your archive to Github, head back to the Script, and select your Repository. You will see twitter as one of the drop down options.

Step 12: Schedule your automatic updates. 

Set to Daily, and whatever time you prefer (not important). Then hit Manually update now. (This is important!) 

Schedule archive updates

Step 13: Enable Github Pages

Head back to Github.com, and go to Settings (last option to the right). Scroll down until you see Github Pages. Select your source (pick “master branch”) and save.

Setup Github Pages

If you did everything correctly, you will see “Your site is published at…”

If you do not see your site published, go back to Step 12 and check if you Manually Updated. If not, please do so.

Step 14: Check your Twitter Archive published on Github Pages

Your auto-updating Twitter Archives should now be published on Github.

See the Singapore Sailing Federation’s Twitter Archive here: https://singaporesailing.github.io/twitter

See my @debbiediscovers Twitter archive here: https://debbiediscovers.github.io/twitter

A little bit of history

Martin Hawksey (self proclaimed “Chief Innovation, Community and Technology Officer at ALT, by night a Google Developer Expert, mashup, social network, analytics, Google Apps Script, data junkie”) came up with a rather elegant script that uses javascript keeps your Twitter Archive updated every day using Google Drive.

In essence I’ve taken the archive of tweets, which available on request from Twitter, hosted it on Google Drive and kept it up-to-date with a script that runs every day. Martin Hawksey

I discovered Martin’s Twitter Archive solution in 2015 and had my archive hosted on Google Drive.

However in 2016, Google Drive stopped publishing to the web. I was naturally concerned when I saw this tweet from Amit Agarwal.

Martin did not take long to come up with an alternative. And when he announced his Github solution, I was chuffed as punch!

For those who prefer watching videos, Martin has video instructions on how to do the above.

Github Education’s Student Package

If you’re a student and new to Github, please do check out Github Education’s extremely generous student package (worth over $2,000 including a free .me domain). See “How to get a Free Domain for Students + Github Education Package

If you found this useful, if you managed to publish your Twitter archive, send me a tweet at @debbiediscovers and send me the link so I can have a look!

As always, if you found this useful, please leave a comment below and share this on your social channels! 

Tagged with: , ,