<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Nylas</title>
    <description>The latest articles on Forem by Nylas (@nylas).</description>
    <link>https://forem.com/nylas</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Forganization%2Fprofile_image%2F68%2Fe610b61e-07d2-4785-b711-62eddce5b039.png</url>
      <title>Forem: Nylas</title>
      <link>https://forem.com/nylas</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/nylas"/>
    <language>en</language>
    <item>
      <title>Nylas and AI: Email and Calendaring for the Future</title>
      <dc:creator>Alvaro (Blag) Tejada Galindo</dc:creator>
      <pubDate>Mon, 28 Aug 2023 10:25:24 +0000</pubDate>
      <link>https://forem.com/nylas/nylas-and-ai-email-and-calendaring-for-the-future-pn4</link>
      <guid>https://forem.com/nylas/nylas-and-ai-email-and-calendaring-for-the-future-pn4</guid>
      <description>&lt;p&gt;Yes, we're hosting a Hackathon and you can &lt;a href="https://nylas.devpost.com/" rel="noopener noreferrer"&gt;join today&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftj07hu17ukh4bw2ao5ds.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftj07hu17ukh4bw2ao5ds.png" alt="Nylas Hackathon" width="300" height="300"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What do I need to do?
&lt;/h2&gt;

&lt;p&gt;Just create an application using any of our SDKs (Ruby, NodeJS, Java, Python) or calling our APIs directly and any Artificial Intelligence tool of your choice (ChatGPT, Hugging Face, Midjourney).&lt;/p&gt;

&lt;h2&gt;
  
  
  Are there any prizes?
&lt;/h2&gt;

&lt;p&gt;Of course, here's the list for the first prize:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;$5,000 USD&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Virtual meeting with Nylas leadership&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Blog post featuring the winning submissions&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And here for the 5 runner ups:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;$1,000 USD&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Virtual meeting with Nylas leadership&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Blog post featuring the winning submissions&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  I just signed up, now what?!
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs6fpycm4s826nzf3q5my.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs6fpycm4s826nzf3q5my.jpeg" alt="Create a free Nylas account" width="702" height="395"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When you sign up, you will receive an started kit email with clear instructions, but, if you don't read it or your forget about it, it's critical that you create a &lt;a href="https://dashboard.nylas.com/register?utm_source=devpost&amp;amp;utm_medium=hackathon&amp;amp;utm_campaign=devpost-hackathon-q3-23&amp;amp;utm_content=" rel="noopener noreferrer"&gt;free Nylas account&lt;/a&gt; (And mention that you are completing our Hackathon!), that will allow you to connect up to 10 email account.&lt;/p&gt;

&lt;h2&gt;
  
  
  Can I get some inspiration?
&lt;/h2&gt;

&lt;p&gt;Sure you can, just watch some of our &lt;strong&gt;Coding with Nylas&lt;/strong&gt; livestream episodes&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foth7rw2ysnbezh1ksp20.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foth7rw2ysnbezh1ksp20.png" alt="Coding with Nylas" width="800" height="407"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=xnp-7oW5cvw" rel="noopener noreferrer"&gt;How to Send an email using DearPyGUI, ChatGPT and your voice | Coding with Nylas | Episode 68&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=KNJWMGExt18" rel="noopener noreferrer"&gt;How to use AI to generate email responses&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=00VLiNT7Tlw" rel="noopener noreferrer"&gt;Localize your emails with ChatGPT and Python | Coding with Nylas | Episode 59&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=InxpfTtGYf0" rel="noopener noreferrer"&gt;Python, Sentiment Analysis, Streamlit, and ChatGPT | Coding with Nylas | Episode 74&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=NzXTuJzdveE" rel="noopener noreferrer"&gt;Nylas + AI Events: WeAreDevelopers Recap &amp;amp; Upcoming Events&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Last words
&lt;/h2&gt;

&lt;p&gt;Just follow the foxes advise 😉&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frs7gsv6o3t8jq3s5ngxb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frs7gsv6o3t8jq3s5ngxb.png" alt="Join Nylas Hackathon" width="286" height="242"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>hackathon</category>
      <category>programming</category>
      <category>ai</category>
      <category>api</category>
    </item>
    <item>
      <title>A Small Introduction to Functional Programming</title>
      <dc:creator>Alvaro (Blag) Tejada Galindo</dc:creator>
      <pubDate>Tue, 03 Jan 2023 20:48:02 +0000</pubDate>
      <link>https://forem.com/nylas/a-small-introduction-to-functional-programming-4aid</link>
      <guid>https://forem.com/nylas/a-small-introduction-to-functional-programming-4aid</guid>
      <description>&lt;p&gt;Functional Programming is an old paradigm that’s gained popularity in recent years due to its code conciseness, modularity, and lack of side effects.&lt;/p&gt;

&lt;p&gt;Based on &lt;a href="https://en.wikipedia.org/wiki/Lambda_calculus" rel="noopener noreferrer"&gt;Lambda Calculus&lt;/a&gt;, developed by Alonzo Church in the 1930s, functional programming has been implemented in mainstream programming languages like &lt;a href="https://www.javascript.com/" rel="noopener noreferrer"&gt;JavaScript&lt;/a&gt;, &lt;a href="https://www.python.org/" rel="noopener noreferrer"&gt;Python&lt;/a&gt; and &lt;a href="https://www.java.com/en/" rel="noopener noreferrer"&gt;Java&lt;/a&gt;. Programming languages like &lt;a href="https://www.erlang.org/" rel="noopener noreferrer"&gt;Erlang&lt;/a&gt;, &lt;a href="https://www.haskell.org/" rel="noopener noreferrer"&gt;Haskell&lt;/a&gt; or &lt;a href="https://www.scala-lang.org/" rel="noopener noreferrer"&gt;Scala&lt;/a&gt; are better suited for functional programming as they are designed to be functional first.&lt;/p&gt;

&lt;p&gt;Many developers consider &lt;a href="https://en.wikipedia.org/wiki/Lisp_(programming_language)" rel="noopener noreferrer"&gt;Lisp&lt;/a&gt; the first functional programming language. For newer incarnations, we can try &lt;a href="https://lisp-lang.org/" rel="noopener noreferrer"&gt;Common Lisp&lt;/a&gt; or &lt;a href="https://racket-lang.org/" rel="noopener noreferrer"&gt;Racket&lt;/a&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  What makes functional programming so unique?
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Pure functions&lt;/strong&gt; → The same input always produces the same output, and there are no side effects (no printing into the screen, mutating your input or changing the filesystem).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Function are First Class citizens&lt;/strong&gt; → Function are treated as data. We can use them as variables, as input for other functions or as return values. Functions are everywhere.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Shorter code&lt;/strong&gt; → Programs written in functional programming languages tend to be shorter than its counterparts like object oriented or imperative programming.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;No loops&lt;/strong&gt; → There’s no while, for, do while or anything of the sort as recursion is all you need.&lt;/p&gt;

&lt;h1&gt;
  
  
  What do we need?
&lt;/h1&gt;

&lt;p&gt;In this post, we’re going to explore some key fundamentals of functional programming using examples in two different functional languages and you’re invited to install them both, or just install what you want or need.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Haskell (1990 / Purely Functional)&lt;/strong&gt; → If we’re on a Mac, the best way is to use &lt;a href="https://brew.sh/" rel="noopener noreferrer"&gt;homebrew&lt;/a&gt; and type on the terminal window:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;brew &lt;span class="nb"&gt;install &lt;/span&gt;ghc cabal-install
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Where &lt;strong&gt;ghc&lt;/strong&gt; is the &lt;strong&gt;Glasgow Haskell Compiler&lt;/strong&gt; and &lt;strong&gt;Cabal&lt;/strong&gt; is Haskell’s package manager.&lt;/p&gt;

&lt;p&gt;For other systems, you can refer to the &lt;a href="https://www.haskell.org/downloads/" rel="noopener noreferrer"&gt;download&lt;/a&gt; page.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Erlang (1986 / Concurrent and Functional)&lt;/strong&gt; → Again, if on a Mac, type:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;brew &lt;span class="nb"&gt;install &lt;/span&gt;erlang
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or you can refer to the &lt;a href="https://www.erlang.org/downloads" rel="noopener noreferrer"&gt;download&lt;/a&gt; page.&lt;/p&gt;

&lt;h1&gt;
  
  
  Immutable variables
&lt;/h1&gt;

&lt;p&gt;In functional programming, once a variable is assigned it can never change. You can think of that as using constants all the time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Erlang
&lt;/h2&gt;

&lt;p&gt;In Erlang variables begin with an Uppercase letter and once assigned they cannot be changed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiza8lo3cypx3q5psnys1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiza8lo3cypx3q5psnys1.png" alt="Erlang Variables" width="800" height="261"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Haskell
&lt;/h2&gt;

&lt;p&gt;In Haskell variables don’t follow any structure. Create a file called &lt;strong&gt;variables.hs&lt;/strong&gt; and type the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight haskell"&gt;&lt;code&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then open a terminal window on the same folder as your file and run &lt;strong&gt;ghci&lt;/strong&gt;, then &lt;strong&gt;:l variables&lt;/strong&gt; to load your program.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj20mrz91m5wcd47mmx43.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj20mrz91m5wcd47mmx43.png" alt="Haskell Variables" width="800" height="336"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Pattern Matching
&lt;/h1&gt;

&lt;p&gt;In short terms, pattern matching allows us to define how the same function will react to different parameters. This means that calling the function &lt;strong&gt;myFunction&lt;/strong&gt; with no parameters will be different from calling &lt;strong&gt;myFunction&lt;/strong&gt; with two parameters and different from calling it with five parameters and even different when calling it with different parameter values.&lt;/p&gt;

&lt;p&gt;Let’s create an Erlang example called &lt;strong&gt;greetings.erl&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight erlang"&gt;&lt;code&gt;&lt;span class="p"&gt;-&lt;/span&gt;&lt;span class="ni"&gt;module&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;greetings&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt;&lt;span class="ni"&gt;export&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="n"&gt;greet&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]).&lt;/span&gt;
&lt;span class="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;male&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;Name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;
    &lt;span class="nn"&gt;io&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nf"&gt;format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Good morning Mr. &lt;/span&gt;&lt;span class="si"&gt;~s~n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;Name&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;span class="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;female&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;Name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;
    &lt;span class="nn"&gt;io&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nf"&gt;format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Good morning Mrs. &lt;/span&gt;&lt;span class="si"&gt;~s~n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;Name&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;span class="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(_,&lt;/span&gt; &lt;span class="nv"&gt;Name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;
    &lt;span class="nn"&gt;io&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nf"&gt;format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Good morning ???. &lt;/span&gt;&lt;span class="si"&gt;~s~n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;Name&lt;/span&gt;&lt;span class="p"&gt;]).&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When we run it, we can see that we can call the same function but using different parameters and it will always run as expected.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fus860gwik41wfe7rbuq2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fus860gwik41wfe7rbuq2.png" alt="Erlang Greetings" width="800" height="365"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Anonymous functions
&lt;/h1&gt;

&lt;p&gt;Anonymous functions are functions that do not have a name. We can call them just once. We use them to define functions that are not meant to be called multiple times.&lt;/p&gt;

&lt;p&gt;Let’s see an example calling a function to manipulate a list. We’re going to write a file called &lt;strong&gt;lambdas.hs&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight haskell"&gt;&lt;code&gt;&lt;span class="n"&gt;func&lt;/span&gt; &lt;span class="o"&gt;::&lt;/span&gt; &lt;span class="kt"&gt;Integer&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;Integer&lt;/span&gt;
&lt;span class="n"&gt;func&lt;/span&gt; &lt;span class="n"&gt;num&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;num&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;
&lt;span class="n"&gt;show_nums&lt;/span&gt; &lt;span class="o"&gt;::&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;Integer&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;Integer&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;show_nums&lt;/span&gt; &lt;span class="n"&gt;lst&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;map&lt;/span&gt; &lt;span class="n"&gt;func&lt;/span&gt; &lt;span class="n"&gt;lst&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We need to call the Haskell compiler to read our file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;ghci 
&lt;span class="nv"&gt;$ &lt;/span&gt;:l lambdas.hs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And then call it like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;show_nums &lt;span class="o"&gt;[&lt;/span&gt;1,2,3,4,5]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbu6a46yr2oaykm9kiufg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbu6a46yr2oaykm9kiufg.png" alt="Lambdas" width="800" height="208"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;While this is simple, we don’t really need the &lt;strong&gt;func&lt;/strong&gt; function, so let’s change the source code like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight haskell"&gt;&lt;code&gt;&lt;span class="n"&gt;show_lambdas&lt;/span&gt; &lt;span class="o"&gt;::&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;Integer&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;Integer&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;show_lambdas&lt;/span&gt; &lt;span class="n"&gt;lst&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;map&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;\&lt;/span&gt;&lt;span class="n"&gt;xs&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;xs&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;lst&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And it will yield the same exact result, but with half the code lines:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnexaqgu6mersxj5c8e5y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnexaqgu6mersxj5c8e5y.png" alt="Lambdas again" width="800" height="205"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Closures
&lt;/h1&gt;

&lt;p&gt;A closure is a function inside a function that gets access to its parent function variables. Sounds strange, huh? Let’s see an Erlang example:&lt;/p&gt;

&lt;p&gt;We’re going to write this example on a file called &lt;strong&gt;closures.erl&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight erlang"&gt;&lt;code&gt;&lt;span class="p"&gt;-&lt;/span&gt;&lt;span class="ni"&gt;module&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;closures&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt;&lt;span class="ni"&gt;export&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]).&lt;/span&gt;
&lt;span class="nf"&gt;start&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;Name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;
  &lt;span class="nv"&gt;GreetPerson&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;fun&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;
    &lt;span class="nn"&gt;io&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nf"&gt;format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Hello and welcome &lt;/span&gt;&lt;span class="si"&gt;~s&lt;/span&gt;&lt;span class="s"&gt;.&lt;/span&gt;&lt;span class="si"&gt;~n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;Name&lt;/span&gt;&lt;span class="p"&gt;]),&lt;/span&gt;
    &lt;span class="k"&gt;fun&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nn"&gt;io&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nf"&gt;format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Goodbye &lt;/span&gt;&lt;span class="si"&gt;~s&lt;/span&gt;&lt;span class="s"&gt;. Nice to meet you.&lt;/span&gt;&lt;span class="si"&gt;~n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;Name&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="k"&gt;end&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nv"&gt;Greet&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;GreetPerson&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
  &lt;span class="nv"&gt;Greet&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To run this we need to compile the file first by typing on the terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;erlc closures.erl
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A &lt;strong&gt;closures.beam&lt;/strong&gt; file gets generated, which is a file that will be interpreted by the Erlang VM.&lt;/p&gt;

&lt;p&gt;After compilation, we need to open the &lt;strong&gt;Erlang VM&lt;/strong&gt; and run it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;erl

&lt;span class="nv"&gt;$ &lt;/span&gt;closures:start&lt;span class="o"&gt;(&lt;/span&gt;“Blag”&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will run and execute our code:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3nk6o3kvtodfdwllz47w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3nk6o3kvtodfdwllz47w.png" alt="Closures" width="800" height="239"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here we can see that by calling &lt;strong&gt;Greet = GreetPerson()&lt;/strong&gt;, we’re assigning the function &lt;strong&gt;GreetPerson()&lt;/strong&gt; to the variable &lt;strong&gt;Greet&lt;/strong&gt;. When we call &lt;strong&gt;Greet()&lt;/strong&gt;, we’re greeting the person, but we’re also running an anonymous function that will say goodbye to the user. Notice that we’re not calling this anonymous function directly.&lt;/p&gt;

&lt;h1&gt;
  
  
  List Comprehensions
&lt;/h1&gt;

&lt;p&gt;List comprehensions are a way to build or modify lists, and it is worth mentioning that lists are the most used type in functional programming.&lt;/p&gt;

&lt;p&gt;Using list comprehensions, we could rewrite the lambdas example. This time, let’s use Erlang and create a file called &lt;strong&gt;list_comprehensions.erl&lt;/strong&gt; with the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight erlang"&gt;&lt;code&gt;&lt;span class="p"&gt;-&lt;/span&gt;&lt;span class="ni"&gt;module&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;list_comprehensions&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt;&lt;span class="ni"&gt;export&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]).&lt;/span&gt;
&lt;span class="nf"&gt;start&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;List&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; 
  &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;X&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt; &lt;span class="p"&gt;||&lt;/span&gt; &lt;span class="nv"&gt;X&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;-&lt;/span&gt; &lt;span class="nv"&gt;List&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When we run this, it will return the same result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frmwh8gbp9splzm4f85nx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frmwh8gbp9splzm4f85nx.png" alt="List comprehensions" width="800" height="220"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Recursion
&lt;/h1&gt;

&lt;p&gt;When using Recursion, a function calls itself multiple times, and this is not a foreign topic on non-functional programming languages, but the way it’s implemented and used is for sure different.&lt;/p&gt;

&lt;p&gt;To make more sense of this, let’s see how a factorial source will look like in &lt;a href="https://www.ruby-lang.org/en/" rel="noopener noreferrer"&gt;Ruby&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;fact&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
    &lt;span class="mi"&gt;1&lt;/span&gt;
  &lt;span class="k"&gt;else&lt;/span&gt;
    &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;fact&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="nb"&gt;puts&lt;/span&gt; &lt;span class="n"&gt;fact&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can write the same on &lt;strong&gt;Haskell&lt;/strong&gt;, like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight haskell"&gt;&lt;code&gt;&lt;span class="n"&gt;factorial&lt;/span&gt; &lt;span class="o"&gt;::&lt;/span&gt; &lt;span class="kt"&gt;Int&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;Int&lt;/span&gt;
&lt;span class="n"&gt;factorial&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="n"&gt;factorial&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;factorial&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The code is shorter and simpler:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdp11q087hf5jzd5d6i67.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdp11q087hf5jzd5d6i67.png" alt="Factorial" width="800" height="212"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And that’s it for a small introduction to functional programming.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwjno1njbsv0xxl1raupc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwjno1njbsv0xxl1raupc.png" alt="Functional Programming" width="800" height="1153"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Like what you read but looking for some Nylas content, make sure to check our great selection of &lt;a href="https://www.nylas.com/blog/" rel="noopener noreferrer"&gt;blog posts&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Don’t miss the action, watch our LiveStream Coding with Nylas:&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/NIB6eg_Zkew"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>haskell</category>
      <category>erlang</category>
      <category>functional</category>
    </item>
    <item>
      <title>Send and Read Emails Using Node-Red and the Nylas APIs</title>
      <dc:creator>Alvaro (Blag) Tejada Galindo</dc:creator>
      <pubDate>Fri, 16 Dec 2022 15:54:17 +0000</pubDate>
      <link>https://forem.com/nylas/send-and-read-emails-using-node-red-and-the-nylas-apis-2g50</link>
      <guid>https://forem.com/nylas/send-and-read-emails-using-node-red-and-the-nylas-apis-2g50</guid>
      <description>&lt;p&gt;If you’re a regular reader of our DevRel blogs, you might know that we had published several blogs on how to send and read emails using Nylas SDKs for languages like &lt;a href="https://www.nylas.com/blog/how-to-send-emails-with-the-nylas-python-sdk/" rel="noopener noreferrer"&gt;Python&lt;/a&gt;, &lt;a href="https://www.nylas.com/blog/how-to-send-emails-with-the-nylas-ruby-sdk/" rel="noopener noreferrer"&gt;Ruby&lt;/a&gt;, &lt;a href="https://www.nylas.com/blog/how-to-send-emails-with-nylas-node-sdk/" rel="noopener noreferrer"&gt;NodeJS&lt;/a&gt; and &lt;a href="https://www.nylas.com/blog/how-to-send-emails-with-the-nylas-java-sdk-dev/" rel="noopener noreferrer"&gt;Java&lt;/a&gt;. We also have talked about using &lt;a href="https://www.youtube.com/watch?v=MteeGtWaK54&amp;amp;list=PLk-4iahO3b-xd42-RL4DJQyuEoFFYwTbC&amp;amp;index=6&amp;amp;t=735s" rel="noopener noreferrer"&gt;PHP&lt;/a&gt;,  &lt;a href="https://www.youtube.com/watch?v=7gqnMf15fAA&amp;amp;list=PLk-4iahO3b-xd42-RL4DJQyuEoFFYwTbC&amp;amp;index=7&amp;amp;t=836s" rel="noopener noreferrer"&gt;C#, and Rust&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Today, we’re going to learn how to send and read emails using &lt;a href="https://nodered.org" rel="noopener noreferrer"&gt;Node-Red&lt;/a&gt;, a low-code programming environment based on NodeJS, that is mostly used for IoT scenarios.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing Node-Red
&lt;/h2&gt;

&lt;p&gt;We can use npm to install Node-Red by typing the following in the terminal window:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; &lt;span class="nt"&gt;--unsafe-perm&lt;/span&gt; node-red
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;If you’re on Windows, don’t use sudo.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Once installed, we can simply call it from the terminal like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;node-red
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpjioa270zgidg8n38ib5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpjioa270zgidg8n38ib5.png" alt="Running Node-Red" width="800" height="392"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And it will run the editor on the following address:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;http://127.0.0.1:1880/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The Node-Red environment
&lt;/h2&gt;

&lt;p&gt;Being a visual environment, we can simply drag and drop elements into the canvas, and connect them via wires:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxpwqy75xqj3lw2prcfaj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxpwqy75xqj3lw2prcfaj.png" alt="Node-Red example" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing Nodes
&lt;/h2&gt;

&lt;p&gt;In Node-Red, we can install additional &lt;strong&gt;Nodes&lt;/strong&gt; that will help us in making our work easier.&lt;/p&gt;

&lt;p&gt;We’re going to install &lt;a href="https://flows.nodered.org/node/node-red-contrib-sysmessage" rel="noopener noreferrer"&gt;sysmessage&lt;/a&gt;, a node that will allow us to create notifications in a simple and easy way.&lt;/p&gt;

&lt;p&gt;First, we need to press the menu button on the right hand side:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpx2q397nfzqzu5erlgli.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpx2q397nfzqzu5erlgli.png" alt="Deploy Nodes" width="762" height="412"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then select &lt;strong&gt;Manage Palette&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftd7b8hiozgg3nld3h6ir.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftd7b8hiozgg3nld3h6ir.png" alt="Manage Palette" width="583" height="1024"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then, on the &lt;strong&gt;Install&lt;/strong&gt; tab, type &lt;strong&gt;sysm&lt;/strong&gt; (to bring up autocompletion) on the search box and click on &lt;strong&gt;Install&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Felm1vh5vzshxj3cnt6rn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Felm1vh5vzshxj3cnt6rn.png" alt="sysmessage package" width="800" height="309"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once installed, a new node will appear on the left section on our canvas:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F88o98tqt23g1ayvpv1ik.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F88o98tqt23g1ayvpv1ik.png" alt="sysmessage installed" width="350" height="580"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Sending an email
&lt;/h2&gt;

&lt;p&gt;Now, we’re ready to send our email.&lt;/p&gt;

&lt;p&gt;First, we’re going to select an Inject node and drag it into the canvas:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F39bc0vpw9q94lplx8zjs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F39bc0vpw9q94lplx8zjs.png" alt="Inject node" width="358" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With a double click, we can access its properties. We want to delete the &lt;strong&gt;msg.topic&lt;/strong&gt; message:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1m73gu064rqj1d9cgxoj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1m73gu064rqj1d9cgxoj.png" alt="define msg.topic" width="800" height="418"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We need to choose &lt;strong&gt;timestamp&lt;/strong&gt; and change it for &lt;strong&gt;JSON&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftw60jvxs1wsy72v6i6lz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftw60jvxs1wsy72v6i6lz.png" alt="JSON payload" width="800" height="403"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then, select the three points to expand the editor:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ficak8m00v9xuyghxlvfy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ficak8m00v9xuyghxlvfy.png" alt="Expands JSON editor" width="800" height="225"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And paste the following JSON code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"subject"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Hello from Node-Red"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"to"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
       &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
           &lt;/span&gt;&lt;span class="nl"&gt;"email"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"devrel@nylas.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
           &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Nylas' DevRel Team"&lt;/span&gt;&lt;span class="w"&gt;
       &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"body"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"This email was sent using Node-Red and the Nylas APIs."&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, we’re going to drag an http request node:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzkg4q35yubzhv34wa8bo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzkg4q35yubzhv34wa8bo.png" alt="http request node" width="360" height="510"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here, we need to change the Method to &lt;strong&gt;POST&lt;/strong&gt; and pass the Nylas Send Endpoint which is &lt;strong&gt;&lt;a href="https://api.nylas.com/send" rel="noopener noreferrer"&gt;https://api.nylas.com/send&lt;/a&gt;&lt;/strong&gt;. Then, we need to tick on &lt;strong&gt;Use authentication&lt;/strong&gt; and select &lt;strong&gt;bearer authentication&lt;/strong&gt; and pass our access token. Lastly, we need to add a couple of headers, &lt;strong&gt;Accept&lt;/strong&gt; and &lt;strong&gt;Content-Type&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdcuabgkwgz24oqoqpo2q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdcuabgkwgz24oqoqpo2q.png" alt="Configure http request" width="800" height="990"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once that’s done, we need to drag and add the &lt;strong&gt;sysmessage&lt;/strong&gt; node and configure it like this; Choose the type of alert, OSX Alert in this case, and add an appropriate title. Leave the rest as it is.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkmksmyluvgtgrw1ussgi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkmksmyluvgtgrw1ussgi.png" alt="Configure Sysmessage" width="800" height="604"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Connect all the nodes with wires so it will look like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsm6b4aagwbxjiw7kz536.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsm6b4aagwbxjiw7kz536.png" alt="Send email layout" width="800" height="192"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Or, you can simply copy and paste the following &lt;a href="https://gist.github.com/atejada/55ad2a61c57545750acf864deb896917" rel="noopener noreferrer"&gt;JSON code&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Paste the JSON code and press &lt;strong&gt;Import&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqj67cta6gm4qp8q1ojvb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqj67cta6gm4qp8q1ojvb.png" alt="JSON Email Send Code" width="800" height="676"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We should have all &lt;strong&gt;nodes&lt;/strong&gt; ready to be pasted. Once we finish, we can press the &lt;strong&gt;Deploy&lt;/strong&gt; button, which is located next to the menu button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff5x3o5on4r75ptn0qpe0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff5x3o5on4r75ptn0qpe0.png" alt="Deploy nodes" width="762" height="412"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once deployed, we just need to press the Inject note in order to send the email and get the notification message.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj61ueuazvblqlr4l7uwl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj61ueuazvblqlr4l7uwl.png" alt="Click inject send email" width="800" height="191"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Also, we will get the JSON response back from calling the Nylas API.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqhn8tp7yqbi4lpiwhbh0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqhn8tp7yqbi4lpiwhbh0.png" alt="Send email response" width="565" height="1024"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With minimal effort and no code, we sent an email using Node-Red and the Nylas APIs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reading Emails
&lt;/h2&gt;

&lt;p&gt;Sending email was simple and almost straightforward, but reading email gets a little bit complicated. No worries, it will be fun.&lt;/p&gt;

&lt;p&gt;First, we’re going to create an http in node.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzxrrgcyfhd84n74cdinc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzxrrgcyfhd84n74cdinc.png" alt="http in node" width="344" height="434"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And configure it like this:&lt;/p&gt;

&lt;p&gt;The method is &lt;strong&gt;GET&lt;/strong&gt;, the &lt;strong&gt;URL&lt;/strong&gt; will include &lt;strong&gt;/:limit&lt;/strong&gt; which is going to how many emails we want to fetch and the &lt;strong&gt;Name&lt;/strong&gt; is actually optional.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkpoynm2xln53orrygwmu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkpoynm2xln53orrygwmu.png" alt="define GetEmails with limit" width="800" height="389"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can also add an extra http in node and get the URL but without the /:limit as this will help us to define a default page.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8ov2hy7mdvlxqd5zkqvl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8ov2hy7mdvlxqd5zkqvl.png" alt="define GetEmails without limit" width="800" height="368"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We’re going to add a Change node. This will allow us to read the /:limit parameter from before.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhdb187eo18xbm2ek757x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhdb187eo18xbm2ek757x.png" alt="change node" width="358" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The name is optional, but the SET and to the value are very important. We’re getting the parameter value and assigning it to the payload.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F481rn36u5zbrf3xogmh0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F481rn36u5zbrf3xogmh0.png" alt="change payload" width="800" height="473"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This parameter is going to be a String, but we need an Integer. So, we need to add a Function node and type the following:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyvj891zv7jiorm1mc5cj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyvj891zv7jiorm1mc5cj.png" alt="Function node" width="358" height="352"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;payload&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
   &lt;span class="nx"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;payload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;5&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nx"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;payload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This code will simply check if we are passing or not the &lt;strong&gt;:limit&lt;/strong&gt; parameter and if we’re not, pass &lt;strong&gt;5&lt;/strong&gt; as the limit, then it will convert the &lt;strong&gt;String&lt;/strong&gt; parameter to an &lt;strong&gt;Integer&lt;/strong&gt; parameter.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fumhpap3bk1h9scvh9ubt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fumhpap3bk1h9scvh9ubt.png" alt="To number function" width="800" height="364"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The next step will be to add an &lt;strong&gt;http request&lt;/strong&gt; node. It will be the same as &lt;strong&gt;Sending an email&lt;/strong&gt; but the URL would be&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://api.nylas.com/messages?in=inbox&amp;amp;limit={{{payload}}}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
 and the return will be a &lt;strong&gt;parsed JSON object&lt;/strong&gt; instead of a &lt;strong&gt;UTF-8 String&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2z7132ywa8suwsio5vz7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2z7132ywa8suwsio5vz7.png" alt="Define read email as JSON" width="704" height="1024"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On the URL,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;**https://api.nylas.com/messages?in=inbox&amp;amp;limit={{{payload}}}**
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
 the &lt;strong&gt;in=inbox&lt;/strong&gt; part means that we’re reading mail coming from the inbox only, and the&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;**limit={{{payload}}}**
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
 means that the amount of emails that we want to fetch would be the same as the number we used as parameter.&lt;/p&gt;

&lt;p&gt;We’re going to get back an array of emails, and we need to access them one by one, so our best choice is to use the &lt;strong&gt;split&lt;/strong&gt; node:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnuwi4qea90oqtojd9v82.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnuwi4qea90oqtojd9v82.png" alt="split node to split the array of emails" width="350" height="442"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This node will grab each item in the array of emails. What we want to do is to change the format of the date field, as it is currently displayed as &lt;strong&gt;Epoch&lt;/strong&gt; (number of seconds since January 01, 1970) and we want something more human readable. The best thing is that we don’t need to modify any property of this node; we can use it just as it comes.&lt;/p&gt;

&lt;p&gt;This is the code for the function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;date&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;date&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;toLocaleString&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6ppdrpoe7m1rjz2a4mey.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6ppdrpoe7m1rjz2a4mey.png" alt="Change the format" width="800" height="295"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once we’re done fixing the dates, it’s time to make the elements an array again, and for that we need to use the &lt;strong&gt;join&lt;/strong&gt; node, which in the same manner as &lt;strong&gt;split&lt;/strong&gt;, can be used without any further modifications.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjid2z9bdpyu9lugos8wb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjid2z9bdpyu9lugos8wb.png" alt="Join node" width="358" height="452"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once the array is ready and back in place, we need to display the information from the emails, and for that we can use the &lt;strong&gt;template&lt;/strong&gt; node. This node uses the &lt;a href="https://mustache.github.io" rel="noopener noreferrer"&gt;mustache&lt;/a&gt; system, which is a logicless template engine for creating dynamic content. In other words, it generates HTML code by using tags that are replaced by code.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzc6n3v8e7b4v8l1jehs2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzc6n3v8e7b4v8l1jehs2.png" alt="Template node to display emails inbox" width="356" height="510"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is the code that we will need to use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
       &lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"https://cdn.tailwindcss.com"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;h1&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"font-black"&lt;/span&gt; &lt;span class="na"&gt;style=&lt;/span&gt;&lt;span class="s"&gt;"text-align:center"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Inbox&lt;span class="nt"&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;table&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"table-auto"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;tr&amp;gt;&lt;/span&gt;
       &lt;span class="nt"&gt;&amp;lt;th&amp;gt;&lt;/span&gt;Subject&lt;span class="nt"&gt;&amp;lt;/th&amp;gt;&lt;/span&gt;
       &lt;span class="nt"&gt;&amp;lt;th&amp;gt;&lt;/span&gt;From (Name)&lt;span class="nt"&gt;&amp;lt;/th&amp;gt;&lt;/span&gt;
       &lt;span class="nt"&gt;&amp;lt;th&amp;gt;&lt;/span&gt;From (Email)&lt;span class="nt"&gt;&amp;lt;/th&amp;gt;&lt;/span&gt;
       &lt;span class="nt"&gt;&amp;lt;th&amp;gt;&lt;/span&gt;Date&lt;span class="nt"&gt;&amp;lt;/th&amp;gt;&lt;/span&gt;
       &lt;span class="nt"&gt;&amp;lt;th&amp;gt;&lt;/span&gt;Snippet&lt;span class="nt"&gt;&amp;lt;/th&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;/tr&amp;gt;&lt;/span&gt;
   {{#payload}}
   &lt;span class="nt"&gt;&amp;lt;tr&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;td&amp;gt;&lt;/span&gt;
   {{subject}}
   &lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;td&amp;gt;&lt;/span&gt;
   {{from.0.name}}
   &lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;td&amp;gt;&lt;/span&gt;
   {{from.0.email}}
   &lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;   
   &lt;span class="nt"&gt;&amp;lt;td&amp;gt;&lt;/span&gt;
   {{date}}
   &lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;   
   &lt;span class="nt"&gt;&amp;lt;td&amp;gt;&lt;/span&gt;
   {{snippet}}
   &lt;span class="nt"&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;/tr&amp;gt;&lt;/span&gt;
   {{/payload}}
&lt;span class="nt"&gt;&amp;lt;/table&amp;gt;&lt;/span&gt; 
&lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will simply create a table, loop each record of the array and print out the subject, name and email of sender, date and the snippet (email preview).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm93f3u28xff6nfao6v37.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm93f3u28xff6nfao6v37.png" alt="Define payload template" width="604" height="1024"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The last piece is the http response node which will allow us to see the template on the web browser.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F46zzwqxmnb74957jutle.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F46zzwqxmnb74957jutle.png" alt="http response node" width="358" height="508"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We don’t need to change anything on this node.&lt;/p&gt;

&lt;p&gt;Once we click on &lt;strong&gt;Deploy&lt;/strong&gt;, we can start testing.&lt;/p&gt;

&lt;p&gt;Our canvas should look like this one:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr5avh1fhngn1te734knu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr5avh1fhngn1te734knu.png" alt="Read emails layout" width="800" height="271"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And of course, we can import the following &lt;a href="https://gist.github.com/atejada/a42461a3aafb929c5d04ecc9e7b43f40" rel="noopener noreferrer"&gt;JSON code&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;On our browser of choice, we need to navigate to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;http://localhost:1880/GetEmails
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And we will get the first five emails in our inbox:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffbyqcp2ui1e85zz08w35.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffbyqcp2ui1e85zz08w35.png" alt="Read first five emails" width="800" height="136"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And we can also pass parameters, so calling it this way:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;http://localhost:1880/GetEmails/1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will fetch just one email.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2vxxigz3n25hlzgz6qpt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2vxxigz3n25hlzgz6qpt.png" alt="Read just one image" width="800" height="67"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can choose any number from one to one hundred (as that’s currently the fetch limit).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F57quncstomq7w1ewuem9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F57quncstomq7w1ewuem9.png" alt="Read three emails" width="800" height="107"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And that’s it. Hope you like this one. Sending and reading emails using Node-Red and the Nylas APIs is both fast and easy.&lt;/p&gt;

&lt;p&gt;If you want to learn more about email management with Nylas, visit our documentation page &lt;a href="https://developer.nylas.com/docs/connectivity/email/" rel="noopener noreferrer"&gt;Email API Overview&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Watch the &lt;a href="https://www.youtube.com/watch?v=zxsiXHAPffQ" rel="noopener noreferrer"&gt;Coding with Nylas episode 18 - Send and Read emails using Node-Red&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>node</category>
      <category>api</category>
      <category>iot</category>
    </item>
    <item>
      <title>How to Send an Email in Any Language Using the Nylas APIs</title>
      <dc:creator>Alvaro (Blag) Tejada Galindo</dc:creator>
      <pubDate>Wed, 14 Dec 2022 08:49:31 +0000</pubDate>
      <link>https://forem.com/nylas/how-to-send-an-email-in-any-language-using-the-nylas-apis-5c47</link>
      <guid>https://forem.com/nylas/how-to-send-an-email-in-any-language-using-the-nylas-apis-5c47</guid>
      <description>&lt;p&gt;If you’ve been reading our posts, then you know how to send emails using &lt;a href="https://www.nylas.com/blog/how-to-send-emails-with-the-nylas-ruby-sdk/" rel="noopener noreferrer"&gt;Ruby&lt;/a&gt;, &lt;a href="https://www.nylas.com/blog/how-to-send-emails-with-the-nylas-python-sdk/" rel="noopener noreferrer"&gt;Python&lt;/a&gt; and &lt;a href="https://www.nylas.com/blog/how-to-send-emails-with-nylas-node-sdk/" rel="noopener noreferrer"&gt;Node&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;But you may be wondering, can I use something else? Can I use PHP, Rust or C#?&lt;/p&gt;

&lt;p&gt;Well, the simple answer is yes, we absolutely can. Nylas provides APIs, not only SDKs, so we can use any available programming language that supports Rest API calls.&lt;/p&gt;

&lt;p&gt;We’re going to display some examples and take them more as a proof-of-concept than real applications. There are several ways to consume APIs and the intention of this blog post is just to show one way of doing that.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sending an Email using PHP and Nylas Apis
&lt;/h2&gt;

&lt;p&gt;First, we need to have &lt;a href="https://www.php.net" rel="noopener noreferrer"&gt;PHP&lt;/a&gt; installed as well as &lt;a href="https://getcomposer.org" rel="noopener noreferrer"&gt;Composer&lt;/a&gt; (A dependency manager for PHP). Using Composer, we need to install &lt;a href="https://github.com/vlucas/phpdotenv" rel="noopener noreferrer"&gt;dotenv&lt;/a&gt; which will allow us to read .env files.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;composer require vlucas/phpdotenv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Inside the .env file we need to pass our access token that we can easily gather from the &lt;a href="https://dashboard.nylas.com" rel="noopener noreferrer"&gt;Nylas Dashboard&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;ACCESS_TOKEN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;access_token
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, we can create our script and call it &lt;strong&gt;SendEmail.php&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;!DOCTYPE HTML&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class="c1"&gt;# Import your dependencies&lt;/span&gt;
&lt;span class="k"&gt;require_once&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'vendor/autoload.php'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;# Load env variables&lt;/span&gt;
&lt;span class="nv"&gt;$dotenv&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Dotenv\Dotenv&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;createImmutable&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;__DIR__&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nv"&gt;$dotenv&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;load&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="c1"&gt;# Initialize variables&lt;/span&gt;
&lt;span class="nv"&gt;$result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;# If we're working with a POST method&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$_SERVER&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"REQUEST_METHOD"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"POST"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="c1"&gt;# Required fields for Email API&lt;/span&gt;
&lt;span class="nv"&gt;$fields&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="s1"&gt;'subject'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$_POST&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"subject"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
            &lt;span class="s1"&gt;'body'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$_POST&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"body"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
            &lt;span class="s1"&gt;'to'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;array&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
                 &lt;span class="s1"&gt;'name'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$_POST&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"to_name"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
                 &lt;span class="s1"&gt;'email'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$_POST&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"to_email"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
            &lt;span class="p"&gt;]),&lt;/span&gt;
        &lt;span class="p"&gt;);&lt;/span&gt;  

&lt;span class="c1"&gt;# Headers with Authorization and type&lt;/span&gt;
&lt;span class="nv"&gt;$headr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;array&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nv"&gt;$headr&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Accept: application/json'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$headr&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Content-type: application/json'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$headr&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Authorization: Bearer '&lt;/span&gt; &lt;span class="mf"&gt;.&lt;/span&gt; &lt;span class="nv"&gt;$_ENV&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'ACCESS_TOKEN'&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="c1"&gt;# Call the Send Email API&lt;/span&gt;
&lt;span class="nv"&gt;$ch&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;curl_init&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s2"&gt;"https://api.nylas.com/send"&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;# Encode the data as JSON&lt;/span&gt;
&lt;span class="nv"&gt;$payload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;json_encode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nv"&gt;$fields&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;# Submit the Email information&lt;/span&gt;
&lt;span class="nb"&gt;curl_setopt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nv"&gt;$ch&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;CURLOPT_POSTFIELDS&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$payload&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;# Submit the Headers&lt;/span&gt;
&lt;span class="nb"&gt;curl_setopt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nv"&gt;$ch&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;CURLOPT_HTTPHEADER&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$headr&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;# We're doing a POST&lt;/span&gt;
&lt;span class="nb"&gt;curl_setopt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$ch&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;CURLOPT_POST&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;# Return response instead of printing.&lt;/span&gt;
&lt;span class="nb"&gt;curl_setopt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nv"&gt;$ch&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;CURLOPT_RETURNTRANSFER&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;# Send request.&lt;/span&gt;
&lt;span class="nv"&gt;$result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;curl_exec&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$ch&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;# Close request&lt;/span&gt;
&lt;span class="nb"&gt;curl_close&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$ch&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!-- Create the Form --&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;h2&amp;gt;&lt;/span&gt;Send an Email using PHP and the Nylas APIs&lt;span class="nt"&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;form&lt;/span&gt; &lt;span class="na"&gt;method=&lt;/span&gt;&lt;span class="s"&gt;"post"&lt;/span&gt; &lt;span class="na"&gt;action=&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt; &lt;span class="k"&gt;echo&lt;/span&gt; &lt;span class="nb"&gt;htmlspecialchars&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$_SERVER&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"PHP_SELF"&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;&lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    To Name: &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"to_name"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/span&gt;
    To Email: &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"to_email"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/span&gt;    
    Subject: &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"subject"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/span&gt;
    Body: &lt;span class="nt"&gt;&amp;lt;textarea&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"body"&lt;/span&gt; &lt;span class="na"&gt;rows=&lt;/span&gt;&lt;span class="s"&gt;"5"&lt;/span&gt; &lt;span class="na"&gt;cols=&lt;/span&gt;&lt;span class="s"&gt;"40"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/textarea&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"submit"&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"submit"&lt;/span&gt; &lt;span class="na"&gt;value=&lt;/span&gt;&lt;span class="s"&gt;"Submit"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt; 
    &lt;span class="nt"&gt;&amp;lt;/form&amp;gt;&lt;/span&gt;

&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt;
    &lt;span class="k"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$result&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;  

&lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead of saving this on our Apache folder, we will keep it where our PHP scripts reside and simply type this on the terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;php &lt;span class="nt"&gt;-S&lt;/span&gt; 127.0.0.1:8000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will call PHP’s internal web server. Going to our favourite browser we can pass the following address:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;http://localhost:8000/SendEmail.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And a form will be displayed:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhl9c0a0zwqgy2a598h3r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhl9c0a0zwqgy2a598h3r.png" alt="PHP Email Form" width="800" height="589"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We need to fill in the recipient’s name, the recipient’s email, the subject and the body of the email. Once we press Submit, we will get a raw response indicating that everything was fine.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq8of011143068vps8ak3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq8of011143068vps8ak3.png" alt="PHP Email Delivered" width="800" height="199"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The email was successfully delivered.&lt;/p&gt;

&lt;p&gt;You can check the Github repo &lt;a href="https://github.com/nylas-samples/php_send_and_read_emails" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You can watch the LiveStream video &lt;a href="https://www.youtube.com/watch?v=MteeGtWaK54&amp;amp;list=PLk-4iahO3b-xd42-RL4DJQyuEoFFYwTbC&amp;amp;index=6&amp;amp;t=750s" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sending an Email using Rust and Nylas Apis
&lt;/h2&gt;

&lt;p&gt;Next, let’s use &lt;a href="https://www.rust-lang.org" rel="noopener noreferrer"&gt;Rust&lt;/a&gt;. We’re going to use Cargo (Rust’s Dependency Manager) which is bundled inside Rust.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;cargo new send_email
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will create two different files. The first one called &lt;strong&gt;Cargo.toml&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight toml"&gt;&lt;code&gt;&lt;span class="nn"&gt;[package]&lt;/span&gt;
&lt;span class="py"&gt;name&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"send_email"&lt;/span&gt;
&lt;span class="py"&gt;version&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"0.1.0"&lt;/span&gt;
&lt;span class="py"&gt;edition&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"2021"&lt;/span&gt;

&lt;span class="c"&gt;# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html&lt;/span&gt;

&lt;span class="nn"&gt;[dependencies]&lt;/span&gt;
&lt;span class="py"&gt;reqwest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="py"&gt;version&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"0.11"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="py"&gt;features&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"json"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="c"&gt;# reqwest with JSON parsing support&lt;/span&gt;
&lt;span class="py"&gt;futures&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"0.3"&lt;/span&gt; &lt;span class="c"&gt;# for our async / await blocks&lt;/span&gt;
&lt;span class="py"&gt;tokio&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="py"&gt;version&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"1.12.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="py"&gt;features&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"full"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="c"&gt;# for our async runtime&lt;/span&gt;
&lt;span class="py"&gt;serde_json&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"1.0"&lt;/span&gt; &lt;span class="c"&gt;#to handle json&lt;/span&gt;
&lt;span class="py"&gt;dotenv&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"0.15.0"&lt;/span&gt; &lt;span class="c"&gt;# for reading .env file&lt;/span&gt;

&lt;span class="nn"&gt;[profile.release]&lt;/span&gt;
&lt;span class="py"&gt;opt-level&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;'z'&lt;/span&gt;     &lt;span class="c"&gt;# Optimize for size.&lt;/span&gt;
&lt;span class="py"&gt;lto&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;          &lt;span class="c"&gt;# Enable Link Time Optimization&lt;/span&gt;
&lt;span class="py"&gt;codegen-units&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;   &lt;span class="c"&gt;# Reduce the number of codegen units to increase optimizations.&lt;/span&gt;
&lt;span class="py"&gt;panic&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;'abort'&lt;/span&gt;     &lt;span class="c"&gt;# Abort on panic&lt;/span&gt;
&lt;span class="py"&gt;strip&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;        &lt;span class="c"&gt;# Strip symbols from binary*&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The second one called &lt;strong&gt;main.rs&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Import your dependencies&lt;/span&gt;
&lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="n"&gt;reqwest&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;//HTTP Client&lt;/span&gt;
&lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="nn"&gt;std&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;io&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="nn"&gt;serde_json&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;//Json handler&lt;/span&gt;
&lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="nn"&gt;std&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// tokio let's us use "async" on our main function&lt;/span&gt;
&lt;span class="nd"&gt;#[tokio::main]&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

&lt;span class="c1"&gt;// Read the .env file&lt;/span&gt;
&lt;span class="nn"&gt;dotenv&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;dotenv&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="nf"&gt;.expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Failed to read .env file"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Add the ACCESS_TOKEN to the Authorization string&lt;/span&gt;
&lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="k"&gt;mut&lt;/span&gt; &lt;span class="n"&gt;_access_token&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;String&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="n"&gt;_access_token&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Bearer "&lt;/span&gt;&lt;span class="nf"&gt;.to_owned&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;  &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nn"&gt;env&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"ACCESS_TOKEN"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="nf"&gt;.expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Not found"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Request the parameters&lt;/span&gt;
&lt;span class="nd"&gt;println!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Enter a subject: "&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="k"&gt;mut&lt;/span&gt; &lt;span class="n"&gt;_subject&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;String&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nn"&gt;io&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;stdin&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="nf"&gt;.read_line&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="k"&gt;mut&lt;/span&gt; &lt;span class="n"&gt;_subject&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
             &lt;span class="nf"&gt;.expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"failed to read"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nd"&gt;println!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Enter a name: "&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="k"&gt;mut&lt;/span&gt; &lt;span class="n"&gt;_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;String&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nn"&gt;io&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;stdin&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="nf"&gt;.read_line&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="k"&gt;mut&lt;/span&gt; &lt;span class="n"&gt;_name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
              &lt;span class="nf"&gt;.expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"failed to read"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nd"&gt;println!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Enter an email: "&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;   
&lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="k"&gt;mut&lt;/span&gt; &lt;span class="n"&gt;_email&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;String&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nn"&gt;io&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;stdin&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="nf"&gt;.read_line&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="k"&gt;mut&lt;/span&gt; &lt;span class="n"&gt;_email&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
              &lt;span class="nf"&gt;.expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"failed to read"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nd"&gt;println!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Enter the body: "&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;              
&lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="k"&gt;mut&lt;/span&gt; &lt;span class="n"&gt;_body&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;String&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nn"&gt;io&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;stdin&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="nf"&gt;.read_line&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="k"&gt;mut&lt;/span&gt; &lt;span class="n"&gt;_body&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
              &lt;span class="nf"&gt;.expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"failed to read"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;trim_subject&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;_subject&lt;/span&gt;&lt;span class="nf"&gt;.trim&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;trim_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;_name&lt;/span&gt;&lt;span class="nf"&gt;.trim&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;trim_email&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;_email&lt;/span&gt;&lt;span class="nf"&gt;.trim&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;trim_body&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;_body&lt;/span&gt;&lt;span class="nf"&gt;.trim&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="c1"&gt;// Create the JSON structure&lt;/span&gt;
&lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;_fields&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nd"&gt;json!&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="s"&gt;"subject"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;trim_subject&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s"&gt;"to"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="s"&gt;"email"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;trim_email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="s"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;trim_name&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;],&lt;/span&gt;
  &lt;span class="s"&gt;"body"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;trim_body&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;reqwest&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nn"&gt;Client&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;//Create HTTP client&lt;/span&gt;
    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="c1"&gt;//Call API passing parameters&lt;/span&gt;
        &lt;span class="nf"&gt;.post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"https://api.nylas.com/send"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nf"&gt;.header&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Authorization"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_access_token&lt;/span&gt;&lt;span class="nf"&gt;.to_string&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
        &lt;span class="nf"&gt;.header&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Content-type"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"application/json"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nf"&gt;.header&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Accept"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"application/json"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nf"&gt;.json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;_fields&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nf"&gt;.send&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="k"&gt;.await&lt;/span&gt;
        &lt;span class="nf"&gt;.unwrap&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="c1"&gt;// Give the back the result of panic if it fails&lt;/span&gt;
        &lt;span class="nf"&gt;.text&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="c1"&gt;// Convert it to plain text&lt;/span&gt;
        &lt;span class="k"&gt;.await&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="nd"&gt;println!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"{:?}"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We must not forget to create the &lt;strong&gt;.env&lt;/strong&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;ACCESS_TOKEN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;access_token
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once we have everything, we need to release our application by typing on the terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;cargo build &lt;span class="nt"&gt;--release&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once it’s has been built:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;./send_email
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff1bwa9o27p7hj5joc66y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff1bwa9o27p7hj5joc66y.png" alt="Rust Sent Email" width="800" height="521"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Just like in the PHP example, the email was successfully delivered.&lt;/p&gt;

&lt;p&gt;You can check the Github repo &lt;a href="https://github.com/nylas-samples/send_emails_rust_csharp" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You can watch the LiveStream video &lt;a href="https://www.youtube.com/watch?v=7gqnMf15fAA&amp;amp;list=PLk-4iahO3b-xd42-RL4DJQyuEoFFYwTbC&amp;amp;index=7&amp;amp;t=863s" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sending an Email using C# and Nylas Apis
&lt;/h2&gt;

&lt;p&gt;Finally, we’re going to use &lt;a href="https://dotnet.microsoft.com/en-us/languages/csharp" rel="noopener noreferrer"&gt;C#&lt;/a&gt;. And for this, we’re going to need to install &lt;a href="https://code.visualstudio.com" rel="noopener noreferrer"&gt;Visual Studio Code&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To start, let’s head to our Terminal and type the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;send_email &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;send_email
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once we created a new folder and entered that folder, we need to type:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;dotnet new console
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That will create the following files: &lt;strong&gt;Program.cs&lt;/strong&gt; and &lt;strong&gt;send_email.csproj&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now, we need to open Visual Studio Code and press &lt;strong&gt;Open&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhmgmpb4dceav292m0p0l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhmgmpb4dceav292m0p0l.png" alt="VSCode Open File" width="800" height="531"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then, choose your folder send_email and open it:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6qvudfqbzr4w59iwwvw1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6qvudfqbzr4w59iwwvw1.png" alt="VSCode choose folder" width="800" height="243"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This will open up the editor and your files.&lt;/p&gt;

&lt;p&gt;On &lt;strong&gt;send_email.csproj&lt;/strong&gt; we need to include the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;Project Sdk="Microsoft.NET.Sdk"&amp;gt;

 &amp;lt;PropertyGroup&amp;gt;
   &amp;lt;OutputType&amp;gt;Exe&amp;lt;/OutputType&amp;gt;
   &amp;lt;TargetFramework&amp;gt;net6.0&amp;lt;/TargetFramework&amp;gt;
   &amp;lt;ImplicitUsings&amp;gt;enable&amp;lt;/ImplicitUsings&amp;gt;
   &amp;lt;Nullable&amp;gt;enable&amp;lt;/Nullable&amp;gt;
 &amp;lt;/PropertyGroup&amp;gt;

 &amp;lt;ItemGroup&amp;gt;
   &amp;lt;PackageReference Include="DotNetEnv" Version="2.3.0" /&amp;gt;
   &amp;lt;PackageReference Include="RestSharp" Version="106.15" /&amp;gt;
 &amp;lt;/ItemGroup&amp;gt;

&amp;lt;/Project&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;strong&gt;RestSharp&lt;/strong&gt; package will help us to consume REST APIs and the &lt;strong&gt;DotNetEnv&lt;/strong&gt; will help us read &lt;strong&gt;.env&lt;/strong&gt; files&lt;/p&gt;

&lt;p&gt;This is the code for the &lt;strong&gt;Program.cs&lt;/strong&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Import packages&lt;/span&gt;
&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;RestSharp&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;System&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Load .env file&lt;/span&gt;
&lt;span class="n"&gt;DotNetEnv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Load&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="n"&gt;DotNetEnv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;TraversePath&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;Load&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="c1"&gt;// Ask via the user via console&lt;/span&gt;
&lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Enter subject:"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;_subject&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ReadLine&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Enter name:"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;_name&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ReadLine&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Enter email:"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;_email&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ReadLine&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Enter body:"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;_body&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ReadLine&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="c1"&gt;// Create a new Rest Client and call the Nylas API endpoint&lt;/span&gt;
&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;RestSharp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;RestClient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"https://api.nylas.com/send"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// Wait until the connection is done&lt;/span&gt;
&lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Timeout&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;-&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// We want a POST method&lt;/span&gt;
&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;RestSharp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;RestRequest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Method&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;POST&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// Adding header and authorization&lt;/span&gt;
&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;AddHeader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Content-Type"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"application/json"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;AddHeader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Authorization"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Bearer "&lt;/span&gt; &lt;span class="p"&gt;+&lt;/span&gt; &lt;span class="n"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Environment&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;GetEnvironmentVariable&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"ACCESS_TOKEN"&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

&lt;span class="c1"&gt;// Formatting the body of our request&lt;/span&gt;
&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;body&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;@"{"&lt;/span&gt;
   &lt;span class="p"&gt;+&lt;/span&gt; &lt;span class="s"&gt;"\n"&lt;/span&gt;
   &lt;span class="p"&gt;+&lt;/span&gt; &lt;span class="s"&gt;$@"    ""body"" : ""&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;_body&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s"&gt;"","&lt;/span&gt;
   &lt;span class="p"&gt;+&lt;/span&gt; &lt;span class="s"&gt;"\n"&lt;/span&gt;
   &lt;span class="p"&gt;+&lt;/span&gt; &lt;span class="s"&gt;$@"    ""subject"": ""&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;_subject&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s"&gt;"","&lt;/span&gt;
   &lt;span class="p"&gt;+&lt;/span&gt; &lt;span class="s"&gt;"\n"&lt;/span&gt;
   &lt;span class="p"&gt;+&lt;/span&gt; &lt;span class="s"&gt;$@"    ""to"": ["&lt;/span&gt;
   &lt;span class="p"&gt;+&lt;/span&gt; &lt;span class="s"&gt;"\n"&lt;/span&gt;
   &lt;span class="p"&gt;+&lt;/span&gt; &lt;span class="s"&gt;@"        {"&lt;/span&gt;
   &lt;span class="p"&gt;+&lt;/span&gt; &lt;span class="s"&gt;"\n"&lt;/span&gt;
   &lt;span class="p"&gt;+&lt;/span&gt; &lt;span class="s"&gt;$@"            ""name"": ""&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;_name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s"&gt;"","&lt;/span&gt;
   &lt;span class="p"&gt;+&lt;/span&gt; &lt;span class="s"&gt;"\n"&lt;/span&gt;
   &lt;span class="p"&gt;+&lt;/span&gt; &lt;span class="s"&gt;$@"            ""email"": ""&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;_email&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s"&gt;"""&lt;/span&gt;
   &lt;span class="p"&gt;+&lt;/span&gt; &lt;span class="s"&gt;"\n"&lt;/span&gt;
   &lt;span class="p"&gt;+&lt;/span&gt; &lt;span class="s"&gt;@"        }"&lt;/span&gt;
   &lt;span class="p"&gt;+&lt;/span&gt; &lt;span class="s"&gt;"\n"&lt;/span&gt;
   &lt;span class="p"&gt;+&lt;/span&gt; &lt;span class="s"&gt;@"    ]"&lt;/span&gt;
   &lt;span class="p"&gt;+&lt;/span&gt; &lt;span class="s"&gt;"\n"&lt;/span&gt;
   &lt;span class="p"&gt;+&lt;/span&gt; &lt;span class="s"&gt;@"}"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Adding the body as a parameter&lt;/span&gt;
&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;AddParameter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"application/json"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ParameterType&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RequestBody&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// We send the request&lt;/span&gt;
&lt;span class="n"&gt;IRestResponse&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// Print the response&lt;/span&gt;
&lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Content&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// Wait for user input before closing the terminal&lt;/span&gt;
&lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Read&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We must not forget to create the &lt;strong&gt;.env&lt;/strong&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ACCESS_TOKEN &lt;span class="o"&gt;=&lt;/span&gt; access_token
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once we have everything, we need to release our application by running it without debugging:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk5l61402snmft781e7t3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk5l61402snmft781e7t3.png" alt="Run without debugging" width="800" height="131"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This will generate an executable file that we can execute by going to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;bin/Debug/net6.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And running the application:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;./send_email
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feavsl35htvmxu62o5aex.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feavsl35htvmxu62o5aex.png" alt="CSharp Email Sent" width="800" height="521"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Just like in the PHP and Rust examples, the email was successfully delivered:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy0487rndxc7xsoaw5aag.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy0487rndxc7xsoaw5aag.png" alt="Email received" width="800" height="353"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can check the Github repo &lt;a href="https://github.com/nylas-samples/send_emails_rust_csharp" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You can check the Github repo &lt;a href="https://www.youtube.com/watch?v=7gqnMf15fAA&amp;amp;list=PLk-4iahO3b-xd42-RL4DJQyuEoFFYwTbC&amp;amp;index=7&amp;amp;t=863s" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you want to learn more about our Email API, please go to our &lt;a href="https://developer.nylas.com/docs/connectivity/email/" rel="noopener noreferrer"&gt;Email API documentation&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>php</category>
      <category>rust</category>
      <category>csharp</category>
    </item>
    <item>
      <title>Grouping Email Threads with Ruby and Nylas</title>
      <dc:creator>Alvaro (Blag) Tejada Galindo</dc:creator>
      <pubDate>Fri, 09 Dec 2022 11:56:52 +0000</pubDate>
      <link>https://forem.com/nylas/grouping-email-threads-with-ruby-and-nylas-khc</link>
      <guid>https://forem.com/nylas/grouping-email-threads-with-ruby-and-nylas-khc</guid>
      <description>&lt;p&gt;Looking for emails is straightforward, however, trying to get them all in a single place with less noise can be a difficult task. Thanks to the Nylas Ruby API, we can make email threading possible.&lt;/p&gt;

&lt;p&gt;If you want to learn more about Email Threads, read the blog post &lt;a href="https://www.nylas.com/blog/how-to-make-email-threading-less-chaotic/" rel="noopener noreferrer"&gt;Stay Threaded: How to Manage and Control Email Threads&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Is your system ready to group email threads?
&lt;/h2&gt;

&lt;p&gt;If you already have the Nylas Ruby SDK installed and your Ruby environment is configured, then continue along with the blog.&lt;/p&gt;

&lt;p&gt;Otherwise, I would recommend that you read the post &lt;a href="https://www.nylas.com/blog/how-to-send-emails-with-the-nylas-ruby-sdk/" rel="noopener noreferrer"&gt;How to Send Emails with the Nylas Ruby SDK&lt;/a&gt; where the basic setup is explained.&lt;/p&gt;

&lt;h2&gt;
  
  
  What are we going to talk about?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;What does our application look like?&lt;/li&gt;
&lt;li&gt;Installing the Sinatra package&lt;/li&gt;
&lt;li&gt;Running our Email Threading application&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What does our application look like?
&lt;/h2&gt;

&lt;p&gt;Before we jump into the code, let’s see how our application actually works. We will have a single input field accepting the email address to get all the related email threads and messages included in those threads:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvbgk9ub0y0u0fna12w5y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvbgk9ub0y0u0fna12w5y.png" alt="Email Threading Header" width="800" height="201"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We’re going to list all email threads related to the address we used, as long as they have at least two messages:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwl7mgt2n6cp1uuegdgy4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwl7mgt2n6cp1uuegdgy4.png" alt="Email Threading Threads" width="800" height="312"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The email threads are presented in an accordion, and when we open one, we will get the emails in a sequence, with the contact image and with the noise removed. So no emails, phone numbers or reply texts.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fca49xrpfh1fjlq7z2q0k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fca49xrpfh1fjlq7z2q0k.png" alt="Email Threading Conversation" width="800" height="702"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As we can see, both simple and nice.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing the Sinatra package
&lt;/h2&gt;

&lt;p&gt;To create a Ruby web application, our best option is to use &lt;a href="http://sinatrarb.com" rel="noopener noreferrer"&gt;Sinatra&lt;/a&gt;, one of the most popular Micro Frameworks in the Ruby world. We might need to install some additional gems:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ gem install sinatra&lt;br&gt;
$ gem install puma&lt;br&gt;
$ gem install nokogiri&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Once installed, we’re ready to go:&lt;/p&gt;

&lt;p&gt;First, we’re going to create a folder called EmailThreading, and inside we’re going to create two folders, one called views and other called public.&lt;/p&gt;

&lt;p&gt;Let’s create a file called &lt;strong&gt;EmailThreading.rb&lt;/strong&gt; in the &lt;strong&gt;EmailThreading&lt;/strong&gt; folder, and add the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Import your dependencies&lt;/span&gt;
&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="s1"&gt;'dotenv/load'&lt;/span&gt;
&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="s1"&gt;'nylas'&lt;/span&gt;
&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="s1"&gt;'sinatra'&lt;/span&gt;
&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="s1"&gt;'nokogiri'&lt;/span&gt;
&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="s1"&gt;'date'&lt;/span&gt;

&lt;span class="c1"&gt;# Initialize your Nylas API client&lt;/span&gt;
&lt;span class="n"&gt;nylas&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;Nylas&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;API&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="ss"&gt;app_id: &lt;/span&gt;&lt;span class="no"&gt;ENV&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"CLIENT_ID"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="ss"&gt;app_secret: &lt;/span&gt;&lt;span class="no"&gt;ENV&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"CLIENT_SECRET"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="ss"&gt;access_token: &lt;/span&gt;&lt;span class="no"&gt;ENV&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"ACCESS_TOKEN"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Use the Nokogiri gem to clean up the email response&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;clean_content&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;raw_html&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;html&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;raw_html&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;encode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'UTF-8'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;invalid: :replace&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;undef: :replace&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
                         &lt;span class="ss"&gt;replace: &lt;/span&gt;&lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;universal_newline: &lt;/span&gt;&lt;span class="kp"&gt;true&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;gsub&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/\P{ASCII}/&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
                         &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;parser&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;Nokogiri&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;HTML&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;html&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kp"&gt;nil&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;Encoding&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;UTF_8&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_s&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;parser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;xpath&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'//script'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;remove&lt;/span&gt;
    &lt;span class="n"&gt;parser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;xpath&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'//style'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;remove&lt;/span&gt;
    &lt;span class="n"&gt;parser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;xpath&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'//text()'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="ss"&gt;:text&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'&amp;lt;br&amp;gt; '&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;

&lt;span class="c1"&gt;# Get the contact associated to the email address&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_contact&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;nylas&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;contact&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;  &lt;span class="n"&gt;nylas&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;contacts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;where&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;email: &lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;contact&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="kp"&gt;nil&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;contact&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;

&lt;span class="c1"&gt;# Download the contact picture if it's not stored already&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;download_contact_picture&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;nylas&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;id&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="kp"&gt;nil&lt;/span&gt;
        &lt;span class="n"&gt;contact&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;nylas&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;contacts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;picture&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;contact&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;picture&lt;/span&gt;
        &lt;span class="n"&gt;file_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;id&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s2"&gt;".png"&lt;/span&gt;
        &lt;span class="no"&gt;File&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"public/"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;file_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;"wb"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
            &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt; &lt;span class="no"&gt;File&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;picture&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'rb'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="k"&gt;end&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;

&lt;span class="c1"&gt;# When calling the application for the first time&lt;/span&gt;
&lt;span class="n"&gt;get&lt;/span&gt; &lt;span class="s1"&gt;'/'&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
    &lt;span class="n"&gt;_threads&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
    &lt;span class="c1"&gt;# Call the page&lt;/span&gt;
    &lt;span class="n"&gt;erb&lt;/span&gt; &lt;span class="ss"&gt;:main&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:layout&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="ss"&gt;:layout&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:locals&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="ss"&gt;:threads&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;_threads&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;

&lt;span class="c1"&gt;# When asking for the email threading&lt;/span&gt;
&lt;span class="n"&gt;post&lt;/span&gt; &lt;span class="s1"&gt;'/search'&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
    &lt;span class="c1"&gt;# Get parameter from form&lt;/span&gt;
    &lt;span class="n"&gt;search&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="ss"&gt;:search&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="c1"&gt;# Search all threads related to the email address   &lt;/span&gt;
    &lt;span class="n"&gt;threads&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;nylas&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;threads&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;where&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;from: &lt;/span&gt;&lt;span class="n"&gt;search&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="ss"&gt;in: &lt;/span&gt;&lt;span class="s1"&gt;'inbox'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 

    &lt;span class="n"&gt;_threads&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;

    &lt;span class="c1"&gt;# Loop through all the threads  &lt;/span&gt;
    &lt;span class="n"&gt;threads&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;each&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;thread&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
        &lt;span class="n"&gt;_thread&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
        &lt;span class="n"&gt;_messages&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
        &lt;span class="n"&gt;_pictures&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
        &lt;span class="n"&gt;_names&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
        &lt;span class="c1"&gt;# Look for threads with more than 1 message     &lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;thread&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;message_ids&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;length&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
            &lt;span class="c1"&gt;# Get the subject of the first email        &lt;/span&gt;
            &lt;span class="n"&gt;_thread&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;thread&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;subject&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="c1"&gt;# Loop through all messages contained in the thread&lt;/span&gt;
            &lt;span class="n"&gt;thread&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;message_ids&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;each&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
                &lt;span class="c1"&gt;# Get information from the message          &lt;/span&gt;
                &lt;span class="n"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;nylas&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="c1"&gt;# Try to get the contact information                &lt;/span&gt;
                &lt;span class="n"&gt;contact&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;get_contact&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;nylas&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;from&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;email&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;contact&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="kp"&gt;nil&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;contact&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;
                    &lt;span class="c1"&gt;# If the contact is available, downloads its profile picture&lt;/span&gt;
                    &lt;span class="n"&gt;download_contact_picture&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;nylas&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;contact&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="k"&gt;end&lt;/span&gt;
                &lt;span class="c1"&gt;# Remove extra information from the message, like appended &lt;/span&gt;
                &lt;span class="c1"&gt;#  message, email and phone number&lt;/span&gt;
                &lt;span class="n"&gt;_messages&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;clean_content&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;body&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;
                    &lt;span class="nf"&gt;gsub&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/(\bOn.*\b)(?!.*\1)/&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;
                    &lt;span class="nf"&gt;gsub&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/[a-z0-9._-]+@[a-z0-9._-]+\.[a-z]{2,3}\b/i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;
                    &lt;span class="nf"&gt;gsub&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/(\+\d{1,2}\s)?\(?\d{3}\)?[\s.-]\d{3}[\s.-]\d{4}/&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;
                    &lt;span class="nf"&gt;gsub&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/twitter:.+/i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
                    &lt;span class="c1"&gt;# Convert date to something readable&lt;/span&gt;
                    &lt;span class="n"&gt;datetime&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;Time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;at&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;date&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;to_datetime&lt;/span&gt;
                    &lt;span class="n"&gt;date&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;scan&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/\d{4}-\d{2}-\d{2}/&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                    &lt;span class="n"&gt;time&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;scan&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/\d{2}:\d{2}:\d{2}/&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;contact&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="kp"&gt;nil&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;contact&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;
                        &lt;span class="n"&gt;_pictures&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"NotFound.png"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                        &lt;span class="n"&gt;_names&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Not Found"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s2"&gt;" on "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s2"&gt;" at "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; 
                                    &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
                    &lt;span class="k"&gt;else&lt;/span&gt;
                        &lt;span class="c1"&gt;# If there's a contact, pass picture information, &lt;/span&gt;
                        &lt;span class="c1"&gt;# name and date and time of message&lt;/span&gt;
                        &lt;span class="n"&gt;_pictures&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;contact&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;id&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s2"&gt;".png"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                        &lt;span class="n"&gt;_names&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;contact&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;given_name&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s2"&gt;" "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;contact&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;surname&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; 
                                    &lt;span class="s2"&gt;" on "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s2"&gt;" at "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
                    &lt;span class="k"&gt;end&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="n"&gt;_thread&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_messages&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="n"&gt;_thread&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_pictures&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="n"&gt;_thread&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_names&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="n"&gt;_threads&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_thread&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;end&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;# Call the page and display threads &lt;/span&gt;
    &lt;span class="n"&gt;erb&lt;/span&gt; &lt;span class="ss"&gt;:main&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:layout&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="ss"&gt;:layout&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:locals&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="ss"&gt;:threads&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;_threads&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Inside the &lt;strong&gt;views&lt;/strong&gt; folder, we need to create two different files, let’s start with &lt;strong&gt;layout.erb&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"viewport"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"width=device-width, initial-scale=1"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="c"&gt;&amp;lt;!-- Call the TailwindCSS and Flowbite libraries --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"https://cdn.tailwindcss.com"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://unpkg.com/flowbite@1.5.3/dist/flowbite.min.css"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Nylas’ Email Threading&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;&lt;/span&gt;&lt;span class="err"&gt;%=&lt;/span&gt; &lt;span class="na"&gt;yield&lt;/span&gt; &lt;span class="err"&gt;%&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"https://unpkg.com/flowbite@1.5.3/dist/flowbite.js"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We’re calling both the &lt;a href="https://tailwindcss.com" rel="noopener noreferrer"&gt;TailwindCSS&lt;/a&gt; and &lt;a href="https://flowbite.com" rel="noopener noreferrer"&gt;Flowbite&lt;/a&gt; libraries to handle CSS.&lt;/p&gt;

&lt;p&gt;We need to create then the file &lt;strong&gt;main.erb&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"grid bg-green-300 border-green-600 border-b 
           p-4 m-4 rounded place-items-center"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;p&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"text-6xl text-center"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Email Threading&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&amp;lt;br&amp;gt;&lt;/span&gt;
&lt;span class="c"&gt;&amp;lt;!-- Create the form--&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;form&lt;/span&gt; &lt;span class="na"&gt;method = &lt;/span&gt;&lt;span class="s"&gt;"post"&lt;/span&gt; &lt;span class="na"&gt;action=&lt;/span&gt;&lt;span class="s"&gt;"search"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"flex bg-blue-300 border-blue-600 border-b p-4 m-4 rounded place-items-center"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"search"&lt;/span&gt; &lt;span class="na"&gt;value=&lt;/span&gt;&lt;span class="s"&gt;""&lt;/span&gt; &lt;span class="na"&gt;size=&lt;/span&gt;&lt;span class="s"&gt;"50"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/input&amp;gt;&lt;/span&gt;&lt;span class="ni"&gt;&amp;amp;nbsp;&amp;amp;nbsp;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"submit"&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"block bg-blue-500 hover:bg-blue-700 
  text-white text-lg mx-auto py-2 px-4 rounded-full"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Search&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/form&amp;gt;&lt;/span&gt;
&lt;span class="c"&gt;&amp;lt;!-- Do we have any threads? --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;&lt;/span&gt;&lt;span class="err"&gt;%&lt;/span&gt; &lt;span class="na"&gt;if&lt;/span&gt; &lt;span class="na"&gt;threads&lt;/span&gt; &lt;span class="err"&gt;!=&lt;/span&gt; &lt;span class="err"&gt;[]&lt;/span&gt; &lt;span class="err"&gt;%&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"accordion-collapse"&lt;/span&gt; &lt;span class="na"&gt;data-accordion=&lt;/span&gt;&lt;span class="s"&gt;"collapse"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="c"&gt;&amp;lt;!-- Counter to generate accordion elements --&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;&lt;/span&gt;&lt;span class="err"&gt;%&lt;/span&gt; &lt;span class="na"&gt;counter = &lt;/span&gt;&lt;span class="s"&gt;1&lt;/span&gt; &lt;span class="err"&gt;%&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="c"&gt;&amp;lt;!-- Loop through each thread --&amp;gt;&lt;/span&gt;  
  &lt;span class="nt"&gt;&amp;lt;&lt;/span&gt;&lt;span class="err"&gt;%&lt;/span&gt; &lt;span class="na"&gt;threads.each&lt;/span&gt; &lt;span class="na"&gt;do&lt;/span&gt; &lt;span class="err"&gt;|&lt;/span&gt;&lt;span class="na"&gt;thread&lt;/span&gt;&lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="err"&gt;%&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="c"&gt;&amp;lt;!-- Define values for the accordion elements --&amp;gt;&lt;/span&gt;  
    &lt;span class="nt"&gt;&amp;lt;&lt;/span&gt;&lt;span class="err"&gt;%&lt;/span&gt; &lt;span class="na"&gt;heading = &lt;/span&gt;&lt;span class="s"&gt;"accordion-collapse-heading-"&lt;/span&gt; &lt;span class="err"&gt;+&lt;/span&gt; &lt;span class="na"&gt;counter.to_s&lt;/span&gt;  &lt;span class="err"&gt;%&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;&lt;/span&gt;&lt;span class="err"&gt;%&lt;/span&gt; &lt;span class="na"&gt;body = &lt;/span&gt;&lt;span class="s"&gt;"accordion-collapse-body-"&lt;/span&gt; &lt;span class="err"&gt;+&lt;/span&gt; &lt;span class="na"&gt;counter.to_s&lt;/span&gt;  &lt;span class="err"&gt;%&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;&lt;/span&gt;&lt;span class="err"&gt;%&lt;/span&gt; &lt;span class="na"&gt;_body = &lt;/span&gt;&lt;span class="s"&gt;"#accordion-collapse-body-"&lt;/span&gt; &lt;span class="err"&gt;+&lt;/span&gt; &lt;span class="na"&gt;counter.to_s&lt;/span&gt;  &lt;span class="err"&gt;%&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;h2&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;&amp;lt;%=&lt;/span&gt; &lt;span class="na"&gt;heading&lt;/span&gt; &lt;span class="err"&gt;%&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt; &amp;gt;
    &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"button"&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"flex items-center justify-between w-full p-5 font-medium 
                                 text-left text-gray-500 border border-b-0 border-gray-200 
                                 focus:ring-4 focus:ring-gray-200 dark:focus:ring-gray-800 
                                 dark:border-gray-700 dark:text-gray-400 hover:bg-gray-100 
                                 dark:hover:bg-gray-800"&lt;/span&gt; &lt;span class="na"&gt;data-accordion-target=&lt;/span&gt;&lt;span class="s"&gt;&amp;lt;%=&lt;/span&gt; &lt;span class="na"&gt;_body&lt;/span&gt; &lt;span class="err"&gt;%&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt; 
                                 aria-expanded="false" aria-controls=&lt;span class="nt"&gt;&amp;lt;&lt;/span&gt;&lt;span class="err"&gt;%=&lt;/span&gt; &lt;span class="na"&gt;body&lt;/span&gt; &lt;span class="err"&gt;%&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;&amp;gt;
&lt;span class="c"&gt;&amp;lt;!-- Title of the thread --&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;span&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class="err"&gt;%=&lt;/span&gt; &lt;span class="na"&gt;thread&lt;/span&gt;&lt;span class="err"&gt;[0]&lt;/span&gt; &lt;span class="err"&gt;%&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;svg&lt;/span&gt; &lt;span class="na"&gt;data-accordion-icon&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"w-6 h-6 shrink-0"&lt;/span&gt; &lt;span class="na"&gt;fill=&lt;/span&gt;&lt;span class="s"&gt;"currentColor"&lt;/span&gt; 
        &lt;span class="na"&gt;viewBox=&lt;/span&gt;&lt;span class="s"&gt;"0 0 20 20"&lt;/span&gt; &lt;span class="na"&gt;xmlns=&lt;/span&gt;&lt;span class="s"&gt;"http://www.w3.org/2000/svg"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;path&lt;/span&gt; &lt;span class="na"&gt;fill-rule=&lt;/span&gt;&lt;span class="s"&gt;"evenodd"&lt;/span&gt;    
        &lt;span class="na"&gt;d=&lt;/span&gt;&lt;span class="s"&gt;"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 
        4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"&lt;/span&gt; &lt;span class="na"&gt;clip-rule=&lt;/span&gt;&lt;span class="s"&gt;"evenodd"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/path&amp;gt;&amp;lt;/svg&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;     
  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;&amp;lt;%=&lt;/span&gt; &lt;span class="na"&gt;body&lt;/span&gt; &lt;span class="err"&gt;%&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt; class="hidden" aria-labelledby=&lt;span class="nt"&gt;&amp;lt;&lt;/span&gt;&lt;span class="err"&gt;%=&lt;/span&gt; &lt;span class="na"&gt;heading&lt;/span&gt; &lt;span class="err"&gt;%&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;&amp;gt;
  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"p-5 font-light border border-b-0 border-gray-200 dark:border-gray-700"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="c"&gt;&amp;lt;!-- Get size of thread array --&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;&lt;/span&gt;&lt;span class="err"&gt;%&lt;/span&gt; &lt;span class="na"&gt;count = &lt;/span&gt;&lt;span class="s"&gt;thread[1].length()&lt;/span&gt; &lt;span class="err"&gt;%&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="c"&gt;&amp;lt;!-- Define amount of elements on the grid --&amp;gt;&lt;/span&gt;    
  &lt;span class="nt"&gt;&amp;lt;&lt;/span&gt;&lt;span class="err"&gt;%&lt;/span&gt; &lt;span class="na"&gt;count_str = &lt;/span&gt;&lt;span class="s"&gt;"grid-rows-"&lt;/span&gt; &lt;span class="err"&gt;+&lt;/span&gt; &lt;span class="na"&gt;count.to_s&lt;/span&gt; &lt;span class="err"&gt;%&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"grid &amp;lt;%= count_str %&amp;gt; grid-flow-col gap-4"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="c"&gt;&amp;lt;!-- Counter to access array elements --&amp;gt;&lt;/span&gt; 
    &lt;span class="nt"&gt;&amp;lt;&lt;/span&gt;&lt;span class="err"&gt;%&lt;/span&gt; &lt;span class="na"&gt;counter = &lt;/span&gt;&lt;span class="s"&gt;0&lt;/span&gt; &lt;span class="err"&gt;%&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="c"&gt;&amp;lt;!-- Loop through each email --&amp;gt;&lt;/span&gt;        
    &lt;span class="nt"&gt;&amp;lt;&lt;/span&gt;&lt;span class="err"&gt;%&lt;/span&gt; &lt;span class="na"&gt;thread&lt;/span&gt;&lt;span class="err"&gt;[1].&lt;/span&gt;&lt;span class="na"&gt;each&lt;/span&gt; &lt;span class="na"&gt;do&lt;/span&gt; &lt;span class="err"&gt;|&lt;/span&gt;&lt;span class="na"&gt;message&lt;/span&gt;&lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="err"&gt;%&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"col-span-2 ..."&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="c"&gt;&amp;lt;!-- Display image and date/time of email --&amp;gt;&lt;/span&gt;             
    &lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"mx-auto"&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"&amp;lt;%= thread[2][counter] %&amp;gt;"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;b&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;p&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"text-center"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class="err"&gt;%=&lt;/span&gt; &lt;span class="na"&gt;thread&lt;/span&gt;&lt;span class="err"&gt;[3][&lt;/span&gt;&lt;span class="na"&gt;counter&lt;/span&gt;&lt;span class="err"&gt;]&lt;/span&gt; &lt;span class="err"&gt;%&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;/span&gt;
        &lt;span class="c"&gt;&amp;lt;!-- Display the email message --&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;&lt;/span&gt;&lt;span class="err"&gt;%=&lt;/span&gt; &lt;span class="na"&gt;message&lt;/span&gt; &lt;span class="err"&gt;%&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;&lt;/span&gt;&lt;span class="err"&gt;%&lt;/span&gt; &lt;span class="na"&gt;counter = &lt;/span&gt;&lt;span class="s"&gt;counter&lt;/span&gt; &lt;span class="err"&gt;+&lt;/span&gt; &lt;span class="err"&gt;1&lt;/span&gt; &lt;span class="err"&gt;%&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;&lt;/span&gt;&lt;span class="err"&gt;%&lt;/span&gt; &lt;span class="na"&gt;end&lt;/span&gt; &lt;span class="err"&gt;%&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt; 
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;    
  &lt;span class="nt"&gt;&amp;lt;&lt;/span&gt;&lt;span class="err"&gt;%&lt;/span&gt; &lt;span class="na"&gt;end&lt;/span&gt; &lt;span class="err"&gt;%&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;&lt;/span&gt;&lt;span class="err"&gt;%&lt;/span&gt; &lt;span class="na"&gt;end&lt;/span&gt; &lt;span class="err"&gt;%&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you wonder about the public folder, it will only hold the contact profile picture, so there’s nothing we need to do there.&lt;/p&gt;

&lt;p&gt;And that’s it. We’re ready to roll.&lt;/p&gt;

&lt;h2&gt;
  
  
  Running our Email Threading application
&lt;/h2&gt;

&lt;p&gt;In order to run our application, we just need to type the following on the terminal window:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ ruby EmailThreading.rb&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4pevhs6117kyqe0sir5x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4pevhs6117kyqe0sir5x.png" alt="Running the application" width="800" height="271"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Our application will be running on port &lt;strong&gt;4567&lt;/strong&gt; of localhost, so we just need to open our favourite browser and go to the following address:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;http://localhost:4567&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If you want to learn more about our Email APIs, please go to our documentation &lt;a href="https://developer.nylas.com/docs/connectivity/email/" rel="noopener noreferrer"&gt;Email API Overview&lt;/a&gt; as well &lt;a href="https://developer.nylas.com/docs/api/#tag--Threads" rel="noopener noreferrer"&gt;Threads&lt;/a&gt; and &lt;a href="https://developer.nylas.com/docs/api/#tag--Messages" rel="noopener noreferrer"&gt;Messages&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>css</category>
      <category>scss</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Python, Sentiment Analysis, R and Shiny</title>
      <dc:creator>Alvaro (Blag) Tejada Galindo</dc:creator>
      <pubDate>Tue, 21 Jun 2022 03:12:42 +0000</pubDate>
      <link>https://forem.com/nylas/python-sentiment-analysis-r-and-shiny-ao7</link>
      <guid>https://forem.com/nylas/python-sentiment-analysis-r-and-shiny-ao7</guid>
      <description>&lt;p&gt;Knowing how your customers feel about your product is as important as creating a good product. Wouldn’t it be great if we could determine in a simple way how our customers feel by analyzing the feedback they provide via email messages?  With Nylas Neural API’s Sentiment Analysis, we can do that. Sentiment Analysis is a way of computationally analyzing a writer’s work to determine how they feel about a selected topic. With basic sentiment analysis, you can check if the writer feels positive, negative, or neutral about something.&lt;/p&gt;

&lt;p&gt;For this post, we’re going to create a simple feedback web page using Python. The sentiment information we gather will be analyzed and stored locally in a SQLite Database to be later picked up and displayed in a Shiny Dashboard using the R Programming Language. (Shiny is an R package that lets you easily display data with a variety of charts and graphs in your own dashboard.) We’re keeping everything local just for the sake of simplicity.&lt;/p&gt;

&lt;h2&gt;
  
  
  Is your system ready?
&lt;/h2&gt;

&lt;p&gt;If you don’t have the Nylas Python SDK installed and your environment isn’t configured, I would recommend you to read the post &lt;a href="https://www.nylas.com/blog/how-to-send-emails-with-the-nylas-python-sdk/" rel="noopener noreferrer"&gt;How to Send Emails with the Nylas Python SDK&lt;/a&gt; where everything is clearly explained.&lt;/p&gt;

&lt;p&gt;To complete this project you will need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Nylas developer account and credentials&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Nylas Python SDK installed&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Gmail account (we will use Gmail to label and sort emails)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We will install R and Shiny later in this post, so you don’t need to worry about it now&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What are we going to do?
&lt;/h2&gt;

&lt;p&gt;Let’s pretend that we are the owners of a small company that produces vegan eggs called “VeggiEggs”. We want to build a Flask application that will collect feedback from our customers and send it to us via email, so that we can store the information and also reply back as a follow up. Then we want a Python script that will read and analyze every email using Sentiment Analysis and finally create an R Shiny Script that will display a dashboard with the information we gathered.&lt;/p&gt;

&lt;h2&gt;
  
  
  Working on the application
&lt;/h2&gt;

&lt;p&gt;What we need to do first is set up a Label so that the emails are easy to find.&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating a Label
&lt;/h3&gt;

&lt;p&gt;On Gmail, we can do the following:&lt;/p&gt;

&lt;p&gt;On the search bar, press the “Show Search Options” button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnrxtcljie7gajcrn3wxg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnrxtcljie7gajcrn3wxg.png" alt=" " width="800" height="60"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then, use the “veggieggs” and “feedback” words.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmuitb0aq5warmxgk3lkq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmuitb0aq5warmxgk3lkq.png" alt=" " width="800" height="541"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When we create the filter, we can assign the messages to an existing label or create a new one.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3em28m17uznexpj5mjtz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3em28m17uznexpj5mjtz.png" alt=" " width="800" height="147"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We don’t need to nest it, so just enter the label name.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F39639nw9si23tmwpz50p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F39639nw9si23tmwpz50p.png" alt=" " width="800" height="384"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once we create it, we can apply some extra filters&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcr6fnfb8gn48pua70zrr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcr6fnfb8gn48pua70zrr.png" alt=" " width="800" height="597"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, every email that we receive containing those words “VeggieEggs” and “Feedback” will go into our label and skip the inbox.&lt;/p&gt;

&lt;h3&gt;
  
  
  Installing the Flask package
&lt;/h3&gt;

&lt;p&gt;As we want to create a Python web application, our best option is to use &lt;a href="https://flask.palletsprojects.com/en/2.0.x/" rel="noopener noreferrer"&gt;Flask&lt;/a&gt;, one of the most popular Micro Frameworks in the Python world.&lt;/p&gt;

&lt;p&gt;To install it, we can type the following command on the terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ pip3 install flask
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once installed, we’re ready to go.&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating the Flask application
&lt;/h3&gt;

&lt;p&gt;As we’re going to develop this application locally and not deploy it anywhere else. We’re going to create a file called &lt;strong&gt;config.json&lt;/strong&gt; which will hold our Nylas Tokens information. This comes with Flask, so why not use it?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "NYLAS_OAUTH_CLIENT_ID": "&amp;lt;YOUR_CLIENT_ID&amp;gt;",
  "NYLAS_OAUTH_CLIENT_SECRET": "&amp;lt;YOUR_CLIENT_SECRET&amp;gt;",
  "SECRET_KEY": "&amp;lt;YOUR_SECRET_KEY&amp;gt;"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, we’re going to create a file called &lt;strong&gt;FeedbackForm.py&lt;/strong&gt; which will handle getting the feedback and sending the email.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Import your dependencies
from flask import Flask,render_template,json,request,flash,redirect,url_for
from nylas import APIClient

# Create the app and read the configuration file
app = Flask(__name__)
app.config.from_file("config.json", json.load)

# Initialize your Nylas API client
def load_nylas():
    nylas = APIClient(
        app.config["NYLAS_OAUTH_CLIENT_ID"],
    app.config["NYLAS_OAUTH_CLIENT_SECRET"],
    app.config["SECRET_KEY"]
    )
    return nylas

# This the landing page
@app.route("/", methods=['GET','POST'])
def index():
# If we are reading the page, show the feedback form
    if request.method == 'GET':
        return render_template('FeedbackForm.html')
# If we are submitting feedback, read the form
    else:
        name = request.form['name']
        email = request.form['email']
        rating = request.form['rating']
        comments = request.form['comments']

# Check for required fields
        if not name:
            flash('Name is required!')
            return redirect(url_for('index'))
        elif not email:
            flash('Email is required!')
            return redirect(url_for('index'))
        elif not comments:
            flash('Comments are required!')
            return redirect(url_for('index'))           
        else:
# If everything is Ok, send the email with the feedback information
            nylas = load_nylas()
            draft = nylas.drafts.create()
            draft.subject = "VeggiEggs Feedback - {} - {} - {}".format(name, email, rating)
            draft.body = comments
    draft.to = [{"name": "&amp;lt;YOUR_NAME&amp;gt;", "email": "&amp;lt;YOUR_EMAIL&amp;gt;"}]

    draft.send()            
    return render_template('ConfirmationForm.html', 
                   name = name, email = email, 
                   rating = rating, comments=comments),            
                                                  {"Refresh":"5;url=/"}

# Run our application       
if __name__ == "__main__":
    app.run()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For this to work properly, we need to create a file called &lt;strong&gt;FeedbackForm.html&lt;/strong&gt; and we’re going to use &lt;a href="https://tailwindcss.com" rel="noopener noreferrer"&gt;TailwindCSS&lt;/a&gt; to provide a quick look and feel.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;meta charset="UTF-8"&amp;gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
    &amp;lt;script src="https://cdn.tailwindcss.com"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;title&amp;gt;Nylas&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;div class="bg-green-300 border-green-600 border-b p-4 m-4 rounded"&amp;gt;
    {% block content %}
    {% with messages = get_flashed_messages() %}
        {% if messages %}
            {% for message in messages %}
                {{ message }}
            {% endfor %}
        {% endif %}
    {% endwith %}
    &amp;lt;h1 class="font-black"&amp;gt;We hope you enjoyed VeggiEggs. Please take some time to leave a review&amp;lt;/h1&amp;gt;
    &amp;lt;br&amp;gt;
    &amp;lt;form method="post"&amp;gt;
        &amp;lt;label for="name" class="font-bold"&amp;gt;* Name&amp;lt;/label&amp;gt;
        &amp;lt;input type="text" name="name"
               placeholder="Your name"
               value="{{ request.form['name'] }}"&amp;gt;&amp;lt;/input&amp;gt;
        &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;
        &amp;lt;label for="email" class="font-bold"&amp;gt;* Email&amp;lt;/label&amp;gt;
        &amp;lt;input type="email" name="email"
               placeholder="Your email"&amp;gt;&amp;lt;/input&amp;gt;
        &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;
        &amp;lt;label for="rating" class="font-bold"&amp;gt;Choose a rating:&amp;lt;/label&amp;gt;
        &amp;lt;select name="rating"&amp;gt;
            &amp;lt;option value="1"&amp;gt;Poor&amp;lt;/option&amp;gt;
            &amp;lt;option value="2"&amp;gt;Fair&amp;lt;/option&amp;gt;
            &amp;lt;option value="3"&amp;gt;Ok&amp;lt;/option&amp;gt;
            &amp;lt;option value="4"&amp;gt;Good&amp;lt;/option&amp;gt;
            &amp;lt;option value="5" selected&amp;gt;Great&amp;lt;/option&amp;gt;
        &amp;lt;/select&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;
        &amp;lt;p class="font-bold"&amp;gt;* Comments&amp;lt;/p&amp;gt;
        &amp;lt;textarea name="comments"
               placeholder="Your comments"
               rows=5
               cols=50&amp;gt;&amp;lt;/textarea&amp;gt;        
        &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;
        &amp;lt;button type="submit" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-full"&amp;gt;Submit&amp;lt;/button&amp;gt;
    &amp;lt;/form&amp;gt;
    &amp;lt;p class="font-bold"&amp;gt;* Required&amp;lt;/p&amp;gt;
    {% endblock %}
    &amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And we’re going to need a confirmation page as well, so that people know that their responses were recorded correctly.&lt;/p&gt;

&lt;p&gt;We're going to create a page called &lt;strong&gt;ConfirmationForm.html&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;meta charset="UTF-8"&amp;gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
    &amp;lt;script src="https://cdn.tailwindcss.com"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;title&amp;gt;Nylas&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;div class="bg-green-300 border-green-600 border-b p-4 m-4 rounded"&amp;gt;
    {% block content %}
    &amp;lt;h2 class="font-semibold"&amp;gt;Thanks {{name}} - {{email}}&amp;lt;/h2&amp;gt;
    &amp;lt;h2 class="font-semibold"&amp;gt;Your rating was: {{rating}}&amp;lt;/h2&amp;gt;
    &amp;lt;h2 class="font-semibold"&amp;gt;Your comments were:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; {{comments}}&amp;lt;/h2&amp;gt;
    &amp;lt;p class="font-semibold"&amp;gt;You will be automatically redirected. 
    If it doesn't work, follow the &amp;lt;a href="{{url_for('index')}}"&amp;gt;link&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;
    {% endblock %}
    &amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can execute this script from the terminal by typing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ python3 FeedbackForm.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fddueikzp6kuhlamw4wgz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fddueikzp6kuhlamw4wgz.png" alt=" " width="800" height="516"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, we need to open localhost:5000 on our favourite browser.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;NOTE:&lt;/em&gt;&lt;/strong&gt; If you are using Flask on a Mac that has Monterey or higher, you may have trouble accessing localhost. You can solve this by disabling the Airplay Receiver in your Sharing folder. (Airplay Receiver uses port 5000.) Follow these instructions: &lt;a href="https://www.businessinsider.com/how-to-turn-off-airplay" rel="noopener noreferrer"&gt;How to disable Airplay Receiver&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff0utrnc4p1jac8h4man9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff0utrnc4p1jac8h4man9.png" alt=" " width="800" height="583"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once we hit submit, we will get instant feedback.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frzophyat9ddgqt3xw9uh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frzophyat9ddgqt3xw9uh.png" alt=" " width="800" height="419"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We use redirection, so it will go back to the main page after 5 seconds. And here we’re displaying the information entered by the user.&lt;/p&gt;

&lt;p&gt;If we check our mailbox, we will find this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7fqn783vwytkjjzw2czb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7fqn783vwytkjjzw2czb.png" alt=" " width="800" height="304"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We have all the information we need on this email. So we’re ready for the next stage.&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating a Python script
&lt;/h3&gt;

&lt;p&gt;In this step, we’re going to read all the emails with the label “VeggiEggs”, in order to analyze them with the Sentiment Analysis endpoint as well as to gather important information like the rating and the date the email was sent.&lt;/p&gt;

&lt;p&gt;We’re going to create a file called &lt;strong&gt;NeuralFeeback.py&lt;/strong&gt;. It looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Load your env variables
from dotenv import load_dotenv
load_dotenv()

# Import your dependencies
import os
from nylas import APIClient
import subprocess

# Initialize your Nylas API client
nylas = APIClient(
    os.environ.get("CLIENT_ID"),
    os.environ.get("CLIENT_SECRET"),
    os.environ.get("ACCESS_TOKEN"),
)

# Gather all messages from the label “VeggiEggs”
messages = nylas.messages.where(in_="VeggiEggs")
# Create variables to hold the information to be passed to R
rating = []
sentiment = []
score = []
date = []
sRating = ""
sSentiment = ""
sScore = ""
sDate = ""

# Read all messages
for message in messages:
# Split the title in order to get the rating value
    line = message.subject.split(" - ")
    rating.append(line[3])
# Send each message to the Sentiment Analysis endpoint
    message_analysis = nylas.neural.sentiment_analysis_message([message.id])
# Extract the Sentiment Analysis result
    sentiment.append(message_analysis[0].sentiment)
    score.append(str(message_analysis[0].sentiment_score))
    date.append(str(message.received_at.date()))    

# Turn the information into a long string separated by commas
sRating = ','.join(rating)
sSentiment = ','.join(sentiment)
sScore = ','.join(score)
sDate = ','.join(date)

# We want to know when R is getting called
print("Calling R")
# Call R as a subprocess and launch Shiny in the browser
subprocess.run(["RScript", "-e", "shiny::runApp('&amp;lt;path_to_your_python_env&amp;gt;', launch.browser = TRUE)", sRating, sSentiment, sScore, sDate])
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Setting up R
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Installing R
&lt;/h4&gt;

&lt;p&gt;As we’re going to use Shiny to create our dashboard, we need to create a R script. If you don’t have R installed on your computer you can do it like this.&lt;/p&gt;

&lt;p&gt;Here’s the latest version of R for the Mac &lt;a href="https://cran.r-project.org/bin/macosx/base/R-4.1.3.pkg" rel="noopener noreferrer"&gt;R-4.1.3&lt;/a&gt;. Also, while optional, we need to install &lt;a href="http://xquartz.macosforge.org/" rel="noopener noreferrer"&gt;XQuartz&lt;/a&gt; as it is not bundled with Mac by default.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn767g9zu1afpjdwo7wwy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn767g9zu1afpjdwo7wwy.png" alt=" " width="800" height="126"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Installing RStudio
&lt;/h4&gt;

&lt;p&gt;While it’s not mandatory, we should install &lt;a href="//rstudio.com/products/rstudio/download/#download"&gt;RStudio&lt;/a&gt; which is by far the best R IDE.&lt;/p&gt;

&lt;h4&gt;
  
  
  Installing the necessary packages
&lt;/h4&gt;

&lt;p&gt;We will need to install some packages in order to have our Shiny application running. Open up RStudio and click on “Tools → Install packages”. Type the following packages separated by a comma:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;shiny →&lt;/strong&gt; Makes it incredibly easy to build interactive web applications with R&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;tidyverse →&lt;/strong&gt; The tidyverse is an opinionated &lt;a href="https://www.tidyverse.org/packages" rel="noopener noreferrer"&gt;collection of R packages&lt;/a&gt; designed for data science&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;treemap →&lt;/strong&gt; Displays hierarchical data as a set of nested rectangles&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;imager →&lt;/strong&gt; Fast image processing for images in up to 4 dimensions&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;plyr →&lt;/strong&gt; Tools for Splitting, Applying and Combining Data&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpzc0gy9q5afiu9d8s31t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpzc0gy9q5afiu9d8s31t.png" alt=" " width="758" height="550"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We need to make sure to leave “Install dependencies” checked and press &lt;strong&gt;Install&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Once everything is installed, we can create the script.&lt;/p&gt;

&lt;h4&gt;
  
  
  Creating the Shiny script
&lt;/h4&gt;

&lt;p&gt;We need to press File → New → R Script and save the file as &lt;strong&gt;App.r&lt;/strong&gt; then type the following&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Load packages
library("shiny")
library("tidyverse")
library("treemap")
library("imager")
library("plyr")

# UI Section of our Shiny app
ui &amp;lt;- fluidPage(
# Dashboard headline
  tags$div(
    HTML("&amp;lt;h1 style='color:blue;text-align:center;'&amp;gt;VeggiEggs Dashboard!&amp;lt;/h1&amp;gt;")
  ),  
# Dashboard title
  title = "VeggiEggs Dashboard!",
# Define how our plots are going to be laid off
                 fluidRow(
                   column(width=5, plotOutput(outputId = "distPlot")),
                   column(width=5,offset=2, plotOutput(outputId = "distPlot2"))
                 ),
                 fluidRow(
                   column(width=5, plotOutput(outputId = "distPlot3")),
                   column(width=5,offset=2, plotOutput(outputId = "distPlot4"))
                 )) 

# Server part, here is where the plots are defined
server &amp;lt;- function(input, output) {

# We receive the information coming from Python
  args = commandArgs(trailingOnly=TRUE)
  ratings&amp;lt;-as.integer(strsplit(args[1], ",")[[1]])
  sentiments&amp;lt;-strsplit(args[2], ",")[[1]]
  scores&amp;lt;-as.integer(strsplit(args[3], ",")[[1]])    
  dates&amp;lt;-as.Date(strsplit(args[4], ",")[[1]])

# We create a Data.Frame to better handle the data
  entries = data.frame(ratings, sentiments, scores, dates=as.Date(dates))  

# First plot. Summarize the ratings
  output$distPlot &amp;lt;- renderPlot({
    Ratings &amp;lt;- count(entries, 'ratings')
    names(Ratings)&amp;lt;-c("Ratings","Count")
    Count &amp;lt;- Ratings$Count
    Ratings %&amp;gt;%
      ggplot( aes(x = Ratings, y = Count, fill = Count)) + 
        geom_bar(stat="identity")
  })

# Second plot. How many feedbacks per day
  output$distPlot2 &amp;lt;- renderPlot({
    Freq &amp;lt;- count(entries, 'dates')
    names(Freq)&amp;lt;-c("Dates","Entries")
    Freq %&amp;gt;% 
      ggplot( aes(x=Dates, y=Entries)) +
      geom_line(color="green") +
      geom_point()
  })

# Third plot. Frequency of sentiment analysis
  output$distPlot3 &amp;lt;- renderPlot({
    Sentiment &amp;lt;- count(sentiments)
    group &amp;lt;- paste(Sentiment$x,Sentiment$freq)
    sentiment&amp;lt;-Sentiment$freq
    data &amp;lt;- data.frame(group,sentiment)
    treemap(data,
            index="group",
            vSize="sentiment",
            type="index"
    )
  })

# Fourth Plot. Display an image for each score range  
  output$distPlot4 &amp;lt;- renderPlot({
    Score&amp;lt;-mean(entries$scores)
    if (Score &amp;lt; -0.5){
      image_filename&amp;lt;-"angry-emoji.png"
    }
    if (Score &amp;gt; -0.5 &amp;amp;&amp;amp; Score &amp;lt; 0.5){
      image_filename&amp;lt;-"neutral-emoji.png"
    }
    if (Score &amp;gt; 0.5){
      image_filename&amp;lt;-"happy-emoji.jpeg"
    }

    image &amp;lt;- load.image(image_filename)
    plot(image)
  })

}

shinyApp(ui = ui, server = server)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As we are calling this script from Python, there’s nothing more to do here.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvrxv6tslu2jd8s1xrql2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvrxv6tslu2jd8s1xrql2.png" alt=" " width="200" height="200"&gt;&lt;/a&gt; &lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz29sp9yxih6cjwv300n8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz29sp9yxih6cjwv300n8.png" alt=" " width="200" height="200"&gt;&lt;/a&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo4qsihd6wxjm36h7k63o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo4qsihd6wxjm36h7k63o.png" alt=" " width="200" height="200"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here are the images we’re using, and they need to be in the same folder as our script.&lt;/p&gt;

&lt;h2&gt;
  
  
  Calling the Dashboard
&lt;/h2&gt;

&lt;p&gt;In order to call the Dashboard, the only thing we need to do is run our Python script by typing this into the terminal window:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ python3 NeuralFeedback.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Dashboard will be opened automatically on the default browser.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk17fl4zuq4xb7jo90xyf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk17fl4zuq4xb7jo90xyf.png" alt=" " width="800" height="443"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That’s it. Hope you like this post! You can get more information on Sentiment Analysis on the Nylas &lt;a href="https://developer.nylas.com/docs/intelligence/sentiment-analysis/#analyze-a-message" rel="noopener noreferrer"&gt;Documentation&lt;/a&gt; page.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Join our &lt;a href="https://nylas.com/events/nylas-101?utm_source=blog&amp;amp;utm_medium=referral&amp;amp;utm_campaign=webinar-nylas-101" rel="noopener noreferrer"&gt;technical demo&lt;/a&gt; to see the Nylas Platform in action&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>rlang</category>
      <category>shiny</category>
      <category>api</category>
      <category>python</category>
    </item>
    <item>
      <title>FinTech Platforms Use Email API to Power Communications</title>
      <dc:creator>Serena</dc:creator>
      <pubDate>Thu, 06 Dec 2018 15:30:00 +0000</pubDate>
      <link>https://forem.com/nylas/fintech-platforms-use-email-api-to-power-communications-10ka</link>
      <guid>https://forem.com/nylas/fintech-platforms-use-email-api-to-power-communications-10ka</guid>
      <description>&lt;p&gt;&lt;a href="https://www.nylas.com/blog/fintech-and-nylas-email-api" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.nylas.com%2Fhubfs%2Ffintech_hero-1.png" alt="fintech_support1"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;FinTech is evolving at the speed of light thanks to blockchain, cryptocurrencies, AI, and one technology you might not expect: an email API. They’re disrupting an industry that’s riddled by legacy systems and processes using APIs to build better software and meet the needs of modern consumers.&lt;/p&gt;

&lt;p&gt;With the help of an email API, FinTech companies are able to focus and execute on automation, customization, and personalization with more agility than legacy companies who are often constrained by more traditional systems. As a result, FinTech products are going to market faster with embedded communications that enable users to communicate with context.&lt;/p&gt;

&lt;p&gt;The Nylas Email API saves financial organizations months of development time by providing the most comprehensive out of the box email integration available. The Nylas Email API acts as a layer of abstraction on top of all email providers including Gmail, Outlook.com, IMAP, and the rest. With just a few lines of code, developers can add full-featured, bi-directional email sync to their applications with ease.&lt;/p&gt;

&lt;h3&gt;&lt;strong&gt;Email APIs Increase User Engagement in Financial CRMs&lt;/strong&gt;&lt;/h3&gt;

&lt;p&gt;The average financial advisor serves about 156 customers on a rolling basis. With an email API, financial CRMs save advisors hours of time each week by centralizing communications (and syncing them between users’ inboxes and the financial CRM), task management, and automation of manual data entry.&lt;/p&gt;

&lt;p&gt;Financial CRM &lt;a href="https://www.nylas.com/case-study-financial-crm-wealthbox" rel="noopener noreferrer"&gt;Wealthbox&lt;/a&gt; decided to build an embedded email client called Wealthbox Mail for the Wealthbox platform to send email and sync with users’ email services- and they turned to the Nylas Email API to do it. Nylas powers email sending, analytics, and templates within Wealthbox, and provides two-way email, calendar, and contacts sync between every Wealthbox users’ inbox and the Wealthbox CRM.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn2.hubspot.net%2Fhubfs%2F3314308%2Ffintech_support1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn2.hubspot.net%2Fhubfs%2F3314308%2Ffintech_support1.png" alt="fintech_support1"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;h3&gt;&lt;strong&gt;Email APIs Improve Client Communication for Tax Professionals&lt;/strong&gt;&lt;/h3&gt;

&lt;p&gt;FinTech companies are also leveraging APIs to build email features for CPAs and other tax professionals that help them keep a record of all email communications with a given client in one central location. This helps tax professionals make informed decisions about their clients’ filing needs and enables them to be more efficient with their time.&lt;/p&gt;

&lt;p&gt;Tax professionals handle documents filled with important data and often have several touchpoints of communication with each client they serve. Every invoice, paystub, and financial legality document is imperative to their overall filing process.&lt;/p&gt;

&lt;p&gt;Companies like &lt;a href="https://www.canopytax.com/" rel="noopener noreferrer"&gt;Canopy&lt;/a&gt;, a leading tax resolution platform that provides practice management software, save their users time through file sharing and storage, online payments, client intake surveys, requests and reminders to improve communication and information sharing.&lt;/p&gt;

&lt;p&gt;With just a few lines of code, the Nylas Email API helped Canopy build features that allow their users to send, receive, and track emails all from within the Canopy platform. This system of record helps tax professionals organize their clients information and saves them the headache of having to save each communication into an associated file on a computer. With this feature, Canopy users can manage their work more efficiently, giving them more time focus on more creative tasks that require human touch.&lt;/p&gt;

&lt;h3&gt;&lt;strong&gt;The Bull Market Goes Beyond Email APIs&lt;/strong&gt;&lt;/h3&gt;

&lt;p&gt;FinTech is making big leaps to meet consumer demands, and using more than just the Nylas API to do it. Many modern finance platforms use &lt;a href="https://stripe.com/" rel="noopener noreferrer"&gt;Stripe&lt;/a&gt; for payments, &lt;a href="https://www.twilio.com/" rel="noopener noreferrer"&gt;Twilio&lt;/a&gt; for text messages, &lt;a href="https://plaid.com/" rel="noopener noreferrer"&gt;Plaid&lt;/a&gt; to connect to bank accounts, and many other APIs that help companies go to market faster with features consumers love.&lt;/p&gt;

&lt;p&gt;With these APIs, everyone from the developers building the apps to the end-users wins.&lt;/p&gt;

</description>
      <category>nylasapi</category>
      <category>engineering</category>
      <category>fintech</category>
      <category>python</category>
    </item>
    <item>
      <title>5 Python Libraries We Love</title>
      <dc:creator>Maria Moy</dc:creator>
      <pubDate>Thu, 29 Nov 2018 15:30:00 +0000</pubDate>
      <link>https://forem.com/nylas/5-python-libraries-we-love-1m3g</link>
      <guid>https://forem.com/nylas/5-python-libraries-we-love-1m3g</guid>
      <description>&lt;p&gt;&lt;a href="https://www.nylas.com/blog/5-python-libraries-we-love" rel="noopener noreferrer"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.nylas.com%2Fhubfs%2Fpython_libraries_hero.png" alt="python_libraries_hero" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Nylas is a Python shop, and while we use a lot of the Python libraries you’d expect to see in an email API codebase, like datetime, imaplib, and xml parsers, we also use a ton of open-source Python tools outside the standard library. These crucial libraries have saved us from reinventing the wheel time and time again, and we’ve gotten a lot of mileage out of them.&lt;/p&gt;

&lt;p&gt;Open-source code isn’t just developed and left standing; it’s regularly maintained and extended by talented and dedicated Python developers. &lt;a href="https://github.com/nylas/sync-engine" rel="noopener noreferrer"&gt;The Nylas Sync Engine&lt;/a&gt;, our core service for syncing data from Gmail, Microsoft, and IMAP email providers, started as an open-source project, which gives us a unique appreciation for the Python maintainers who are responding to issues, merging pull requests, and iterating on the open-source tools we use every day.&lt;/p&gt;

&lt;p&gt;Here are 5 of our favorite Python libraries, and how we use them:&lt;/p&gt;

&lt;h3&gt;&lt;strong&gt;1. ptpython for Fast &amp;amp; Easy Internal Tooling&lt;/strong&gt;&lt;/h3&gt;

&lt;p&gt;When you’re running as many services as we do (a sync service, an API, a developer dashboard, and a webhooks service, to name a few!), with hundreds of customers all using your platform in unique ways, and a database distributed across 200 shards, iterating on interconnected systems and debugging issues becomes a complex problem. &lt;/p&gt;

&lt;p&gt;The &lt;a href="https://github.com/prompt-toolkit/ptpython" rel="noopener noreferrer"&gt;ptpython&lt;/a&gt; REPL brings autocomplete, syntax highlighting and multiline editing to the Python shell, creating a robust and customizable Python environment. We use it to enhance the Python console with pre-loaded text, helper functions and objects for our developers and our developer success engineers to use. If an error pops up in our logs, we can quickly load the buggy object in a Python REPL, debug the root cause, and experiment with solutions directly in the Python shell. &lt;/p&gt;

&lt;p&gt;And just for fun, we made it pretty:&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn2.hubspot.net%2Fhubfs%2F3314308%2FScreen%2520Shot%25202018-11-28%2520at%252011.00.51%2520AM.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn2.hubspot.net%2Fhubfs%2F3314308%2FScreen%2520Shot%25202018-11-28%2520at%252011.00.51%2520AM.png" alt="Screen Shot 2018-11-28 at 11.00.51 AM" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;h3&gt;&lt;strong&gt;2. exchangelib for Syncing Data from Microsoft&lt;/strong&gt;&lt;/h3&gt;

&lt;p&gt;We work with lots of different email protocols when we’re syncing data. For &lt;a href="/exchange-email-api"&gt;Microsoft &lt;/a&gt;accounts, we sync data with Exchange ActiveSync (EAS) and Exchange Web Services (EWS), and we use &lt;a href="https://github.com/ecederstrand/exchangelib" rel="noopener noreferrer"&gt;exchangelib&lt;/a&gt; in our EWS integrations. Microsoft documentation is hard to find via Google search, and not intuitively organized, and exchangelib is especially good about commenting code to include links back to the relevant documentation, so it’s easy for us to track down descriptions of more obscure attributes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn2.hubspot.net%2Fhubfs%2F3314308%2Fpython_libraries_support.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn2.hubspot.net%2Fhubfs%2F3314308%2Fpython_libraries_support.png" alt="python_libraries_support" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;&lt;strong&gt;3. tldextract for Parsing URLs&lt;/strong&gt;&lt;/h3&gt;

&lt;p&gt;If you’ve ever tried to write a regular expression to define a valid url, you know it’s not as trivial as it sounds. The normal &lt;code&gt;.com&lt;/code&gt;, &lt;code&gt;.org&lt;/code&gt; and &lt;code&gt;.net&lt;/code&gt; top-level domains are easy enough to codify, but these days &lt;code&gt;.limo&lt;/code&gt;, &lt;code&gt;.pizza&lt;/code&gt; and &lt;code&gt;.duck&lt;/code&gt; are all valid suffixes as well. In our code, we need to parse urls to validate emails and server addresses, so we use &lt;a href="https://github.com/john-kurkowski/tldextract" rel="noopener noreferrer"&gt;tldextract&lt;/a&gt; to separate the protocol from the domain, subdomain(s) and suffix in a given url. &lt;/p&gt;

&lt;h3&gt;&lt;strong&gt;4. vcr for Fast, Reusable Test Fixtures&lt;/strong&gt;&lt;/h3&gt;

&lt;p&gt;At Nylas, we work with a lot of APIs, which means we make a lot of HTTP requests. To simplify and speed up testing, we use &lt;a href="https://github.com/kevin1024/vcrpy" rel="noopener noreferrer"&gt;vcr&lt;/a&gt; to record the responses from the HTTP interactions in our test code and save them to a flat file in our codebase, called a cassette.&lt;/p&gt;

&lt;p&gt;After the initial response has been recorded, it is “replayed” by later tests, so we don’t have to make live requests to external APIs in our test code. This makes our tests fast (no real HTTP requests anymore), deterministic (the test will continue to pass, even if you are offline) and accurate (the response will contain the same headers and body you get from a real request). &lt;/p&gt;

&lt;h3&gt;&lt;strong&gt;5. expiringdict for Ordered Caches&lt;/strong&gt;&lt;/h3&gt;

&lt;p&gt;Mailgun’s &lt;a href="https://github.com/mailgun/expiringdict" rel="noopener noreferrer"&gt;expiringdict&lt;/a&gt; is a great example of a library that does one thing, and does it really well. Their data structure, based off collections’ &lt;code&gt;OrderedDict&lt;/code&gt;, creates a dictionary with a max length, and items that “expire” after a certain amount of time, to be used as a cache. &lt;/p&gt;

&lt;p&gt;We have a ton of data in our databases, and caching the results of queries we know are executed frequently lets us serve up faster results, with less load on the database. To prevent the cache from getting too big, which impacts performance, we like to cap the size, and it’s convenient to set an expiration date on the data, so that our cache doesn’t get stale.&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;Python is at the heart of what we do, and our love for Python isn't limited to just our work; you can also find us building Python &lt;a href="https://dev.to/nylas/build-a-scheduler-slackbotin-30-minutes-1i6c"&gt;side projects&lt;/a&gt;, giving talks at &lt;a href="https://us.pycon.org/2019/" rel="noopener noreferrer"&gt;PyCon&lt;/a&gt; and attending our local meetups. Have a fun Python library you want to share? We’d love to hear about it! &lt;/p&gt;

&lt;p&gt;For more information on how to get started with the Nylas APIs, &lt;a href="https://www.nylas.com/products/" rel="noopener noreferrer"&gt;Click here&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjbeajgygmrg3mw4i54yc.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjbeajgygmrg3mw4i54yc.gif" width="1" height="1"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>engineering</category>
      <category>api</category>
      <category>python</category>
    </item>
    <item>
      <title>HR Software Companies Use The Nylas Calendar API to Accelerate Time to Market</title>
      <dc:creator>Serena</dc:creator>
      <pubDate>Thu, 15 Nov 2018 16:30:00 +0000</pubDate>
      <link>https://forem.com/nylas/hr-software-companies-use-the-nylas-calendar-api-to-accelerate-time-to-market-374n</link>
      <guid>https://forem.com/nylas/hr-software-companies-use-the-nylas-calendar-api-to-accelerate-time-to-market-374n</guid>
      <description>

&lt;p&gt;&lt;a href="https://www.nylas.com/blog/hr-software-companies-use-the-nylas-calendar-api-to-accelerate-time-to-market"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PJZQaxCf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.nylas.com/hubfs/01_HR_Calendar.jpg" alt="02_Calendar_API_support"&gt; &lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Automation is all around us, from self-driving cars to automatic payments, from virtual assistants like Alexa and Echo to check-in kiosks at the airports. Automation has fundamentally changed how businesses operate: it has increased efficiency, transparency, and work-life balance by handling tedious and repetitive tasks and leaving the more human tasks to humans. Which is why automation for HR software is so prevalent, and so important.&lt;/p&gt;

&lt;p&gt;Companies like &lt;a href="https://beamery.com/"&gt;Beamery&lt;/a&gt;, &lt;a href="https://www.lever.co/"&gt;Lever&lt;/a&gt;, and &lt;a href="https://www.catsone.com/"&gt;CATS&lt;/a&gt; (an applicant tracking system) all provide streamlined recruiting and HR processes to their users - and for a good reason. According to &lt;a href="https://content.workmarket.com/2020-insight-report-what-ai-automation-mean-for-work/?utm_source=forbes&amp;amp;utm_medium=blog&amp;amp;utm_campaign=2017_automation_report&amp;amp;utm_content=home-page"&gt;WorkMarket’s 2020 In(Sight)&lt;/a&gt; Report, 53% of employees state that automation can help save them up to 2 work hours a day which accounts to six weeks (240 hours) of time per year, while 78% of business leaders could save up to 3 work hours a day which totals up to nine weeks (360 hours) of time per year.&lt;/p&gt;

&lt;p&gt;You can build scheduling sync between your HR software application and your user’s calendars using the &lt;a href="https://www.nylas.com/calendar-sync"&gt;Nylas Calendar API&lt;/a&gt;. Save your end-users hundreds of working hours by automating scheduling tasks for them.&lt;/p&gt;

&lt;h3&gt;&lt;strong&gt;Empower Users to Streamline Recruiting with Calendar Sync&lt;/strong&gt;&lt;/h3&gt;

&lt;p&gt;Recruiting is a complex, multi-faceted process with multiple variables and little room for error: from creating job postings to resume screening, conducting interviews, vetting candidates, gathering feedback - and it can take up to weeks to nail them down if not months. Automation can help make recruiting a seamless process.&lt;/p&gt;

&lt;p&gt;With the Nylas calendar API, developers can build full calendar CRUD (create, read, update and delete capabilities), and bi-directional calendar sync to expedite and improve the hiring process for recruiters. The faster the hiring process, the better the chances are of recruiting the best candidate.&lt;/p&gt;

&lt;p&gt;Users can schedule interviews and calls all from within your HR software’s interface. Multiple interviews can be arranged in just one click, free/busy schedules are shown, and the event is added to the calendars of all the attendees.&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9WZkpoo5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn2.hubspot.net/hubfs/3314308/02_Calendar_API_support.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9WZkpoo5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn2.hubspot.net/hubfs/3314308/02_Calendar_API_support.jpg" alt="02_Calendar_API_support"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;h3&gt;&lt;strong&gt;Empower Users to Organize Meetings with Calendar Sync&lt;/strong&gt;&lt;/h3&gt;

&lt;p&gt;Meetings are a great way to get the team on the same page, discuss strategies, and plan for the future. If meetings are not appropriately managed, they can take up &lt;a href="https://www.atlassian.com/time-wasting-at-work-infographic?utm_source=zapier.com&amp;amp;utm_medium=referral&amp;amp;utm_campaign=zapier&amp;amp;utm_source=zapier.com&amp;amp;utm_medium=referral&amp;amp;utm_campaign=zapier"&gt;31 hours&lt;/a&gt; of the work time per month.&lt;/p&gt;

&lt;p&gt;Even though organizing a meeting can be simple, the difficulty level increases as the number of attendees grow - sending emails, getting everyone's schedule, making phone calls, finding a room, arranging the resources.&lt;/p&gt;

&lt;p&gt;The more time is spent organizing a meeting, that's less time spent towards a higher priority task.&lt;/p&gt;

&lt;p&gt;Adding calendar sync to meeting room booking software eradicates the need to book everything individually. Meeting organizers save hours, giving them more time to spend on meeting preparation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://get.fountain.com/"&gt;Fountain&lt;/a&gt; is an applicant tracking and recruiting platform which helps companies around the world hire hourly workers at scale using self-service interview booking, automation, machine learning, and customizable workflows.&lt;/p&gt;

&lt;p&gt;When Fountain users book meetings, the choose a block of time surrounded by other work meetings or personal plans. With the help of Nylas Calendar API, Fountain's scheduling system work in harmony with their users’ whole schedule.&lt;/p&gt;

&lt;p&gt;In a nutshell, it will keep records of every meeting in one place. Every time you create a new place to store data, you give yourself more to maintain and more chances for details to slip through the cracks.&lt;/p&gt;

&lt;p&gt;Throughout the hiring process, candidates will go through different stages. The Nylas Calendar API will track the journey of your applicant and will also keep track of any schedule change of either the organization or the candidate.&lt;/p&gt;

&lt;h3&gt;&lt;strong&gt;Next Steps &lt;/strong&gt;&lt;/h3&gt;

&lt;p&gt;Above all, automating any function within your business frees up time, reduces human error and creates more efficiency. These are just a handful of the ways the Nylas calendar API can create better experiences for businesses and employees.&lt;/p&gt;

&lt;p&gt;For more information and to get started with a free trial, &lt;a href="https://www.nylas.com/calendar-sync"&gt;click here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VU43E2tx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://track.hubspot.com/__ptq.gif%3Fa%3D3314308%26k%3D14%26r%3Dhttps%253A%252F%252Fwww.nylas.com%252Fblog%252Fhr-software-companies-use-the-nylas-calendar-api-to-accelerate-time-to-market%26bu%3Dhttps%25253A%25252F%25252Fwww.nylas.com%25252Fblog%26bvt%3Drss" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VU43E2tx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://track.hubspot.com/__ptq.gif%3Fa%3D3314308%26k%3D14%26r%3Dhttps%253A%252F%252Fwww.nylas.com%252Fblog%252Fhr-software-companies-use-the-nylas-calendar-api-to-accelerate-time-to-market%26bu%3Dhttps%25253A%25252F%25252Fwww.nylas.com%25252Fblog%26bvt%3Drss" alt=""&gt;&lt;/a&gt;&lt;/p&gt;


</description>
      <category>nylasapi</category>
      <category>python</category>
      <category>hrsoftware</category>
    </item>
    <item>
      <title>How to Get Full Calendar Sync &amp; CRUD with the Nylas Calendar API</title>
      <dc:creator>Serena</dc:creator>
      <pubDate>Thu, 08 Nov 2018 15:03:00 +0000</pubDate>
      <link>https://forem.com/nylas/how-to-get-full-calendar-sync--crud-with-the-nylas-calendar-api-1242</link>
      <guid>https://forem.com/nylas/how-to-get-full-calendar-sync--crud-with-the-nylas-calendar-api-1242</guid>
      <description>

&lt;p&gt;&lt;a href="https://www.nylas.com/blog/all-about-the-nylas-calendar-api-and-how-it-works"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oDr_u9GW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.nylas.com/hubfs/Calendar_API-1.png" alt="Calendar_API_2"&gt; &lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Need to build a calendar integration? Power your application with real-time, secure calendar sync with as little as four lines of code. Find out how the &lt;a href="https://www.nylas.com/calendar-sync"&gt;Nylas Calendar API&lt;/a&gt; can help.&lt;/p&gt;

&lt;p&gt;We have several meetings and appointments to keep track of on a daily basis, be it personal or professional. We heavily rely on our calendars to track our events. Come to think of it, all of the events in our lives are actually scattered between different calendar providers.&lt;/p&gt;

&lt;p&gt;All these calendars have their own systemic features that process data in different ways. We would need to build independent connections for individual providers. On top of that, we’d also have to maintain those connections and ensure the software works with past, present, and future versions of every provider’s API updates (sometimes they introduce breaking changes that hinder their functionality).&lt;/p&gt;

&lt;p&gt;You have the choice to build unique connections with every individual calendar provider, or you can use the Nylas Calendar API and save months of developer time through one simple integration.&lt;/p&gt;

&lt;p&gt;This way, you can spend more time focusing on the features you love to build.&lt;/p&gt;

&lt;p&gt;Our &lt;a href="https://www.nylas.com/calendar-sync"&gt;Calendar API &lt;/a&gt; powers your application with real-time, secure calendar sync. Why is it important you ask? It's important because building scheduling and calendar sync features are mission-critical for many software companies.&lt;/p&gt;

&lt;p&gt;Without Nylas, developers could easily take 12 months or more to build these connections with each calendar provider where the infrastructure varies between Gmail, Outlook.com, Exchange, Office 365 and the rest.&lt;/p&gt;

&lt;p&gt;In this post, we will see how you can avoid all that by diving into some of the features and functionality of our Calendar API.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---V3g2tPs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn2.hubspot.net/hubfs/3314308/Calendar_API_2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---V3g2tPs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn2.hubspot.net/hubfs/3314308/Calendar_API_2.png" alt="Calendar_API_2" width="650"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;span&gt;&lt;strong&gt;The Nylas Calendar API&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span&gt;The Nylas Calendar API acts as a layer of abstraction on top of all the calendar providers. You can streamline the scheduling process and updates in real-time.&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;When an account authenticates to Nylas, one of our sync servers will claim the account and automatically start syncing calendar data into Nylas' database. Each account connected to Nylas can have multiple calendars, and each calendar can have a collection of individual events.&lt;/p&gt;

&lt;p&gt;The calendar API accesses all of the information to secure a time that fits everyone's schedule. It can also give the person you're meeting with access to your calendar and lets them choose the time that works best.&lt;/p&gt;

&lt;p&gt;Once the appointment slot is reserved, the calendar is updated instantly, so there is never a chance of double booking or missing a meeting.&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;&lt;span&gt;&lt;strong&gt;Outlook.com Calendar Connectivity&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;If you’re building a software that needs calendar connectivity with Outlook.com, the APIs, services, and templates often end up causing more dependencies than solutions.&lt;/p&gt;

&lt;p&gt;The Nylas Calendar API abstracts away all of the complexity of building an app that integrates with Outlook.com calendars and handles all product changes and API modifications, so you don’t experience outages or service disruptions.&lt;/p&gt;

&lt;p&gt;Nylas streamlines calendar sync from Outlook.com and every other calendar provider (Gmail, Exchange, Office 365, and the rest) giving you a dependable API that intelligently adapts to any changes the calendar providers introduce.&lt;/p&gt;

&lt;p&gt;Using the API, you have full CRUD (Create, Read, Update, and Delete) capabilities through powerful API primitives. In addition to these, Nylas powers all the calendar features your customers require.&lt;/p&gt;

&lt;p&gt; &lt;span&gt; &lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span&gt;&lt;strong&gt;Booking and Cancellation&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;By having access to all the synced calendars and real-time updates, reservations and cancellations become easily manageable. From single events on team calendars to custom recurring events, the Nylas Calendar API handles it all.&lt;/p&gt;

&lt;p&gt;You can update your plans from your calendar, and the changes will be reflected on the schedules of everyone affected in real-time.&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Appointment Reminders and Task Scheduling &lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Whatever the reason behind a missed appointment, it can get expensive for your company. With Nylas, everyone gets automated appointment reminders to remind all parties of scheduled meetings. &lt;/p&gt;

&lt;p&gt;&lt;span&gt;The integration also has access to all the calendars which makes it easier to schedule tasks and makes deadline management a breeze.&lt;/span&gt;&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;span&gt;Productivity Analytics &lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The API also receives productivity data by analyzing cross-team availability. It pulls data from the calendar and calculates the open rate, the click-through rate, the email usage (how many emails were sent and received) and the calendar meetings (how frequently the meetings were scheduled). It collects all this data to determine how time is being spent  and helps provide a solution for how it can be improved.&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;&lt;span&gt;&lt;strong&gt;Quick-start SDKs&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;With Nylas, you don’t have to build a calendar integration from scratch. We offer a &lt;a href="https://www.nylas.com/developers/"&gt;suite of SDKs &lt;/a&gt; to get you started quickly so you can spend more time iterating features to your users’ exact specifications.&lt;/p&gt;

&lt;p&gt;We offer SDKs in three core languages: Ruby, Node JS, and Python. With just a few lines of code, you can integrate Nylas into your app faster, maintain higher code quality, and free up time for building core features.&lt;/p&gt;

&lt;p&gt;&lt;span&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Lcmy56P9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn2.hubspot.net/hubfs/3314308/Calendar_API_3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Lcmy56P9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn2.hubspot.net/hubfs/3314308/Calendar_API_3.png" alt="Calendar_API_3" width="650"&gt;&lt;/a&gt; &lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span&gt;&lt;strong&gt;Security and Privacy&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.nylas.com/security/"&gt;Enterprise-grade security and privacy controls&lt;/a&gt; have always been at the heart of what we do. The Nylas Calendar API encrypts 100% of data with military-grade security standards.&lt;/p&gt;

&lt;p&gt;Here are some of the ways we protect and secure data in our infrastructure:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Transparency and Compliance - Certified: Nylas is SOC2 Certified, GDPR compliant, EU Privacy Shield Certified, and HIPAA ready.&lt;/li&gt;
&lt;li&gt;Encryption and Access Control: User data is encrypted at rest using enterprise-grade standards.&lt;/li&gt;
&lt;li&gt;Network Transport and Storage: Nylas systems enforce TLS for public and private networks, and only support certificates signed by well-known CAs.&lt;/li&gt;
&lt;li&gt;Infrastructure and Physical Security: Our products run on AWS in a secure facility with active monitoring, total system logging, and security.                                         &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;&lt;span&gt;&lt;strong&gt;Ready to Get Started?&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;The Nylas Calendar API was built by developers, for developers, allowing you to share team calendars, link to specific meetings, schedule recurring meetings, and more.&lt;/p&gt;

&lt;p&gt;Our Calendar API helps you develop connectivity into your application with ease.&lt;/p&gt;

&lt;p&gt;For more on how to get started, &lt;a href="https://dashboard.nylas.com/register"&gt;click here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OY4ZuUH0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://track.hubspot.com/__ptq.gif%3Fa%3D3314308%26k%3D14%26r%3Dhttps%253A%252F%252Fwww.nylas.com%252Fblog%252Fall-about-the-nylas-calendar-api-and-how-it-works%26bu%3Dhttps%25253A%25252F%25252Fwww.nylas.com%25252Fblog%26bvt%3Drss" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OY4ZuUH0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://track.hubspot.com/__ptq.gif%3Fa%3D3314308%26k%3D14%26r%3Dhttps%253A%252F%252Fwww.nylas.com%252Fblog%252Fall-about-the-nylas-calendar-api-and-how-it-works%26bu%3Dhttps%25253A%25252F%25252Fwww.nylas.com%25252Fblog%26bvt%3Drss" alt=""&gt;&lt;/a&gt;&lt;/p&gt;


</description>
      <category>nylasapi</category>
      <category>crud</category>
      <category>python</category>
    </item>
    <item>
      <title>The API Advantage for Android and iOS Application Developers</title>
      <dc:creator>Serena</dc:creator>
      <pubDate>Thu, 25 Oct 2018 18:29:04 +0000</pubDate>
      <link>https://forem.com/nylas/the-api-advantage-for-android-and-ios-application-developers-3knn</link>
      <guid>https://forem.com/nylas/the-api-advantage-for-android-and-ios-application-developers-3knn</guid>
      <description>&lt;p&gt;&lt;a href="https://www.nylas.com/blog/building-android-and-ios-applications-with-the-nylas-api"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MemTFpYe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.nylas.com/hubfs/Developing_Apps_with_Nylas-1.png%3Ft%3D1540490462550" alt="HaystackCRM calendar iPhone screenshot Oct 18" width="751" height="500"&gt; &lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the mobile application world, going to market quickly with the core features your users need is critical. That's why we created the Nylas API, to help developers build the mobile application of their dreams without having to worry about the communications layer. &lt;/p&gt;

&lt;p&gt;Developers building mobile applications use the Stripe API for payments, the Twilio API for SMS, and the Nylas API for email, calendar and contacts. &lt;span&gt;Nylas's &lt;/span&gt;&lt;a href="https://www.nylas.com/email-api"&gt;email&lt;/a&gt;&lt;span&gt; API,&lt;span&gt; &lt;/span&gt;&lt;/span&gt;&lt;a href="https://www.nylas.com/sync-contacts"&gt;contacts&lt;/a&gt;&lt;span&gt; API, and&lt;span&gt; &lt;/span&gt;&lt;/span&gt;&lt;a href="https://www.nylas.com/calendar-sync"&gt;calendar&lt;/a&gt;&lt;span&gt;&lt;span&gt; &lt;/span&gt;API power Android and iOS applications for companies like Voiply (the cloud-based phone system) and Haystack CRM. &lt;/span&gt;&lt;/p&gt;

&lt;p&gt;So what can you build with the Nylas API? Let's dive in.&lt;span&gt; &lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span&gt;&lt;strong&gt;&lt;span&gt;Scheduling &amp;amp; Calendar Sync for Android and iOS applications&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Ensure the end-users of your mobile app never miss a meeting by powering your application with calendar sync. The Nylas Calendar API connects to 100% of calendar providers, enabling scheduling and calendar sync features between your mobile application and your user's specific calendar provider (Google Calendar, Exchange Calendar, Outlook.com Calendar, and the rest). &lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.haystackcrm.com/"&gt;HaystackCRM&lt;/a&gt;,&lt;span&gt; a mobile-first CRM for contact and sales pipeline management, built scheduling &amp;amp; calendar sync into their application with the Nylas API.&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Now users can choose to connect their calendar accounts to view and schedule events within HaystackCRM. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DvXhvqHG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn2.hubspot.net/hubfs/3314308/HaystackCRM%2520calendar%2520iPhone%2520screenshot%2520Oct%252018.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DvXhvqHG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn2.hubspot.net/hubfs/3314308/HaystackCRM%2520calendar%2520iPhone%2520screenshot%2520Oct%252018.jpg" alt="HaystackCRM calendar iPhone screenshot Oct 18" width="880" height="1564"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;(Haystack Calendar Sync)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Build Calendar Sync in Weeks, Not Months&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In just one internal hackathon, it took one engineer a single day to build out their powerful scheduling tool by simply using the Nylas Calendar API as their framework. The result was a powerful scheduling tool that united all users’ calendar synching, regardless of platform.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Feature-Rich Calendar Functionality&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;They also built out feature-rich functionality that provided everything a user would want in to schedule meetings. Users can fully create, read, update, and delete calendar events in real time. As a result, all users are able to quickly book and cancel appointments, set appointment reminders, and even view cross-platform productivity analytics — all within the iOS app.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Key Takeaway:&lt;/strong&gt;&lt;span&gt; With a powerful calendar API, your team gets a headstart building other core features while reducing devops hours.&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;span&gt;Email Sync on Android for iOS Devices&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;HaystackCRM also uses the Nylas API to remove friction from their CRM-to-email integration. They needed to find a way to integrate their CRM within Office365, Outlook.com, Exchange, and IMAP email providers in a way that scaled with their business. &lt;span&gt;Using the Nylas API has given HaystackCRM more options of email management beyond the initial offering. Features powered by the Nylas API allow HaystackCRM users to maintain a level of comfort of using previous email addresses, email clients and calendars while moving forward with HaystackCRM.&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GaBALTku--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn2.hubspot.net/hubfs/3314308/HaystackCRM%2520email%2520view%2520iPhone%2520screenshot.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GaBALTku--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn2.hubspot.net/hubfs/3314308/HaystackCRM%2520email%2520view%2520iPhone%2520screenshot.jpg" alt="HaystackCRM email view iPhone screenshot" width="880" height="1564"&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span&gt;(Haystack Email sync)&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Two-Way Email Sync&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The Nylas email API provides seamless two-way email, calendar, and contacts sync between a single user’s inbox and the customer’s CRM. From there, users could compose and send emails from within the app — saving a wealth of time by minimizing the need for context switching and eliminating any need for manual data entry between the CRM and the app.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Group Email Accounts&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;span&gt;The customer’s app was also better able to create more sophisticated email-to-CRM synching features. For instance, with the aid of the Nylas email API, CRM users could great group email accounts to enable quicker and more efficient collaboration across the team. For instance, if a team member was on vacation or out sick, any team member can simply log into the app and see recent customer interactions right within the app.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Key Takeaway&lt;/strong&gt;: While there is often a great deal of complexity when it comes to developing features for cross-platform CRM integrations, an intuitive API allows developers to build powerful, new CRM features on the fly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;span&gt;Contacts Sync for Android and iOS apps&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;span&gt;VoIPLy provides simple and reliable phone solutions to help businesses serve their clients and customers better. Their cloud-based unified communication system is packed with more than 60 powerful phone features, enabling users to do business anywhere, anytime.&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;When customers click on contacts, the application integrates with Nylas to sync all of their contacts. VoIPLy has also created a Calendar App for their phone system, in which enables the system to read off events on calendars to callers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--khassl6E--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn2.hubspot.net/hubfs/3314308/image003.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--khassl6E--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn2.hubspot.net/hubfs/3314308/image003.jpg" alt="image003" width="880" height="687"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;                &lt;/strong&gt;            (Users Authenticate Contacts Sync via the Nylas API)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Up-to-date Contact Profiles with Contact Sync&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The Nylas Contacts API syncs profile information from user's contacts books to mobile applications and back. If a profile photo, email address, physical address, phone number, or any other critical information is updated in the user's address book, your mobile application is updated immediately as well.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Quick and Friction-Free Integration&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Using Nylas docs, integrating the API was virtually instant. Within a week, the developer team was able to pull together a proof-of-concept and deploy the API into their production environment.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Key Takeaway:&lt;/strong&gt;&lt;span&gt; &lt;/span&gt;The right contacts API dramatically shortens your feature development time, ensuring that you are building the most dynamic contacts-syncing functionality possible — and quickly.&lt;/p&gt;

&lt;p&gt;&lt;span&gt; &lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span&gt;These are just a few of the many use cases our customers are using to evolve their email and calendar functions within their applications. Are you ready to transform your Android or iOS application with Nylas? &lt;/span&gt;&lt;a href="https://dashboard.nylas.com/register?hsCtaTracking=c8077637-e759-48f2-9ce5-66ab017d65bb%7Cfc079ea6-d244-49a9-8521-93a5870c6bee"&gt;Get started here.&lt;/a&gt;&lt;/p&gt;

</description>
      <category>android</category>
      <category>ios</category>
      <category>api</category>
      <category>application</category>
    </item>
    <item>
      <title>Improve Customer Support Efficiency with Calendar Sync</title>
      <dc:creator>Tasia Potasinski</dc:creator>
      <pubDate>Thu, 18 Oct 2018 17:46:14 +0000</pubDate>
      <link>https://forem.com/nylas/improve-customer-support-efficiency-with-calendar-sync-imd</link>
      <guid>https://forem.com/nylas/improve-customer-support-efficiency-with-calendar-sync-imd</guid>
      <description>

&lt;p&gt;&lt;a href="https://www.nylas.com/blog/calendar-sync-customer-support-freshdesk"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ICYaertr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.nylas.com/hubfs/Freshdesk_V1-2.png%3Ft%3D1539883521584" alt="Freshdesk_V1-2"&gt; &lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Whether you call it customer service, customer support, customer care, or something else, the goal is the same: Increase your customer satisfaction score (CSAT) while increasing customer support representative's efficiency. As any team in a customer facing support role knows, this is easier said than done.&lt;/p&gt;

&lt;p&gt;Which is why we're excited to announce a partnership between &lt;a href="/" rel=" noopener"&gt;Nylas&lt;/a&gt; and Freshdesk that enables support teams to help their customers get to resolutions faster and with more direct support.&lt;span&gt; &lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kRvV0DO3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn2.hubspot.net/hubfs/3314308/Step%25206%2520Group%2520selection.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kRvV0DO3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn2.hubspot.net/hubfs/3314308/Step%25206%2520Group%2520selection.png" alt="Step 6 Group selection" width="1345"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;span&gt;&lt;span&gt;The &lt;a href="https://apps.freshdesk.com/freshdesk_scheduling_app/" rel=" noopener"&gt;Freshdesk Scheduling Application&lt;/a&gt; (powered by the&lt;span&gt; &lt;/span&gt;&lt;/span&gt;&lt;a href="https://www.nylas.com/calendar-sync"&gt;Nylas Calendar API&lt;/a&gt;&lt;span&gt;) allows Freshdesk agents to schedule meetings between users and the first available agent, all without leaving the Freshdesk platform. The calendar sync API offers your agents the ability to seamlessly integrate with all calendar services, including Gmail and Outlook from within Freshdesk, so customers receive native event invites. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;When agents spend less time on administrative work like scheduling meetings, they have more time for human to human support interactions. The calendar sync features include:&lt;/p&gt;

&lt;p&gt;&lt;span&gt;&lt;strong&gt;Seamless Integration with 100% of Calendars&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;The Nylas API connects 100% of email service providers to the Freshdesk application, allowing users to sync their calendars from Gmail, &lt;a href="/outlook-calendar-api" rel=" noopener"&gt;Outlook.com&lt;/a&gt;, Microsoft Exchange, Outlook.com and the rest. &lt;/p&gt;

&lt;p&gt;&lt;span&gt;&lt;strong&gt;Schedule Meetings With Context&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span&gt;C&lt;/span&gt;ontext is crucial to excellent customer support. By scheduling calls between customer support agents and users within the Freshdesk app, you can easily copy and paste all of the context of a support ticket in to the call agenda so both teams have full context.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KxdDCANS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn2.hubspot.net/hubfs/3314308/Step%25207%2520Time%2520selection%2520for%2520appointment.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KxdDCANS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn2.hubspot.net/hubfs/3314308/Step%25207%2520Time%2520selection%2520for%2520appointment.png" alt="Step 7 Time selection for appointment" width="584"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Route Customers to the Right Team Faster&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Context is crucial to excellent customer support. By scheduling calls between customer support agents and users within the Freshdesk app, you can easily copy and paste all of the context of a support ticket in to the call agenda so both teams have full context.&lt;/p&gt;


&lt;h3&gt;
&lt;strong&gt;Save Customer Support Agents’ Time&lt;/strong&gt;

&lt;/h3&gt;
&lt;p&gt;The Nylas app saves agents from bouncing out of Freshdesk, to a CRM platform, to another scheduling platform, and back to Freshdesk just to schedule a customer call. Now, with a few clicks, agents can tag the appropriate teams to handle an issue as well as schedule a date, time, and medium for the meeting.&lt;/p&gt;


&lt;h3&gt;
&lt;strong&gt;Ready to get started?&lt;/strong&gt;

&lt;/h3&gt;
&lt;p&gt;Anyone with a Freshdesk account can download and use the Freshdesk Scheduler. Simply download the app from the Freshdesk marketplace.&lt;/p&gt;

&lt;p&gt;The next time your customer writes in you’ll be fully equipped to deliver support that feels like magic.&lt;/p&gt;

&lt;p&gt;Download the &lt;a href="https://apps.freshdesk.com/freshdesk_scheduling_app/" rel=" noopener"&gt;Freshdesk Scheduling application here.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bVHL1zDF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://track.hubspot.com/__ptq.gif%3Fa%3D3314308%26k%3D14%26r%3Dhttps%253A%252F%252Fwww.nylas.com%252Fblog%252Fcalendar-sync-customer-support-freshdesk%26bu%3Dhttps%25253A%25252F%25252Fwww.nylas.com%25252Fblog%26bvt%3Drss" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bVHL1zDF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://track.hubspot.com/__ptq.gif%3Fa%3D3314308%26k%3D14%26r%3Dhttps%253A%252F%252Fwww.nylas.com%252Fblog%252Fcalendar-sync-customer-support-freshdesk%26bu%3Dhttps%25253A%25252F%25252Fwww.nylas.com%25252Fblog%26bvt%3Drss" alt=""&gt;&lt;/a&gt;&lt;/p&gt;


</description>
      <category>nylasapi</category>
    </item>
  </channel>
</rss>
