<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Kristóf Litavecz on Medium]]></title>
        <description><![CDATA[Stories by Kristóf Litavecz on Medium]]></description>
        <link>https://medium.com/@krizsoo?source=rss-1538a179c64a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*t5Cn8OelY4bPAdWL.</url>
            <title>Stories by Kristóf Litavecz on Medium</title>
            <link>https://medium.com/@krizsoo?source=rss-1538a179c64a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 07:17:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@krizsoo/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How I used my coding skills to make an airline replace my lost baby stroller]]></title>
            <link>https://medium.com/free-code-camp/how-i-used-my-programming-skills-to-buy-a-stroller-2778cb85e8b2?source=rss-1538a179c64a------2</link>
            <guid isPermaLink="false">https://medium.com/p/2778cb85e8b2</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[life-lessons]]></category>
            <category><![CDATA[tech]]></category>
            <dc:creator><![CDATA[Kristóf Litavecz]]></dc:creator>
            <pubDate>Tue, 02 Jan 2018 20:40:00 GMT</pubDate>
            <atom:updated>2018-01-03T22:03:48.716Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0Q8RiaA1CbA_klX1UWy6rw.jpeg" /></figure><p>Last summer my wife and our two children flew from Hungary to California to visit friends. Among other complications, our airline lost our little one’s stroller on the way.</p><p>After numerous unsuccessful attempts to contact the airline through emails, tweets, friendly phone calls — and then angry phone calls — to cover our costs, I had enough. I decided to take things to the next level.</p><p>So I built a <strong>Twitter Bot </strong>that replied to every tweet from the airline’s account to remind them of our case, which had been pending for over three months at that point.</p><p>By no means did I do this for revenge or extort money. All I wanted them to do was treat us fairly and cover the costs of a child’s lost stroller.</p><p>I had been learning to program for about a year now, and making heavy use of <a href="https://medium.freecodecamp.org/">freeCodeCamp community</a> for support and inspiration.</p><p>So, here is what I did:</p><ol><li>I created a new <strong>Cloud9 dev</strong> environment</li><li>I created a <strong>Twitter</strong> account</li><li>I created a simple Twitter Bot using Node.js</li><li>I configured it<strong> </strong>so that it would randomly tweet one of ten reminder messages every hour</li><li>Then I launched the bot</li></ol><p>One and a half weeks later, the money landed in my account, and I bought a new stroller.</p><p>I put all of my code on <a href="https://github.com/krizsoo/twitterbot">this GitHub repository</a> in case you ever find yourself in a similar situation. And here’s how I did all this.</p><h3>Step #1: Create a new Cloud9 IDE environment:</h3><p>Head to <a href="http://c9.io/">Cloud9</a> and create a new workspace.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ytv-8ABcMlVpF6E0ZME9YA.png" /><figcaption>Create a new workspace using and select the Node.js template</figcaption></figure><p>If you would like to replicate my bot just clone my repository by entering the following line in your terminal:</p><p>git clone <a href="https://github.com/krizsoo/twitterbot">https://github.com/krizsoo/twitterbot</a></p><h3>Step #2: Create a Twitter account and a Twitter App</h3><p>If you don’t have a Twitter account yet, <a href="https://twitter.com/signup">go ahead and create one</a>. Once you are registered, you can create a new application, which will allow you to access Twitter’s API and programmatically generate tweets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j-XGrGAdl4NyHwpYpwU4rw.png" /></figure><p>As soon as my app was set up I retrieved <strong>four security </strong>keys that are necessary to access the API:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QZUraqwIUcuPgQ6OdKyY_Q.png" /></figure><ul><li>Consumer Key (API Key)</li><li>Consumer Secret (API Secret)</li><li>Access Token</li><li>Access Token Secret</li></ul><p>All of the above keys should be added to the config.js file the following way:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*33wDEa5ttwTdhTw8KV_3PA.png" /></figure><h3>Step #3: Configure the Twitter bot</h3><p>I had to do some initial configuration to ensure that the bot will do what it is supposed to do.</p><h4><strong>1. Install Node.js dependencies</strong></h4><pre>npm install --save twitter</pre><h4><strong>2. Set up the search query</strong></h4><p>This was an important step to define a search query to which the Bot tweeted back to. I went to the “app.js” file and updated the search parameters.</p><ul><li>q represents the keywords.</li><li>count represents the number of tweets the query should return.</li><li>result_type represents the sorting logic, in our case, it shows the most recent one first.</li><li>lang stands for language (for example, English).</li></ul><p>The below config would automatically reply to the most recent tweet that contains “@freecodecamp”</p><pre>// Set up your search parameters<br>var params = {<br>  q: &#39;@freecodecamp&#39;,<br>  count: 1,<br>  result_type: &#39;recent&#39;,<br>  lang: &#39;en&#39;<br>}</pre><h3><strong>Step #4: Configure the tweets</strong></h3><p>Since the Bot was running hourly, I did not want it to tweet the same message over and over again. Therefore I created an array of ten or so tweets and the Bot randomly selected one every time.</p><pre>//set up array of tweets that can be randomly selected<br>var TWEETS_TO_REPLY = [<br>    &quot;This is the first version of my tweets&quot;,<br>    &quot;This is the second&quot;,<br>    &quot;Tweet 3 where is my stroller?&quot;<br>];</pre><blockquote><strong>EDIT: </strong>As <a href="https://medium.com/u/7e0f0c4bba2b">Jonny Asmar</a> pointed out below, make sure that you do not mention people in your responses as that is against Twitter’s TOS.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qk-GaSDiIfsF47Vy3hHyCg.png" /></figure><h3><strong>Step #5: Configure the tweet frequency</strong></h3><p>Lastly, I set up the Bot to run hourly.</p><p>First I created a variable that represents one hour in milliseconds:</p><pre>//set up tweet time interval<br>var INTERVAL = 1*60*60*1000;</pre><p>Then I made sure that I launched the Bot accordingly:</p><pre>// Start bot and timer<br>BotStart();<br>setInterval(BotStart, INTERVAL);</pre><h3>Step #6: Launch the bot</h3><p>As soon as it was all configured I launched the Bot and waited patiently.</p><pre>npm run serve</pre><h3>What I learned from all this</h3><p>To my surprise, about 24 hours later, a customer service representative finally responded to me. They informed me that they had initiated the money transfer.</p><p>A year ago I would not have been able to do any of this. Even if this is a small thing, this triumph mattered to me a lot.</p><p>This story is about how I learned to code in 2017, and how I found some additional inspiration this side project. I did not start a new career as a developer (yet), but there are many other ways you can make use of your coding skills in your day to day life. Some even argue that <a href="http://code.org/">coding has become the 4th literacy</a>.</p><p>Hopefully for all of you who are starting to learn how to code, you will find a little inspiration in my story, too. On all those late nights when you’re struggling with a coding challenge, keep in mind that whether or not you will start a new career as a developer, understanding the language of the computers will pay off one day.</p><h3>Acknowledgments</h3><p>This post could not have happened without the freeCodeCamp community, nor the CS50 team. I am grateful for their support.</p><p>Also, I’m grateful to <a href="https://medium.com/u/e9031892baf5">Brandon Morelli</a> and <a href="https://medium.com/u/cf8522762673">Scott Spence</a> for writing these detailed guides Twitter Bot guides:</p><ul><li><a href="https://codeburst.io/build-a-simple-twitter-bot-with-node-js-in-just-38-lines-of-code-ed92db9eb078">Build a simple Twitter Bot with Node.js in just 38 lines of code</a></li><li><a href="https://medium.freecodecamp.org/easily-set-up-your-own-twitter-bot-4aeed5e61f7f">Why you should have your own Twitter bot, and how to build one in less than 30 minutes</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2778cb85e8b2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/free-code-camp/how-i-used-my-programming-skills-to-buy-a-stroller-2778cb85e8b2">How I used my coding skills to make an airline replace my lost baby stroller</a> was originally published in <a href="https://medium.com/free-code-camp">We’ve moved to freeCodeCamp.org/news</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>