Upcoming SpaceX launch dates delivered to you via Twitter.
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.
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.
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.
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.
is that I built it with the help of many different technologies/services combined.
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.