{"componentChunkName":"component---src-templates-tag-js","path":"/tags/bot/","result":{"data":{"site":{"siteMetadata":{"title":"LoginRadius Blog"}},"allMarkdownRemark":{"totalCount":1,"edges":[{"node":{"fields":{"slug":"/engineering/build-a-twitter-bot-using-nodejs/"},"html":"<h2 id=\"build-a-twitter-bot-with-nodejs\" style=\"position:relative;\"><a href=\"#build-a-twitter-bot-with-nodejs\" aria-label=\"build a twitter bot with nodejs permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Build a Twitter Bot with NodeJs</h2>\n<p>Hey there! In this blog post, we will build a twitter bot that let us tweet using the command line directly. </p>\n<blockquote>\n<p><a href=\"https://nodejs.org/en/download/\">Node</a> and <a href=\"https://www.npmjs.com/\">npm</a> (or, yarn) must be installed on your system. </p>\n</blockquote>\n<h2 id=\"lets-start-\" style=\"position:relative;\"><a href=\"#lets-start-\" aria-label=\"lets start  permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Let's Start 🎉</h2>\n<p>We will use <strong><a href=\"https://github.com/desmondmorris/node-twitter\">twitter</a></strong> - a client library for the Twitter REST and Streaming APIs. This npm package will make the whole process of building the bot a whole lot easier and faster. </p>\n<h3 id=\"1-apply-for-a-twitter-developer-account\" style=\"position:relative;\"><a href=\"#1-apply-for-a-twitter-developer-account\" aria-label=\"1 apply for a twitter developer account permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>1. Apply for a Twitter Developer Account</h3>\n<p>To be able to access Twitter API, you need a Twitter Developer Account. Apply for it <a href=\"https://developer.twitter.com/en/apply-for-access\">here</a>. Click on <em>Apply for a Developer Account</em>.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 33.07692307692307%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAHCAIAAACHqfpvAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAA/UlEQVQY03WPyW6DQAyGefCq5z5EH6BLLlGkKuXEpVEO5JKqt1aVWGYoCYQQwLPZU4NyDJ80lrffYwdJkp7q2hpjtNYKrDVKKQ6dtUrpYQA/MRYnAEBzsyP2gwHUWbtG+4uhk6bW+kZha/xgiTXkryASjlwtkXeIARe+8zKr+9+iTo7nH1n9XXRadYd26LsOQPl5Ah6yent/en5ZLF53u3i9Xn/u92EYRlG0XK4+Npvxf6JZcaVs0wMfOa2EzqHh06fQOU6PsH9LjFgWhRAyy0UupBSikDLPsmKC82maHY4Vz7ohRvKPX+p+Cw8x3G0hLm1nsAJiy0uNb2Zn5h9k5Y5fQoRJkwAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"Twitter Developer Account\"\n        title=\"Twitter Developer Account\"\n        src=\"/static/16a0b5bcb6a6661a39b0bb6f3fd230ec/e5715/twitter.png\"\n        srcset=\"/static/16a0b5bcb6a6661a39b0bb6f3fd230ec/a6d36/twitter.png 650w,\n/static/16a0b5bcb6a6661a39b0bb6f3fd230ec/e5715/twitter.png 768w,\n/static/16a0b5bcb6a6661a39b0bb6f3fd230ec/d8817/twitter.png 1238w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<p>It will ask you to log in. Select appropriate settings after logging in. It will also generate <strong>keys</strong> and <strong>secret tokens</strong> like Consumer Key, Consumer Secret, Access Token Key, Access Token Secret. Copy and save them somewhere for future use. </p>\n<h3 id=\"2-setup-project\" style=\"position:relative;\"><a href=\"#2-setup-project\" aria-label=\"2 setup project permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>2. Setup Project</h3>\n<p>Make a project folder with any name of your choice. Run <code>npm init</code> to initialize the project. This will generate a <code>package.json</code> file in your directory. Alternatively, you can run <code>npm init -y</code> to setup your project with default settings.</p>\n<blockquote>\n<p><code>package.json</code> holds all the dependencies of a project.</p>\n</blockquote>\n<p>Since our project will be dependent on <strong>twitter</strong> client library, it's time we install this dependency in our project. Run <code>npm install twitter</code> to include this in your <code>package.json</code> .</p>\n<h3 id=\"3-setup-files\" style=\"position:relative;\"><a href=\"#3-setup-files\" aria-label=\"3 setup files permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>3. Setup Files</h3>\n<p>Now we will start with the actual coding part. At the moment, your project folder will have a <code>node_modules</code> folder, a <code>package.json</code> file, and a <code>package-lock.json</code> file. If you have gone with the default options while running <code>npm init</code>, then <code>index.js</code> is the file we will be working upon.</p>\n<p>Open <code>index.js</code>. To be able to use the <strong>twitter</strong> library, which we have installed, you need to include it in <code>index.js</code>. </p>\n<p><code>var Twitter = require('twitter');</code></p>\n<p>Also, remember the <strong>keys</strong> and <strong>tokens</strong> you got from Twitter Developer Portal? It's time we use them. </p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk4\">var</span><span class=\"mtk1\"> </span><span class=\"mtk12\">client</span><span class=\"mtk1\"> = </span><span class=\"mtk4\">new</span><span class=\"mtk1\"> </span><span class=\"mtk10\">Twitter</span><span class=\"mtk1\">({</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">\t</span><span class=\"mtk12\">consumer_key:</span><span class=\"mtk1\"> </span><span class=\"mtk12\">process</span><span class=\"mtk1\">.</span><span class=\"mtk12\">env</span><span class=\"mtk1\">.</span><span class=\"mtk12\">CONSUMER_KEY</span><span class=\"mtk1\">,</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">\t</span><span class=\"mtk12\">consumer_secret:</span><span class=\"mtk1\"> </span><span class=\"mtk12\">process</span><span class=\"mtk1\">.</span><span class=\"mtk12\">env</span><span class=\"mtk1\">.</span><span class=\"mtk12\">CONSUMER_SECRET</span><span class=\"mtk1\">,</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">\t</span><span class=\"mtk12\">access_token_key:</span><span class=\"mtk1\"> </span><span class=\"mtk12\">process</span><span class=\"mtk1\">.</span><span class=\"mtk12\">env</span><span class=\"mtk1\">.</span><span class=\"mtk12\">ACCESS_TOKEN_KEY</span><span class=\"mtk1\">,</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">\t</span><span class=\"mtk12\">access_token_secret:</span><span class=\"mtk1\"> </span><span class=\"mtk12\">process</span><span class=\"mtk1\">.</span><span class=\"mtk12\">env</span><span class=\"mtk1\">.</span><span class=\"mtk12\">ACCESS_TOKEN_SECRET</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">});</span></span></code></pre>\n<p><strong>Do not add your Consumer or Access Token keys or secrets directly in the <code>index.js</code>.</strong> These should be managed accordingly using <em>environment variables</em>.</p>\n<blockquote>\n<p>We will use <code>dotenv</code> library to manage our environment variables in NodeJS.  Run <code>npm install dotenv</code> and follow <a href=\"https://www.npmjs.com/package/dotenv#usage\">these</a> instructions. Your <code>.env</code> will look something like this.</p>\n</blockquote>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"1\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk12\">CONSUMER_KEY</span><span class=\"mtk1\">=........................................</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">CONSUMER_SECRET</span><span class=\"mtk1\">=.....................................</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">ACCESS_TOKEN_KEY</span><span class=\"mtk1\">=....................................</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">ACCESS_TOKEN_SECRET</span><span class=\"mtk1\">=.................................</span></span></code></pre>\n<h3 id=\"4-start-coding-\" style=\"position:relative;\"><a href=\"#4-start-coding-\" aria-label=\"4 start coding  permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>4. Start Coding 🎯</h3>\n<p>I will use <a href=\"https://github.com/15Dkatz/official_joke_api\">Official Joke API</a> to automatically fetch content for my tweet. You can visit the repository and learn more about the endpoints. But the only <a href=\"https://github.com/15Dkatz/official_joke_api#grab-a-random-joke\">endpoint</a> we will work with is <a href=\"https://official-joke-api.appspot.com/random_joke\">random_joke</a>. Click on this, and you will receive a JSON response with fields id, type, setup, and punchline. The fields we are concerned with are setup and punchline. </p>\n<p>We will use <a href=\"https://github.com/axios/axios\">axios</a> for calling the API endpoint. Run <code>npm install axios</code> and add <code>var axios = require('axios');</code> in <code>index.js</code>.</p>\n<p>Now everything has been laid out. We need to connect the dots. The Official Joke API will return a JSON response. We will grab the required data, i.e., the setup and the punchline from it. And then make use of <a href=\"https://github.com/desmondmorris/node-twitter/tree/master/examples#tweet\">client.post</a> functionality of <strong>twitter</strong> package.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"2\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk11\">axios</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;https://official-joke-api.appspot.com/random_joke&quot;</span><span class=\"mtk1\">).</span><span class=\"mtk11\">then</span><span class=\"mtk1\">(</span><span class=\"mtk12\">Response</span><span class=\"mtk1\"> </span><span class=\"mtk4\">=&gt;</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">\t</span><span class=\"mtk15\">return</span><span class=\"mtk1\"> [</span><span class=\"mtk12\">Response</span><span class=\"mtk1\">.</span><span class=\"mtk12\">data</span><span class=\"mtk1\">.</span><span class=\"mtk12\">setup</span><span class=\"mtk1\">, </span><span class=\"mtk12\">Response</span><span class=\"mtk1\">.</span><span class=\"mtk12\">data</span><span class=\"mtk1\">.</span><span class=\"mtk12\">punchline</span><span class=\"mtk1\">];</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}).</span><span class=\"mtk11\">then</span><span class=\"mtk1\">(([</span><span class=\"mtk12\">setup</span><span class=\"mtk1\">, </span><span class=\"mtk12\">punch</span><span class=\"mtk1\">]) </span><span class=\"mtk4\">=&gt;</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">\t</span><span class=\"mtk12\">client</span><span class=\"mtk1\">.</span><span class=\"mtk11\">post</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&#39;statuses/update&#39;</span><span class=\"mtk1\">, {</span><span class=\"mtk12\">status:</span><span class=\"mtk1\"> </span><span class=\"mtk8\">`</span><span class=\"mtk4\">${</span><span class=\"mtk12\">setup</span><span class=\"mtk4\">}</span><span class=\"mtk6\">\\n</span><span class=\"mtk4\">${</span><span class=\"mtk12\">punch</span><span class=\"mtk4\">}</span><span class=\"mtk8\">`</span><span class=\"mtk1\">}, </span><span class=\"mtk4\">function</span><span class=\"mtk1\">(</span><span class=\"mtk12\">error</span><span class=\"mtk1\">, </span><span class=\"mtk12\">tweet</span><span class=\"mtk1\">, </span><span class=\"mtk12\">response</span><span class=\"mtk1\">){</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">\t\t</span><span class=\"mtk15\">if</span><span class=\"mtk1\">(!</span><span class=\"mtk12\">error</span><span class=\"mtk1\">){</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">\t\t\t</span><span class=\"mtk10\">console</span><span class=\"mtk1\">.</span><span class=\"mtk11\">log</span><span class=\"mtk1\">(</span><span class=\"mtk12\">tweet</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">\t\t}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">\t})</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">});</span></span></code></pre>\n<p>Now run <code>node index.js</code> on the terminal and see the output.\nIf everything went well, you would see a <em>tweet</em> response, otherwise an <em>error</em> message. The successful message would look something like <a href=\"https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-statuses-update#example-response\">this</a>.</p>\n<p>At this point, your index.js should look like this.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 45.69230769230769%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAJCAIAAAC9o5sfAAAACXBIWXMAAA7EAAAOxAGVKw4bAAABBklEQVQoz42R627DIAyFeZAmGBsMJCHc2iRqs/3p+7/TSPdjUzdVPbLE4fLJ1kGElGIuOQznOl/aYhmklH0v35BAdsaNho3xji0rUF1/sF136k6n/qUEsS/7Pa4f03IN2x7qapdP3u46rcjDr5fyP9jwULaxbkNZ3VybcelM5UZlx3IFN7VB2ghHdd0zbIwmBeYoqRUwKkvKYjNgCa0mrdEwEztQ+NRfjKO/5FLOS12uuV5SyjGmmEqYY8y1GWtZG3PAiA/2hxftYkolL1sqdZ6myXtCRdYDanJjY4wPCnXbIntiq63X7HgImllIAAXQjtgPRxPrHz/1lgRpAoDvPI5I/qTyQl8o80v3xwnZmgAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"index.js\"\n        title=\"index.js\"\n        src=\"/static/0758fb1dcb8133462eba5090310a8030/e5715/code.png\"\n        srcset=\"/static/0758fb1dcb8133462eba5090310a8030/a6d36/code.png 650w,\n/static/0758fb1dcb8133462eba5090310a8030/e5715/code.png 768w,\n/static/0758fb1dcb8133462eba5090310a8030/c3fd4/code.png 854w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<h3 id=\"congratulations-\" style=\"position:relative;\"><a href=\"#congratulations-\" aria-label=\"congratulations  permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Congratulations! 🎊</h3>\n<p>That's it! You have created your first Twitter Bot, which tweets content after directly calling it from an API. You might take a look at the <a href=\"https://github.com/LoginRadius/engineering-blog-samples/tree/master/NodeJs/TwitterBot\">repository</a> if you encountered any errors. Here, I have used different APIs to fetch content and tweet. Moreover, I have added a script that will search posts with a particular hashtag and like them. </p>\n<blockquote>\n<p><strong>While pushing your code to GitHub, make sure to add <code>.gitignore</code> file and include <code>node_modules</code> and <code>.env</code> in it.</strong></p>\n</blockquote>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further Reading</h2>\n<blockquote>\n<p>The world is yours to explore.</p>\n</blockquote>\n<p>And the dev world is based entirely on exploring technologies and frameworks. Play with this <strong>twitter</strong> library and see what interesting stuff can be built with it. Maybe, search tweets with a particular hashtag and like them? Or maybe, retweet tweets of any particular user? You are free to use your imagination and coding skills to explore more and more. If <code>axios</code> and <code>dotenv</code> are new to you, then go ahead and read their documentation. Get hold of the concepts of environment variables. And come up with your own cool Twitter Bot.</p>\n<blockquote>\n<p>Keep in mind Twitter's <a href=\"https://developer.twitter.com/en/developer-terms\">Developer Policy &#x26; Terms</a> and <a href=\"https://twitter.com/en/tos\">Twitter Terms &#x26; Conditions</a>. These should not be violated in whatever project you are building.</p>\n</blockquote>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n  .dark-default-dark .mtk4 { color: #569CD6; }\n  .dark-default-dark .mtk1 { color: #D4D4D4; }\n  .dark-default-dark .mtk12 { color: #9CDCFE; }\n  .dark-default-dark .mtk10 { color: #4EC9B0; }\n  .dark-default-dark .mtk11 { color: #DCDCAA; }\n  .dark-default-dark .mtk8 { color: #CE9178; }\n  .dark-default-dark .mtk15 { color: #C586C0; }\n  .dark-default-dark .mtk6 { color: #D7BA7D; }\n</style>","frontmatter":{"date":"October 14, 2020","updated_date":null,"title":"Build A Twitter Bot Using NodeJS","tags":["NodeJs","Twitter","Bot"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1.5037593984962405,"src":"/static/73b57d06f8809fab5ebb6ad89ab328ef/14b42/cover.jpg","srcSet":"/static/73b57d06f8809fab5ebb6ad89ab328ef/f836f/cover.jpg 200w,\n/static/73b57d06f8809fab5ebb6ad89ab328ef/2244e/cover.jpg 400w,\n/static/73b57d06f8809fab5ebb6ad89ab328ef/14b42/cover.jpg 800w,\n/static/73b57d06f8809fab5ebb6ad89ab328ef/47498/cover.jpg 1200w","sizes":"(max-width: 800px) 100vw, 800px"}}},"author":{"id":"Vineeta Jain","github":"Ninjavin","avatar":null}}}}]}},"pageContext":{"tag":"Bot"}},"staticQueryHashes":["1171199041","1384082988","2100481360","23180105","528864852"]}