SpaceX Takeoffs Twitter Bot

Upcoming SpaceX launch dates delivered to you via Twitter.

Tweets about launches by SpaceX Takeoffs
What the tweets look like

Table of contents

Main functionality

The bot tweets the targeted UTC launch date, rocket name, launch site and a link to Reddit with more information as soon as a new launch date is known.

Finding the idea

I wanted to build a Twitter bot and had a good idea of what it should post. The bot should originally post positive news that would have come from Reddit, but there were already Twitter accounts that did this.

It doesn’t have to stop me when someone implemented something before me because I could still do it better than the competition, but I didn’t see an improvement for this project.

A new idea had to be found, so I read through multiple API lists where I found the r/SpaceX API that exposes data all around SpaceX, including every launch since 2006. As I’m interested in everything Elon Musk does and as SpaceX is very popular anyway, that was a perfect fit.

Building the app

The data comes from the before mentioned r/SpaceX REST API and is inserted into one of the sentence templates (this means the text won’t be the same for every tweet).

I decided to use Glitch for hosting, because it allows running Node.js, lets you have your own subdomain and is free. I had no prior experience with Node, so it was handy to be able to use the Twitter bot template on Glitch, which I made sure to understand before continuing.

I wanted to have a landing page for the bot (spacex-takeoffs.glitch.me), but I didn’t want to spend much time on the design of the website, so I used a template from HTML5 UP for the first time. Now I only had to adjust the content of the website and make an AJAX request to fetch the API data for displaying upcoming launches on the website as well.

I’m using UptimeRobot to hit the bot endpoint automatically every hour, which “wakes up” the bot that checks for new launch dates that weren’t tweeted already.

You may have heard of the Falcon Heavy test flight on the 6th February 2018, where Elon Musk sent his Tesla Roadster into space. It’s now cruising around in our solar system. Anyways, I thought I’d use the hype on this day to publish my bot.

What I learned

I improved my JS skills, acquired basic Node.js knowledge, gained a little bit of Express.js experience and learned how to work with the “Twit” API for Twitter.

My favorite thing about this project

is that I built it with the help of many different technologies/services combined.

Conclusion

If you struggle to come up with project ideas, you can go through API lists and think about combining an API with other technologies like Twitter. This allowed me to learn more about important concepts while building a project I was interested in.