<?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 Jai Parakh on Medium]]></title>
        <description><![CDATA[Stories by Jai Parakh on Medium]]></description>
        <link>https://medium.com/@parakh-js?source=rss-17e2d3c83607------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*gt9lp23J2AgcGRYn8cP6dA.jpeg</url>
            <title>Stories by Jai Parakh on Medium</title>
            <link>https://medium.com/@parakh-js?source=rss-17e2d3c83607------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 09:01:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@parakh-js/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[Creating Action Sheet in React Native]]></title>
            <link>https://parakh-js.medium.com/creating-action-sheet-in-react-native-cf2eb9412103?source=rss-17e2d3c83607------2</link>
            <guid isPermaLink="false">https://medium.com/p/cf2eb9412103</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[npm]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[actionsheet]]></category>
            <dc:creator><![CDATA[Jai Parakh]]></dc:creator>
            <pubDate>Sun, 31 Jan 2021 06:05:26 GMT</pubDate>
            <atom:updated>2021-01-31T06:05:26.729Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ONe5y30BU8vGVhlx" /><figcaption>Photo by <a href="https://unsplash.com/@duck58cth?utm_source=medium&amp;utm_medium=referral">Alphacolor</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>While Developing <a href="https://play.google.com/store/apps/details?id=com.griffin.parakh.js">Griffin</a>, I had to create an action-sheet to let users update Job Application Status with a single click. So I tested various npm modules, none of them filled the spot except <a href="https://www.npmjs.com/package/react-native-actions-sheet">react-native-actions-sheet</a>. This module provides a fully customizable action sheet with an elegant bounce animation.</p><p><strong>What is an Actionsheet anyway?</strong><br>Actionsheet is a menu that pops from the bottom of the screen on pressing a button.</p><p><strong>Why react-native-actions-sheet anyway?</strong><br>1.) It provides a blank menu that is 100% customizable.<br>2.) Built-In fully configurable animations.<br>3.) Cross-Platform.<br>4.) Action sheet can be controlled with gestures<br>5.) Supports Textinput and ScrollView.</p><p>Now let&#39;s see how to use this awesome module!</p><p>In your project root directory run</p><pre>npm i react-native-actions-sheet --save<br>OR<br>yarn add react-native-actions-sheet</pre><p>Now add the below code!</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2e044cbbd4e732c22578e75d30b0aef6/href">https://medium.com/media/2e044cbbd4e732c22578e75d30b0aef6/href</a></iframe><p>After importing the npm module, we have created an actionSheetRef that can be used to toggle the actionsheet. Now inside the ActionSheet component add your custom &lt;Menu /&gt; Component. Here I have created a simple &lt;Menu&gt; component that can be overwritten by your custom component.</p><p>Creating Actionsheet with <a href="https://www.npmjs.com/package/react-native-actions-sheet">react-native-actions-sheet</a> is that easy!</p><p><strong>Searching for a freelancer for your next Big App?</strong><br>Drop a mail at <a href="https://mail.google.com/mail/u/0/?view=cm&amp;fs=1&amp;to=contact.jaiparakh@gmail.com&amp;tf=1">contact.jaiparakh@gmail.com</a></p><p>Do check out this <a href="https://play.google.com/store/apps/details?id=com.griffin.parakh.js">application</a>, I developed in React Native. It helps in tracking Job Applications. You can filter applications by categories and even change them with a single click!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cf2eb9412103" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Google APIs FAQ]]></title>
            <link>https://parakh-js.medium.com/google-apis-faq-20e8e0b0d838?source=rss-17e2d3c83607------2</link>
            <guid isPermaLink="false">https://medium.com/p/20e8e0b0d838</guid>
            <category><![CDATA[api]]></category>
            <category><![CDATA[gmail]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[google]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Jai Parakh]]></dc:creator>
            <pubDate>Fri, 01 Jan 2021 13:11:47 GMT</pubDate>
            <atom:updated>2021-02-27T04:00:23.276Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*guhwXQxVAAU8ufeq" /><figcaption>Photo by <a href="https://unsplash.com/@evan__bray?utm_source=medium&amp;utm_medium=referral">Evan Dennis</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>For the last few months, I have been receiving a lot of queries on Google APIs. So I decided to create a FAQ article for the same. This article will be regularly updated, you can bookmark it if you want.</p><p><strong>Can I pass the auth object directly to Google API endpoints?<br></strong>No, the auth object contains various functions that will be stripped off if you send it in a request.</p><p><strong>Can I pass access_token directly to Google API endpoints?<br></strong>Yes, In fact, the npm module googleapis does the same under the hood.</p><p><strong>Can I use third party APIs for handling requests to the Google API endpoints?<br></strong>Yes, absolutely most of them will just require an access_token and the user’s email and return the response in a proper format. <a href="https://rapidapi.com/jaiparakh.kota.10/api/gmail5">Check out this API for more info</a>.</p><p><strong>I am creating an application that uses one of the Google APIs, what should I store in my DB?<br></strong>You should store the refresh_token and the user’s email in your database and access_token on your client because it will expire after half an hour.</p><p><strong>How Do I refresh the access_token?<br></strong>You will have to specify access_type as offline before asking for permissions, which will return a refresh_token as well which can be stored in your DB and can be used to generate a new access_token, without asking for user permission again.</p><p><strong>Can I request additional permissions after a user is authorized?<br></strong>Absolutely, and this is in fact the preferred way.</p><blockquote>When requesting user permission to access user data or other resources, you can request all scopes up-front in the initial request or request scopes only as needed, using <em>incremental authorization</em>. Using incremental authorization, your app initially requests only the scopes required to start your app, then requests additional scopes as new permissions are required, in a context that identifies the reason for the request to the user.</blockquote><p>For More Info refer this <a href="https://developers.google.com/identity/sign-in/web/incremental-auth">article</a></p><p><strong>Are there any usage limits for GMAIL API?<br></strong>Yes, there is a <strong>daily usage limit</strong> and a <strong>per-user rate limit</strong> that applies to all the requests.<br>Daily Usage: Limited to 1,000,000,000 quota units every day<br>Per User: 250 quota units per second.</p><p><strong>Can I request Google to increase the quota for my app?<br></strong>Yes, Simply navigate to the project dashboard in GCP and request for extending the usage limits.</p><p><strong>What is a quota unit?<br></strong>Every request consumes some amount of quota. For example, 1 request for creating a draft consumes 10 quota units.<br><a href="https://developers.google.com/gmail/api/reference/quota">In this article</a>, Google has listed all the quota limits.</p><p><strong>Is GMAIL API free?<br></strong>Yes, just like Gmail it&#39;s free to use. However, make sure you don’t exceed the daily quota limit.</p><p><strong>Why Does my Authorization Screen says, “Not Verified”?</strong><br>If you are using sensitive scopes, like reading and sending mails, you will have to first verify your app by Google. For more info refer to <a href="https://support.google.com/cloud/answer/9110914">GCP Console Help</a>.</p><p><strong>How do I verify my App?</strong><br>Navigate to the API and Services tab of your application dashboard on GCP, and click “OAuth Consent Screen”. There in the verification status, click the “Prepare for verification” button.</p><p><strong>What do I need for verification?</strong></p><blockquote>- An official link to your app’s Privacy Policy</blockquote><blockquote>- A YouTube video showing how you plan to use the Google user data you get from scopes</blockquote><blockquote>- A written explanation telling Google why you need access to sensitive and/or restricted user data</blockquote><blockquote>- All your domains verified in Google Search Console</blockquote><p><strong>Edit 1</strong>: I have developed a production-ready API that communicates with GMAIL API and handles everything from fetching and querying mails to decoding email body. If you want to integrate GMAIL API with your app, do c<a href="https://rapidapi.com/jaiparakh.kota.10/api/gmail5">heck it out here.</a></p><p>If your question is not answered, please leave it in the comments, and I will try to answer it in the article itself.</p><p><strong>Searching for Jobs?<br></strong>Tracking Job Applications can be tough since they are spread across multiple platforms. Griffin provides a dashboard that keeps a track of all your Job Applications in a single place. It is now available for download on <a href="https://play.google.com/store/apps/details?id=com.griffin.parakh.js">Google Play Store</a>!</p><p><strong>Searching for a freelancer for your next Big App?</strong><br>Drop a mail at <a href="https://mail.google.com/mail/u/0/?view=cm&amp;fs=1&amp;to=contact.jaiparakh@gmail.com&amp;tf=1">contact.jaiparakh@gmail.com</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=20e8e0b0d838" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Experience with Google Foobar Challenge]]></title>
            <link>https://parakh-js.medium.com/my-experience-with-google-foobar-challenge-60d7cda1fdcc?source=rss-17e2d3c83607------2</link>
            <guid isPermaLink="false">https://medium.com/p/60d7cda1fdcc</guid>
            <dc:creator><![CDATA[Jai Parakh]]></dc:creator>
            <pubDate>Fri, 01 May 2020 11:00:31 GMT</pubDate>
            <atom:updated>2021-01-27T12:06:00.444Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D6ltUdnwHXkFeRvAM8c-6Q.png" /></figure><p>A month back, while searching for a python query, I was browsing the search results and suddenly the screen split open below the search bar with a greeting that said,</p><blockquote>Curious Developers are known to seek interesting problems.Solve one from Google?</blockquote><p>Bingo! I just unlocked Google Foobar Challenge!</p><h3>What is Google Foobar Challenge?</h3><p>Google Foobar is Google’s secret hiring challenge. The interesting thing about foobar is that not everyone can unlock the challenge, only a few people get the invitation.</p><p>Google analyses your search history and reading patterns and if they satisfy certain conditions, they send you the invite. No one knows what these patterns are or how is the challenge unlocked. But what we know is that many developers have been hired through this challenge.</p><p>So I clicked the “I want to play button” and it redirected me to a new page with UNIX Shell-like interface. I had to sign to save my progress.</p><p>The Foobar challenge consists of 5 levels. Each level consists of some problems for which you have to write a solution in either python or java. The difficulty increases as you level up. After level 3 it asks you to fill your contact details and if they like your submission, they may contact you for an interview. Let’s go through each level.</p><h3>Level-1</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MfBlVYV1J_kK7dgA3_XwKQ.jpeg" /></figure><p>The first level consists of a single question that was quite easy and can be solved in linear time. After submitting the solution, a bunny started hopping in the shell. Two days later I requested Level-2.</p><h3>Level-2</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nmOdc2mwGv8YtwKffKX5Sg.jpeg" /></figure><p>It consisted of two questions. Both of them were standard Graph and Depth First Search problems. After completing the level I got a referral link that I could use to invite a friend 😃 , but no bunny animation. 😞</p><h3>Level-3</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ncC8s3bpUiZqMxVNd2u9kA.jpeg" /></figure><p>It consisted of three questions which were a bit tough as two of them were solved using Dynamic Programming and the third one (My favorite question of the challenge 😍) used a mathematical concept called Absorbed Markov Chain. I learned a lot in level-3 and it was the best level in the entire challenge.</p><p>After submission, there was a star wars reference,</p><blockquote>The Code is strong with this one…</blockquote><p>It then asked me to fill a contact form, which included contact details as well as current academic status. I filled the form and was hoping for a reply but its been three weeks and I haven’t heard from them yet ☹️. I will update the blog if they contact me.</p><h3>Level-4</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*momHO5mODqRdIPUHKhGsWQ.jpeg" /></figure><p>This was where things started getting pretty serious. It had two questions one of them was solved using Ford Fulkerson Algorithm and the other was based on permutations. It took me some time to figure out the solution but I managed and on submitting I got another referral link. Fours levels complete, one to go 😅.</p><h3>Level-5</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ik9WxqAO2CC6MeHKPJ-8mw.png" /></figure><p>It consisted of a single question and I was given 21 days to solve it. This was by far the hardest question I had seen. It took me 3 days to understand the question fully and 10 more days for it to pass all the test cases. Upon submitting I got an encrypted message (base64) which upon decoding gave:</p><pre>{‘success’ : ‘great’, ‘colleague’ : ‘esteemed’, ‘efforts’ : ‘incredible’, ‘achievement’ : ‘unlocked’, ‘rabbits’ : ‘safe’, ‘foo’ : ‘win!’}</pre><h3><strong>Conclusion</strong></h3><p>I learned a lot from the foobar challenge, from data structures and algorithms(DSA) to mathematical concepts. Before foobar, I found DSA quite boring but after unlocking the challenge I had a reason to learn DSA which eventually made me a better programmer 😏.</p><p>If you unlock the challenge don’t solve it to simply land a job at google but to enhance your skills. Some people say that they have stopped recruiting with Foobar Challenge but who knows😬.</p><p><strong>Searching for Jobs?<br></strong>Tracking Job Applications can be tough since they are spread across multiple platforms. Griffin provides a dashboard that keeps a track of all your Job Applications in a single place. It is now available for download on <a href="https://play.google.com/store/apps/details?id=com.griffin.parakh.js">Google Play Store</a>!</p><p><strong>Searching for a freelancer for your next Big App?</strong><br>Drop a mail at <a href="https://mail.google.com/mail/u/0/?view=cm&amp;fs=1&amp;to=contact.jaiparakh@gmail.com&amp;tf=1">contact.jaiparakh@gmail.com</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=60d7cda1fdcc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Adding Events With Google Calendar API and Node.js]]></title>
            <link>https://parakh-js.medium.com/adding-events-with-google-calendar-api-and-node-js-62a8d81a38be?source=rss-17e2d3c83607------2</link>
            <guid isPermaLink="false">https://medium.com/p/62a8d81a38be</guid>
            <category><![CDATA[api]]></category>
            <category><![CDATA[google-calendar-api]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[google]]></category>
            <dc:creator><![CDATA[Jai Parakh]]></dc:creator>
            <pubDate>Sun, 05 Apr 2020 10:46:25 GMT</pubDate>
            <atom:updated>2021-01-25T17:50:17.518Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rCecLuydJmZh-L0u" /><figcaption>Photo by <a href="https://unsplash.com/@esteejanssens?utm_source=medium&amp;utm_medium=referral">Estée Janssens</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In this article, we will see, how to create Google Calendar events with Node.js applications.</p><h3>Prerequisites</h3><ul><li>A basic understanding of Node.js and javascript.</li><li>node and npm installed.</li><li>Your application must be authenticated. I have explained the entire procedure in <a href="https://medium.com/@parakh.js/integrating-google-apis-with-node-js-applications-652df4a232e5">this blog</a>.</li><li>The SCOPES array in the above article should be modified according to your application needs.</li></ul><p>To begin with, create a Calendar.js file in your project directory and paste the below code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0ed0c419788228be58f1e259b2e4607d/href">https://medium.com/media/0ed0c419788228be58f1e259b2e4607d/href</a></iframe><p>Let&#39;s go through it step by step.</p><p>First, we create a class Event which includes an addEvent function and a constructor. The class is initialized with the auth object which we get on successful authentication of the application (<a href="https://medium.com/@parakh.js/integrating-google-apis-with-node-js-applications-652df4a232e5">explained here</a>).</p><p>The addEvent function takes 4 parameters (<strong>all string type</strong>) summary, description, start_date, and end_date, which are then added to the event object. This event object format is the same as in the official docs.</p><p>The important thing to note here is the time format which is</p><pre>&#39;2020-03-16T11:00:00&#39;</pre><p>2020–03–16 represents the date in YYYY-MM-DD format and 11:00:00 is the time. They are both separated with a ‘T’.</p><p>The <strong>reminders</strong> object has an attribute overrides which sends the user notifications at the specified minutes before the start of the event.</p><p>Now we send a request to the Calendar API appending the event object to insert the event in the user’s calendar.</p><p>Now create an instance of the Event class and call the addEvent function</p><pre>var event = new Event(auth);<br>event.addEvent(&#39;Summary&#39;,&#39;Description&#39;,&#39;2020-03-16T11:00:00&#39;,&#39;2020-03-18T11:00:00&#39;)</pre><p>If the request is successful an event will be created which will be visible in the user’s calendar dashboard.</p><p><strong>Edit-1:</strong> I have compiled a list of Google APIs FAQs in this <a href="https://parakh-js.medium.com/google-apis-faq-20e8e0b0d838">article.</a></p><p><strong>Edit 2</strong>: I have developed a production-ready API that communicates with GMAIL API and handles everything from fetching and querying mails to decoding email body. If you want to integrate GMAIL API with your app, do c<a href="https://rapidapi.com/jaiparakh.kota.10/api/gmail5">heck it out here.</a></p><p><strong>Want to develop an app that uses one of the Google APIs?</strong><br>Drop a mail at <a href="https://mail.google.com/mail/u/0/?view=cm&amp;fs=1&amp;to=contact.jaiparakh@gmail.com&amp;tf=1">contact.jaiparakh@gmail.com</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=62a8d81a38be" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integrating Google APIs with Node.js Applications]]></title>
            <link>https://parakh-js.medium.com/integrating-google-apis-with-node-js-applications-652df4a232e5?source=rss-17e2d3c83607------2</link>
            <guid isPermaLink="false">https://medium.com/p/652df4a232e5</guid>
            <category><![CDATA[api]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[google]]></category>
            <dc:creator><![CDATA[Jai Parakh]]></dc:creator>
            <pubDate>Thu, 19 Mar 2020 18:13:47 GMT</pubDate>
            <atom:updated>2021-01-25T17:49:53.115Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*U6hoJrI95OxcIp1s" /><figcaption>Photo by <a href="https://unsplash.com/@rajeshwerbatchu7?utm_source=medium&amp;utm_medium=referral">Rajeshwar Bachu</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><blockquote><strong>Google APIs</strong> is a set of application programming interfaces (<a href="https://en.wikipedia.org/wiki/API">APIs</a>) developed by Google which allows communication with Google Services and their integration to other services. Examples of these include Gmail, Translate, Drive or Google Maps. Third-party apps can use these APIs to take advantage of or extend the functionality of the existing services.</blockquote><p>Most of these have a common-auth process which I will explain in this blog.</p><h3>Prerequisites</h3><ul><li>A basic understanding of Node.js and javascript.</li><li>node and npm installed.</li></ul><p>To use Google APIs with Node.js first install googleapis library in your project directory by running.</p><pre>npm install googleapis --save</pre><p>Second head over to Google Cloud Platform and create a new project. Now from the hamburger menu select <strong>“API &amp; Services”.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5rFGltxL9jxLwz4qfUsJqA.jpeg" /></figure><p>Click <strong>“Enable APIs and Service”</strong> below the search bar. This should open the API Library. Now search for the APIs you want to use in your application and then click enable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rYyZwxURQkDnNoIEbDIUgQ.jpeg" /></figure><p>Now head over to the <strong>“Credentials”</strong> section and click the <strong>“Create Credentials”</strong> button below the search bar. Once you have created the credentials, download the client-secret.json file and save it in your project directory.</p><p>Now in your project directory create an Auth.js file and paste the below code. Don’t worry, it’s a well-commented code. 😏</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1290f867ff7d0ef98f5e1811ea865336/href">https://medium.com/media/1290f867ff7d0ef98f5e1811ea865336/href</a></iframe><p>The important thing to note here is that the SCOPES array stores all the permissions your application needs. For example, if you want to send mails from your application paste the link needed from official GMAIL API Docs in the SCOPES array. The same implies to other Google APIs like Drive and Calendar.</p><p>When you run the code for the first time, you will have to follow the link that shows up in the terminal. Allow the application the permissions it needs. You will now get a key, paste it in the terminal, and hit enter which will then generate the tokens.json file and an <strong>auth</strong> object. Now there are two things to note here:</p><ul><li>The token stored in the tokens.json file contains an access_token which is sent with every API request.</li><li>But if you are using an npm module like, googleapis, passing just access_token won’t work, you will have to pass the entire <strong>auth</strong> object which contains a token field that stores the access_token, we receive after verification.</li></ul><p>Your application is now connected with Google APIs.</p><p><strong>Edit-1:</strong> I have compiled a list of Google APIs FAQs in this <a href="https://parakh-js.medium.com/google-apis-faq-20e8e0b0d838">article.</a></p><p><strong>Edit 2</strong>: I have developed a production-ready API that communicates with GMAIL API and handles everything from fetching and querying mails to decoding email body. If you want to integrate GMAIL API with your app, do c<a href="https://rapidapi.com/jaiparakh.kota.10/api/gmail5">heck it out here.</a></p><p><strong>Searching for a freelancer for your next Big App?</strong><br>Drop a mail at <a href="https://mail.google.com/mail/u/0/?view=cm&amp;fs=1&amp;to=contact.jaiparakh@gmail.com&amp;tf=1">contact.jaiparakh@gmail.com</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=652df4a232e5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Communicate between Node.js and Python]]></title>
            <link>https://parakh-js.medium.com/how-to-communicate-between-node-js-and-python-1099a8df8220?source=rss-17e2d3c83607------2</link>
            <guid isPermaLink="false">https://medium.com/p/1099a8df8220</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Jai Parakh]]></dc:creator>
            <pubDate>Tue, 03 Mar 2020 20:21:55 GMT</pubDate>
            <atom:updated>2021-01-27T12:06:28.594Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pvsCSkZnFhrlBWBg" /><figcaption>Photo by <a href="https://unsplash.com/@markusspiske?utm_source=medium&amp;utm_medium=referral">Markus Spiske</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In this article, we will see how to, send data from node.js to python script and get the result back.</p><p>We will be creating a simple addition script in python and call it via node.js</p><p>First, create two files namely <strong>add.py</strong> and <strong>index.js</strong></p><p>Now in index.js add the below code</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ebc4947dba1bd8dd933708e17a8d72a2/href">https://medium.com/media/ebc4947dba1bd8dd933708e17a8d72a2/href</a></iframe><p>Now let’s go through the code, first we import spawn from the “child_process” module, which takes two arguments, first the command to run and second an array of arguments. the <strong>0th </strong>index of the array is reserved for the filename. And the rest is the input passed to the child process.</p><p>We then listen for the ‘data’ event i.e wait for the child process to transmit the data.</p><p>Why did we use JSON here? 😕 Because we return the object from python in JSON format as its always easier to handle JSON. 😌</p><p>Why did we use data.toString()? You will have the answer to this question by the end of this article.</p><p>Now let’s complete <strong>add.py</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/04add2768e59d97405c2242a94add0ed/href">https://medium.com/media/04add2768e59d97405c2242a94add0ed/href</a></iframe><p>The inputs we passed in the child process are retrieved by sys.argv[1] and sys.argv[2] . Remember it was an array, hence the indexing.</p><p>json.dumps() creates a JSON object. The print() sends the data to the parent process i.e to javascript (in this case)</p><p>This data is then printed by the console.log() statement in javascript. The data is our case is simply the sum of two numbers.</p><p>Now coming back to the question, why did we use thetoString() method? Here is the answer, python script sends the data in buffer form i.e &lt;Buffer 7b 22 73 75 ......&gt; This buffer is converted to a string via toString method.</p><p>Hope this article helps!</p><p><strong>Searching for Jobs?<br></strong>Tracking Job Applications can be tough since they are spread across multiple platforms. Griffin provides a dashboard that keeps a track of all your Job Applications in a single place. It is now available for download on <a href="https://play.google.com/store/apps/details?id=com.griffin.parakh.js">Google Play Store</a>!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1099a8df8220" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Use GMAIL-API with Node.js Part-3]]></title>
            <link>https://parakh-js.medium.com/how-to-use-gmail-api-with-node-js-part-3-6d5854013f2f?source=rss-17e2d3c83607------2</link>
            <guid isPermaLink="false">https://medium.com/p/6d5854013f2f</guid>
            <category><![CDATA[es6]]></category>
            <category><![CDATA[npm]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[gmail-api]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Jai Parakh]]></dc:creator>
            <pubDate>Mon, 24 Jun 2019 05:28:44 GMT</pubDate>
            <atom:updated>2019-06-24T05:28:44.969Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kz8v_PhM9cL9WsgC" /><figcaption>Photo by <a href="https://unsplash.com/@tsunamiholmes?utm_source=medium&amp;utm_medium=referral">Chloe Leis</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Congratulations on making it to the final article!</p><p>In this article, we will check for mails and open all relevant links in our browser.</p><p>To begin with install the following dependencies:</p><pre>npm install js-base64 cheerio open mailparser --save</pre><p>Now create a new file Check.js and add the below code:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cb86bff3826c0c253012b606a0acdd7e/href">https://medium.com/media/cb86bff3826c0c253012b606a0acdd7e/href</a></iframe><p>The checkInbox function will check user’s inbox.</p><p>Now in the same class, we create a checkForMediumMails function, which will retrieve all medium mails.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7b1433ee8f0445506fb1f6eddf1d70b3/href">https://medium.com/media/7b1433ee8f0445506fb1f6eddf1d70b3/href</a></iframe><p>Google API has a custom query method in which the query is passed in the request object as a string.</p><pre>from: sender&#39;s mail id       is: unread (Retrieve only unread mails)</pre><p>We then store the response in mail array.</p><p>If we open all the mails, chrome would crash, so we will only open the first mail in our mail array.</p><p>We will now create a getMail function which will parse the mail body and store the links. It takes in the message id as the parameter.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0c2493adc44f91e3b29f0a7e04def9b0/href">https://medium.com/media/0c2493adc44f91e3b29f0a7e04def9b0/href</a></iframe><p>The response object has many properties, but we are concerned with only the mail body. Hence, we store the body in the variable body.</p><p>The base64 module, which we installed earlier, will decode the mail body and store it in htmlBody.</p><p>Also we will now use cheerio which is a great module for traversing the DOM Tree. Here we search for all the anchor tags in the mail body and store it in the links array.</p><p>Now, if you print the links array, you will see that there are various links- some lead to the articles, some lead to the author’s profile and others to the standard links of various social media platforms. But we only need the links that point to the article. So how do we filter them?</p><p>This is where Regular expression comes in.</p><pre>var pat = /------[0-9]-[0-9]/;</pre><p>We always define a regular expression within / / . Each link that leads to articles has six consecutive hyphens followed by a digit, a single hyphen and a digit again.</p><p>Now we filter the links array and store the result in modLinks array.</p><p>Now pass this array in openAllLinks function which uses the open module we installed earlier to open the links in the browser.</p><p>To test our code we import the Check.js module in our index.js file</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a1c2acaa0010250b07b9b52184fca908/href">https://medium.com/media/a1c2acaa0010250b07b9b52184fca908/href</a></iframe><p>And now we execute the command below:</p><pre>node index.js</pre><p>We did it! You can now create a script to parse your mails. 😎</p><p>You should now have a good understanding of how to work with Gmail-API. To dive deeper into GMAIL-API, go through the official documentation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6d5854013f2f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Use GMAIL-API with Node.js Part-2]]></title>
            <link>https://parakh-js.medium.com/how-to-use-gmail-api-with-node-js-part-2-72f3e9b6b060?source=rss-17e2d3c83607------2</link>
            <guid isPermaLink="false">https://medium.com/p/72f3e9b6b060</guid>
            <category><![CDATA[es6]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[gmail-api]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[npm]]></category>
            <dc:creator><![CDATA[Jai Parakh]]></dc:creator>
            <pubDate>Mon, 24 Jun 2019 05:22:01 GMT</pubDate>
            <atom:updated>2021-01-25T17:48:00.384Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EKkg4LbYE-XBco01" /><figcaption>Photo by <a href="https://unsplash.com/@grohsfabian?utm_source=medium&amp;utm_medium=referral">Fabian Grohs</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>I hope you have successfully connected the API with your gmail account. If not read <a href="https://medium.com/@jaiparakh.kota.10/how-to-use-gmail-api-with-node-js-part-1-b17097a64990">‘How to Use Gmail-API with Node.js Part-1&#39;</a></p><p>To begin with, create a new file createMail.js and install nodemailer.</p><pre>npm install nodemailer --save</pre><p>nodemailer will help us to encode and create the mail body.</p><p>First, we import the libraries and then we create a class CreateMail in the createMail.js file and declare the class constructor. This constructor will take the following parameters and will be called whenever a new instance of the class is created.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ded3f86cc7f549de54222bb4a40cbf0b/href">https://medium.com/media/ded3f86cc7f549de54222bb4a40cbf0b/href</a></iframe><p>Note: All parameters here are strings, except auth and attachmentSrc, which are object and an array of strings respectively.</p><p>Now we create a makeBody function in CreateMail class which will create the mail body and encode it in base64 format.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a4f9cc078b9def0ca8e4603c4d8101e9/href">https://medium.com/media/a4f9cc078b9def0ca8e4603c4d8101e9/href</a></iframe><p>We create a new array arr to store the attachments in encoded format.</p><p>If the user wants to send the mail, we call sendmail. Else we save the mail as a draft by calling the saveDraft function.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5de4889bb68e5d5f52aa08f86b8c6309/href">https://medium.com/media/5de4889bb68e5d5f52aa08f86b8c6309/href</a></iframe><p>The sendMail and saveDraft take the encodedMessage as parameter.</p><pre>this.gmail.users.messages.send() sends a request object to the gmail server which either sends a message or throws an error.</pre><p>The request object has many properties, but we use only two for simplicity. userId stores the user’s gmail id and resource object stores the encoded message.</p><p>We now create our last two functions- to list and to delete drafts.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/329206e9134a643f5aeab5e3e08218c6/href">https://medium.com/media/329206e9134a643f5aeab5e3e08218c6/href</a></iframe><p>The deleteDraft function will delete the mail with the id passed in as parameter.</p><p>So our final code should like something like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3432455af5cee3ebc57e59166e868e04/href">https://medium.com/media/3432455af5cee3ebc57e59166e868e04/href</a></iframe><p>We can now send mails and save drafts from our terminal!</p><p>If you want to test your application, simply import createMail.js in your index.js . Create a new instance of the class and then call makebody function.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/38560b4459053a441b09e198e42019da/href">https://medium.com/media/38560b4459053a441b09e198e42019da/href</a></iframe><p>To test the application, execute the command given below in your terminal</p><pre>node index.js</pre><p>Good Job!</p><p><a href="https://medium.com/@jaiparakh.kota.10/how-to-use-gmail-api-with-node-js-part-3-6d5854013f2f">See you in the final article</a> :)</p><p><strong>Edit-1:</strong> I have compiled a list of Google APIs FAQs in this <a href="https://parakh-js.medium.com/google-apis-faq-20e8e0b0d838">article.</a></p><p><strong>Edit 2</strong>: I have developed a production-ready API that communicates with GMAIL API and handles everything from fetching and querying mails to decoding email body. If you want to integrate GMAIL API with your app, do c<a href="https://rapidapi.com/jaiparakh.kota.10/api/gmail5">heck it out here.</a></p><p><strong>Searching for a freelancer for your next Big App?</strong><br>Drop a mail at <a href="https://mail.google.com/mail/u/0/?view=cm&amp;fs=1&amp;to=contact.jaiparakh@gmail.com&amp;tf=1">contact.jaiparakh@gmail.com</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=72f3e9b6b060" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Use GMAIL-API with Node.js Part-1]]></title>
            <link>https://parakh-js.medium.com/how-to-use-gmail-api-with-node-js-part-1-b17097a64990?source=rss-17e2d3c83607------2</link>
            <guid isPermaLink="false">https://medium.com/p/b17097a64990</guid>
            <category><![CDATA[gmail-api]]></category>
            <category><![CDATA[es6]]></category>
            <category><![CDATA[npm]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Jai Parakh]]></dc:creator>
            <pubDate>Mon, 24 Jun 2019 05:12:14 GMT</pubDate>
            <atom:updated>2021-01-25T17:46:21.636Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EDAU8FUjFfhhfFj_" /><figcaption>Photo by <a href="https://unsplash.com/@markusspiske?utm_source=medium&amp;utm_medium=referral">Markus Spiske</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>This will be a 3 part series. In the first one, we will connect our application with the user’s gmail account. In the second, we will create and send emails, save , delete and list all drafts in the user’s account. And in the third, we list all mails in user’s inbox and parse the mail body.</p><p>By the end of third article, you will have an automatic script to open all medium daily digest articles in your default browser.</p><h3><strong>Prerequisites</strong></h3><ul><li>A basic understanding of Node.js and javascript.</li><li>node and npm installed.</li></ul><p>To begin with, head over to -<a href="https://developers.google.com/gmail/api/quickstart/nodejs">https://developers.google.com/gmail/api/quickstart/nodejs</a> and click on the Enable Gmail-Api button and it should download the credentials.json file. Save it in your project directory.</p><p>Run the following command in your terminal to install googleapis library</p><pre>npm install googleapis --save</pre><p>Now create an index.js file and paste the code below. Don’t worry, it’s a well commented code. 😏</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b0b52e148ad7781fdd23794608934c66/href">https://medium.com/media/b0b52e148ad7781fdd23794608934c66/href</a></iframe><p>When you run the code for the first time, you will have to follow the link that shows up in the terminal. Allow the application the permissions it needs. You will now get a key, paste it in the terminal and hit enter.</p><p>You have now successfully connected you application with your gmail Id. Cheers. 🍻</p><p>Note that if you modify the SCOPES array, don’t forget to delete the token.json file. So next time when you run the code, it will automatically generate a new token.json file.</p><p>The authorize and getNewToken functions are responsible for the authorization process and the token key generated.</p><p>The getAuth function is where we put our custom code.</p><p>Note that it is passed as a callback and will execute only on the completion of the authorization process. Also, the auth parameter passed in the function will be used in all the requests we make.</p><p><strong>Edit-1:</strong> I have compiled a list of Google APIs FAQs in this <a href="https://parakh-js.medium.com/google-apis-faq-20e8e0b0d838">article.</a></p><p><strong>Edit 2</strong>: I have developed a production-ready API that communicates with GMAIL API and handles everything from fetching and querying mails to decoding mail body. If you want to integrate GMAIL API with your app, do c<a href="https://rapidapi.com/jaiparakh.kota.10/api/gmail5">heck it out here.</a></p><p>One down, two to go.</p><p><a href="https://medium.com/@jaiparakh.kota.10/how-to-use-gmail-api-with-node-js-part-2-72f3e9b6b060">See you in the next article!</a></p><p><strong>Searching for a freelancer for your next Big App?</strong><br>Drop a mail at <a href="https://mail.google.com/mail/u/0/?view=cm&amp;fs=1&amp;to=contact.jaiparakh@gmail.com&amp;tf=1">contact.jaiparakh@gmail.com</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b17097a64990" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>