<?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>DEV Community: Smit Jethwa</title>
    <description>The latest articles on DEV Community by Smit Jethwa (@smitjethwa).</description>
    <link>https://dev.to/smitjethwa</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%2Fuser%2Fprofile_image%2F242095%2F3d5d7f5a-27ea-4190-83ce-d4fdfe2ec02a.jpg</url>
      <title>DEV Community: Smit Jethwa</title>
      <link>https://dev.to/smitjethwa</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/smitjethwa"/>
    <language>en</language>
    <item>
      <title>Python to PHP: A Developer's Journey of Transition</title>
      <dc:creator>Smit Jethwa</dc:creator>
      <pubDate>Wed, 18 Oct 2023 05:47:40 +0000</pubDate>
      <link>https://dev.to/smitjethwa/python-to-php-a-developers-journey-of-transition-i32</link>
      <guid>https://dev.to/smitjethwa/python-to-php-a-developers-journey-of-transition-i32</guid>
      <description>&lt;h3&gt;
  
  
  Background
&lt;/h3&gt;

&lt;p&gt;My journey as a developer took an unexpected turn when I joined a new organisation that primarily relied on PHP for its backend infrastructure. I found myself having to learn a new language. Having had a decent experience with Python and Django, this transition was quite an interesting experience.&lt;/p&gt;

&lt;p&gt;Python and PHP, despite their differences, share a common trait - they are both interpreted languages. This means that instead of compiling the code into machine-level instructions, interpreters run through the program line by line, executing each command in real time. While the overarching concept remains the same, the journey from Python to PHP unveils some intriguing distinctions.&lt;/p&gt;

&lt;p&gt;Let's delve into my experience as I navigated this transition, highlighting the contrasts and similarities between these two versatile languages.&lt;/p&gt;

&lt;h3&gt;
  
  
  Installation
&lt;/h3&gt;

&lt;p&gt;Navigating Local Development Environments&lt;br&gt;
Three months ago, I embarked on a new professional journey, joining a vibrant team that had its unique approach to local development environments. In my previous experiences with Python, setting up my local development environment had been a breeze. However, transitioning to PHP was a different story altogether. &lt;/p&gt;

&lt;p&gt;For Windows users, the process of installing PHP was notably more complex than Python. I discovered that there were primarily two main methods to get PHP up and running. The team I joined predominantly used &lt;a href="https://www.apachefriends.org/"&gt;XAMPP&lt;/a&gt; and &lt;a href="https://laragon.org/docs/index.html"&gt;Laragon&lt;/a&gt;, both of which presented their own set of advantages and challenges.&lt;/p&gt;

&lt;p&gt;While Python installations were usually straightforward, it was an eye-opener to see that PHP often required more effort to configure on Windows. In contrast, Linux distributions like Ubuntu came with PHP pre-installed, simplifying the setup considerably.&lt;/p&gt;

&lt;p&gt;In this blog, I'll dive into the intricacies of setting up PHP on Windows using XAMPP and Laragon, sharing my experiences and insights as I navigated this essential aspect of my transition from Python to PHP development.&lt;/p&gt;

&lt;p&gt;On the Xampp Server, the URL looks like this: &lt;code&gt;http://localhost/project_name/v1/login&lt;/code&gt; &lt;br&gt;
Whereas, in Laragon, It’ll be &lt;code&gt;project_name.test/v1/login&lt;/code&gt;   [Looks good ;)]&lt;/p&gt;

&lt;h3&gt;
  
  
  Software Design: MVT vs MVC
&lt;/h3&gt;

&lt;p&gt;Laravel, a PHP web framework is based on MVC (Model-View-Controller) software design. In the case of Django, it’s MVT (Model-View-Template)&lt;br&gt;
M - Model: Database (similar to M for Django)&lt;br&gt;
This Model is the central component of this architecture and manages the data, logic as well as other constraints of the application.&lt;br&gt;
V - View: UI, what the end-user will see. (similar to T for Django)&lt;br&gt;
The View deals with how the data will be displayed to the user and provides various data representation components. &lt;br&gt;
C - Controller: Logic (similar to V for Django)&lt;br&gt;
The Controller manipulates the Model and renders the view by acting as a bridge between both of them. &lt;/p&gt;

&lt;h3&gt;
  
  
  MVT Design
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tbyifN2N--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/30zr5mvaouhw82kynw6h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tbyifN2N--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/30zr5mvaouhw82kynw6h.png" alt="MVT Design" width="800" height="320"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  MVC Design
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oUkMRESi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s24hcniq1q5qf80q08ch.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oUkMRESi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s24hcniq1q5qf80q08ch.png" alt="MVC Design" width="749" height="595"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Syntex
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;(One thing to remember! Syntex changes, Logic remains the same.)&lt;/strong&gt;&lt;br&gt;
PHP and Python both have different syntax structures. &lt;br&gt;
E.g.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Back to semi colons;&lt;/li&gt;
&lt;li&gt;Declaration of variables. 

&lt;ul&gt;
&lt;li&gt;Python: &lt;code&gt;varibable_name&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;PHP: &lt;code&gt;$variable_name&lt;/code&gt; (followed by $ symbol)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;self&lt;/code&gt; changed to &lt;code&gt;this&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Python has one of the strict rules of Indentation (4 black spaces). PHP doesn't follow this, It has a conventional way of using Curly Brackets to define a code block {}.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Python:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def sum(number1,number2):
    return number1 + number2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  PHP:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function sum($number1, $number2)
{
    return $number1 + $number2;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The complete tutorial can be found here on the PHP tutorial website: &lt;a href="https://www.phptutorial.net/"&gt;https://www.phptutorial.net/&lt;/a&gt;&lt;br&gt;
Also, It is suggested to follow the Style Guide so that other developers can distinguish the names of variables, functions, classes, methods, and Exceptions etc. It provides rules and guidance for a given programming language, meant to ensure consistency from one project and one programmer to another. &lt;br&gt;
I was using &lt;a href="https://peps.python.org/pep-0008/"&gt;PEP8&lt;/a&gt; for Style Guide for Python Code and now, I am following &lt;a href="https://www.php-fig.org/psr/psr-12/"&gt;PSR-12&lt;/a&gt; for PHP code.&lt;/p&gt;

&lt;h3&gt;
  
  
  Terminologies
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Python&lt;/th&gt;
&lt;th&gt;PHP&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;dist apps (common functions)&lt;/td&gt;
&lt;td&gt;Services/Helper&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;User/models.py&lt;/td&gt;
&lt;td&gt;Models/UserModel.php&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;User/views.py&lt;/td&gt;
&lt;td&gt;Http/Controller/UserController.php&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;User/renderers.py, serializer.py other misc&lt;/td&gt;
&lt;td&gt;Services/UserService.php / Helpers/UserHelper.php&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;app_name/urls.py&lt;/td&gt;
&lt;td&gt;routes/web.php&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Basic Directory Structure
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eJo2oBed--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i59b79itzpwe4n2uydm0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eJo2oBed--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i59b79itzpwe4n2uydm0.png" alt="BasicDirectoryStructure" width="794" height="799"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Dependencies: Xampp or Laragon
&lt;/h3&gt;

&lt;p&gt;While setting up a project in Xampp, don't forget to make changes in php.ini to install services like MongoDB or 3rd party services. (&lt;a href="https://pecl.php.net/"&gt;PECL:: The PHP Extension Community Library&lt;/a&gt; one-stop for Extension Library)&lt;br&gt;
Python supports package managers like pip or conda. pip is widely used PM. PHP uses composer. Composer is a tool for dependency management in PHP.&lt;br&gt;
For example:&lt;br&gt;
Python: &lt;code&gt;pip install pymongo&lt;/code&gt;&lt;br&gt;
PHP: &lt;code&gt;composer require mongodb/mongodb&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Database
&lt;/h3&gt;

&lt;p&gt;Django used SQLite DB by default and PHP used MySQL.&lt;br&gt;
Here, syntax remains the same. Both frameworks work well with SQL Databases. &lt;/p&gt;

&lt;h3&gt;
  
  
  The problems I faced in the beginning:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Structure of MVC&lt;/li&gt;
&lt;li&gt;To understand, inbuilt methods inside Laravel&lt;/li&gt;
&lt;li&gt;Debugging doesn't work well for PHP7&lt;/li&gt;
&lt;li&gt;I had to re-install Xampp several times due to the unavailability of the port. Xampp uses port 80&lt;/li&gt;
&lt;li&gt;Issued problem while changing Virtual Host in &lt;em&gt;httpd-vhosts.conf&lt;/em&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;em&gt;Pt 4 &amp;amp; 5 were solved in Laragon.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;Furthermore, there is another crucial element that significantly impacts success, and that is the unwavering support provided by the team. I am grateful to report that I have been fortunate to receive exceptional support from my senior leadership team. &lt;/p&gt;

&lt;p&gt;For those just starting in a new environment, beyond adapting to the latest technology, a key source of motivation lies in the practice of code review. Code review not only cultivates a collaborative atmosphere and enhances learning, but it also fuels motivation by fostering a strong sense of responsibility and a commitment to producing top-notch, well-structured code. This process encourages a culture of ongoing improvement and excellence within the team.&lt;/p&gt;

&lt;p&gt;I can quote a passage from '&lt;a href="https://www.engguidebook.com/"&gt;The Software Engineer’s Guidebook&lt;/a&gt;' by &lt;a href="https://twitter.com/gergelyorosz"&gt;Gergely Orosz&lt;/a&gt; that discusses the importance of code reviews for new team members&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PxonZAMm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1hrwyvs75loedcl7tsky.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PxonZAMm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1hrwyvs75loedcl7tsky.png" alt="New Joiners and Code reviews" width="472" height="472"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;As I continue my journey as a PHP developer, I look back at my first three months with gratitude for the opportunities that come with change. Along with Python, PHP has been a transformative experience, pushing me to embrace new challenges and expand my horizons in the world of programming. I eagerly anticipate the adventures and growth that the future holds in this new role.&lt;/p&gt;




&lt;p&gt;Links which I used and found useful.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;[text] PHP Blogs: &lt;a href="https://dev.to/t/php"&gt;https://dev.to/t/php&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;[text] Easy to read Best Practices: &lt;a href="https://phptherightway.com/"&gt;https://phptherightway.com/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;[text] W3 Schools tutorial: &lt;a href="https://www.w3schools.com/php/"&gt;https://www.w3schools.com/php/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;[video] Tutorial by freeCodeCamp [English]: &lt;a href="https://youtu.be/OK_JCtrrv-c"&gt;https://youtu.be/OK_JCtrrv-c&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;[video] Tutorial by WsCubeTech [Hindi]: &lt;a href="https://youtu.be/xIApzP4mWyA"&gt;https://youtu.be/xIApzP4mWyA&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Me now onwards:&lt;/em&gt; :D&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HTv-VRUm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ymuxbax6scyisz05n1m9.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HTv-VRUm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ymuxbax6scyisz05n1m9.jpeg" alt="meme_to_use_php" width="500" height="632"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Feel Free to connect with me on Twitter/X -&amp;gt; &lt;a href="https://twitter.com/jethwa_smit"&gt;@jethwa_smit&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Images are from respective owners. Framed with the help of ChatGPT&lt;/em&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>☁ Cloud Firestore with Actions on Google - Part 2/2</title>
      <dc:creator>Smit Jethwa</dc:creator>
      <pubDate>Thu, 26 Mar 2020 22:26:23 +0000</pubDate>
      <link>https://dev.to/smitjethwa/cloud-firestore-with-actions-on-google-part-2-2-52am</link>
      <guid>https://dev.to/smitjethwa/cloud-firestore-with-actions-on-google-part-2-2-52am</guid>
      <description>&lt;p&gt;Hello AoG Devs!!&lt;/p&gt;

&lt;p&gt;In this little tutorial, I’ll show you how to read information from a Cloud Firestore and use it to dynamically generate responses for DialogFlow fulfilment.&lt;/p&gt;

&lt;p&gt;I'll recommend you read Part 1 of this post. &lt;a href="https://dev.to/smitjethwa/cloud-firestore-with-actions-on-google-part-1-2-406m"&gt;Click here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Prerequisite:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Database with the collection and some documents.&lt;/li&gt;
&lt;li&gt;Basic knowledge of Javascript&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I'll take the example of "DevFest Mumbai Action" which I've built with the help of Team GDG MAD.&lt;/p&gt;

&lt;p&gt;So without wasting the time, Let's get started with the steps!&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 1:
&lt;/h4&gt;

&lt;h5&gt;
  
  
  Create an intent inside the Dialogflow, we'll use this intent to call the function.
&lt;/h5&gt;

&lt;p&gt;I've created the &lt;em&gt;speakerInformation&lt;/em&gt; intent: This intent will read the data for a particular speaker from the database.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--T87S4GVX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://firebasestorage.googleapis.com/v0/b/megahack-146b8.appspot.com/o/firestore-part-2%252F1.PNG%3Falt%3Dmedia%26token%3Dac8e44f5-2628-4d8e-a619-1ed9e49f4442" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--T87S4GVX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://firebasestorage.googleapis.com/v0/b/megahack-146b8.appspot.com/o/firestore-part-2%252F1.PNG%3Falt%3Dmedia%26token%3Dac8e44f5-2628-4d8e-a619-1ed9e49f4442" alt="Intent" title="Intent" width="800" height="573"&gt;&lt;/a&gt;&lt;br&gt;
Here, the speaker name will be stored in the &lt;em&gt;person&lt;/em&gt; parameter. &lt;br&gt;
Don't forget to &lt;em&gt;Enable the webhook for this intent&lt;/em&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 2:
&lt;/h4&gt;

&lt;h5&gt;
  
  
  Firestore with the collection and a few documents.
&lt;/h5&gt;

&lt;p&gt;The following image shows the collection &lt;em&gt;of speakers&lt;/em&gt; and documents for each speaker.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--K8pVlYtl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://firebasestorage.googleapis.com/v0/b/megahack-146b8.appspot.com/o/firestore-part-2%252F2.PNG%3Falt%3Dmedia%26token%3Db148a5ff-9da0-4fe2-b2ef-2253e669f6b8" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--K8pVlYtl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://firebasestorage.googleapis.com/v0/b/megahack-146b8.appspot.com/o/firestore-part-2%252F2.PNG%3Falt%3Dmedia%26token%3Db148a5ff-9da0-4fe2-b2ef-2253e669f6b8" alt="Firestore data" title="Firestore data" width="800" height="388"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 3:
&lt;/h4&gt;

&lt;h5&gt;
  
  
  Let's code!
&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;I've used &lt;a href="https://developers.google.com/assistant/actions/actions-sdk"&gt;&lt;em&gt;ActionsSDK&lt;/em&gt;&lt;/a&gt; in this action. So We'll import the necessary packages first.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="nx"&gt;dialogflow&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="nx"&gt;Image&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="nx"&gt;BasicCard&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="nx"&gt;Button&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="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;actions-on-google&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;functions&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;firebase-functions&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;firestore&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;firebase-admin&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;domain&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://mumbai-devfest19.firebaseapp.com&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;dialogflow&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;debug&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Create a function to handle &lt;em&gt;speakerInformation&lt;/em&gt; intent.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;intent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;speakerInformation&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;conv&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;param&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;option&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="p"&gt;.&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Create a variable to store the parameter (User Input)
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;option_intent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;conv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;contexts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;actions_intent_option&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;option_text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;option_intent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;parameters&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;speakerRef&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;firestore&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nx"&gt;collection&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;speakers&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;where&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;name&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;==&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;option_text&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="kd"&gt;get&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Loop to visit every document. &lt;em&gt;doc&lt;/em&gt; variable will store the document.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;speakerRef&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;doc&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="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;doc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="c1"&gt;// Document data stored in _data_ variable&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="nx"&gt;conv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ask&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`Meet the Speaker`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Card added to display the data
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="nx"&gt;conv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ask&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;BasicCard&lt;/span&gt;&lt;span class="p"&gt;({&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="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="na"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;bio&lt;/span&gt;&lt;span class="p"&gt;,&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="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="na"&gt;subtitle&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;,&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="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&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="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;Image&lt;/span&gt;&lt;span class="p"&gt;({&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="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="na"&gt;url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;photoUrl&lt;/span&gt;&lt;span class="p"&gt;,&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="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="na"&gt;alt&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="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; photo`&lt;/span&gt;&lt;span class="p"&gt;,&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="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="p"&gt;}),&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="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="na"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;CROPPED&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&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="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="na"&gt;buttons&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;Button&lt;/span&gt;&lt;span class="p"&gt;({&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="err"&gt; &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="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Visit Profile&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&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="err"&gt; &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="na"&gt;url&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="nx"&gt;domain&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/speakers/&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&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="err"&gt; &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="err"&gt; &lt;/span&gt; &lt;span class="p"&gt;}),&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="p"&gt;}));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt; exports the app
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;exports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;fulfilment&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;functions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;https&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;onRequest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Complete code: &lt;a href="https://github.com/gdgmad/hoverboard/blob/google-assistant/functions/src/assistant.js#L116-L148"&gt;Github&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Output:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CGLcK10u--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://firebasestorage.googleapis.com/v0/b/megahack-146b8.appspot.com/o/firestore-part-2%252FspeakerInfo.jpg%3Falt%3Dmedia%26token%3De1086b56-b5da-4974-8dd8-f2cd3faf6c9b" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CGLcK10u--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://firebasestorage.googleapis.com/v0/b/megahack-146b8.appspot.com/o/firestore-part-2%252FspeakerInfo.jpg%3Falt%3Dmedia%26token%3De1086b56-b5da-4974-8dd8-f2cd3faf6c9b" alt="Output" width="415" height="900"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Want to explore &lt;a href="https://assistant.google.com/services/a/uid/000000b735d74491?source=web"&gt;&lt;em&gt;Devfest Mumbai&lt;/em&gt;&lt;/a&gt; action? Just say "&lt;em&gt;Hey Google, Talk to Devfest Mumbai&lt;/em&gt;"
&lt;/h4&gt;

&lt;p&gt;This is it! You can now create dynamic responses in the Dialogflow fulfilment.&lt;br&gt;
Learn More: &lt;a href="https://firebase.google.com/docs/firestore/quickstart"&gt;Docs&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Share your experience, and doubts in the comments or connect with me on &lt;a href="https://twitter.com/jethwa_smit"&gt;Twitter&lt;/a&gt; &lt;/p&gt;

</description>
      <category>firestore</category>
      <category>dialogflow</category>
      <category>googleassistant</category>
      <category>actionongoogle</category>
    </item>
    <item>
      <title>☁ Cloud Firestore with Actions on Google - Part 1/2</title>
      <dc:creator>Smit Jethwa</dc:creator>
      <pubDate>Fri, 20 Mar 2020 06:29:41 +0000</pubDate>
      <link>https://dev.to/smitjethwa/cloud-firestore-with-actions-on-google-part-1-2-406m</link>
      <guid>https://dev.to/smitjethwa/cloud-firestore-with-actions-on-google-part-1-2-406m</guid>
      <description>&lt;p&gt;Hello AoG Devs!!&lt;/p&gt;

&lt;p&gt;This is part one of Cloud Firestore with Actions on Google Series, in this part I will show you how to store data in Cloud Firestore. &lt;/p&gt;

&lt;p&gt;Prerequisite:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Knowledge of Dialogflow (&lt;a href="https://dev.to/smitjethwa/dialogflow-terminologies-3i46"&gt;Check terminologies post&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Javascript&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I'll recommend you to go through Cloud Firestore terminologies first(&lt;a href="https://firebase.google.com/docs/firestore"&gt;Check docs&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cloud Firestore&lt;/strong&gt; is a NoSQL, document-oriented database. Unlike a SQL database, there are no tables or rows. Instead, you store data in documents, which are organized into collections.&lt;br&gt;
E.g. &lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tfFC2h3y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://firebasestorage.googleapis.com/v0/b/megahack-146b8.appspot.com/o/firestore-part-1%252FCapture.PNG%3Falt%3Dmedia%26token%3D78530556-742b-4439-9bc7-8c2e519e1203" alt="Snapshot of Firestore" title="Snapshot of Firestore" width="800" height="414"&gt;
&lt;/h1&gt;

&lt;p&gt;In short, &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Field - A data (e.g. 'capital':'New Delhi')&lt;/li&gt;
&lt;li&gt;Document - Set of Fields. 
(e.g. India:{'capital':'New Delhi','currency':'Rupee'})&lt;/li&gt;
&lt;li&gt;Collection - Set of Similar kinds of Documents (e.g. Country includes India, USA, Sri Lanka etc.)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I hope, you are now familiar with the terms, so let's get started with the implementation!&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Create the intent which will take the User's name and User's Email Address.
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gN-SdSDH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://firebasestorage.googleapis.com/v0/b/megahack-146b8.appspot.com/o/firestore-part-1%252F2.PNG%3Falt%3Dmedia%26token%3D5d2d45f1-d70d-4125-af60-ed1adbfe528b" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gN-SdSDH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://firebasestorage.googleapis.com/v0/b/megahack-146b8.appspot.com/o/firestore-part-1%252F2.PNG%3Falt%3Dmedia%26token%3D5d2d45f1-d70d-4125-af60-ed1adbfe528b" alt="SetDetails Intent" title="SetDetails Intent" width="800" height="698"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Set Parameter name and tick &lt;em&gt;required&lt;/em&gt; field for both the parameters i.e. &lt;em&gt;&lt;strong&gt;name&lt;/strong&gt;&lt;/em&gt; and &lt;em&gt;&lt;strong&gt;email&lt;/strong&gt;&lt;/em&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LnlPWIM5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://firebasestorage.googleapis.com/v0/b/megahack-146b8.appspot.com/o/firestore-part-1%252F3.PNG%3Falt%3Dmedia%26token%3Dada73975-5174-4852-84d6-987ee3b0eff4" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LnlPWIM5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://firebasestorage.googleapis.com/v0/b/megahack-146b8.appspot.com/o/firestore-part-1%252F3.PNG%3Falt%3Dmedia%26token%3Dada73975-5174-4852-84d6-987ee3b0eff4" alt="Step: 2" title="Step 2" width="800" height="337"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Switch to &lt;em&gt;&lt;a href="https://console.firebase.google.com/u/0/"&gt;Firebase Console&lt;/a&gt;&lt;/em&gt; and click on &lt;em&gt;Database&lt;/em&gt;, select &lt;em&gt;Cloud Firestore.&lt;/em&gt;
&lt;/h4&gt;

&lt;p&gt;3.1 Give Collection name as &lt;em&gt;userDetails&lt;/em&gt;&lt;br&gt;
3.2 Create one Document.&lt;br&gt;
It should look like the below image.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--drB-SRVv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://firebasestorage.googleapis.com/v0/b/megahack-146b8.appspot.com/o/firestore-part-1%252F4.PNG%3Falt%3Dmedia%26token%3D8a6e054b-c9e2-42b4-a504-2cabfd46eeed" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--drB-SRVv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://firebasestorage.googleapis.com/v0/b/megahack-146b8.appspot.com/o/firestore-part-1%252F4.PNG%3Falt%3Dmedia%26token%3D8a6e054b-c9e2-42b4-a504-2cabfd46eeed" alt="userDetails" title="Snapshot of userDetails Collection" width="800" height="413"&gt;&lt;/a&gt;&lt;br&gt;
Final Document with one collection and field.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PU_9zGsp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://firebasestorage.googleapis.com/v0/b/megahack-146b8.appspot.com/o/firestore-part-1%252F5.PNG%3Falt%3Dmedia%26token%3Da25ea641-ae9c-4467-a84b-cb9f025fef4d" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PU_9zGsp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://firebasestorage.googleapis.com/v0/b/megahack-146b8.appspot.com/o/firestore-part-1%252F5.PNG%3Falt%3Dmedia%26token%3Da25ea641-ae9c-4467-a84b-cb9f025fef4d" alt="userDetails" title="Snapshot of userDetails Collection" width="800" height="406"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Let's code! (&lt;em&gt;Javascript&lt;/em&gt;)
&lt;/h4&gt;

&lt;p&gt;Click on &lt;em&gt;Fulfillment&lt;/em&gt;, Enable &lt;em&gt;Inline Editor&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;import required modules.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;functions&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;firebase-functions&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;WebhookClient&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;dialogflow-fulfillment&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;admin&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;firebase-admin&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Initialize Firestore
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;admin&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;initializeApp&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;admin&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;firestore&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;enables lib debugging statements
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;DEBUG&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;dialogflow:debug&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Set the DialogflowApp object to handle the HTTPS POST request
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;exports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;dialogflowFirebaseFulfillment&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;functions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;https&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;onRequest&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;request&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;response&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="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;agent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;WebhookClient&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;request&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Create a function to store data. 
&lt;em&gt;agent.parameters.name&lt;/em&gt; and &lt;em&gt;agent.parameters.email&lt;/em&gt; returns the name and email address of the user respectively.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;getNameHandler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;agent&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;agent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;parameters&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;email&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;agent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;parameters&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;email&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;collection&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;userDetails&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;add&lt;/span&gt;&lt;span class="p"&gt;({&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="c1"&gt;// this method will insert the data in firestore&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="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&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="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="na"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;email&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Map the intent name and functions
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="err"&gt; &lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;intentMap&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Map&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="nx"&gt;intentMap&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;setDetails&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;getNameHandler&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="nx"&gt;agent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handleRequest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;intentMap&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Complete Code:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;use strict&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;functions&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;firebase-functions&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;WebhookClient&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;dialogflow-fulfillment&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;admin&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;firebase-admin&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;admin&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;initializeApp&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;admin&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;firestore&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;DEBUG&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;dialogflow:debug&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// enables lib debugging statements&lt;/span&gt;

&lt;span class="nx"&gt;exports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;dialogflowFirebaseFulfillment&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;functions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;https&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;onRequest&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;request&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;response&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="err"&gt; &lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;agent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;WebhookClient&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;request&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;getNameHandler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;agent&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;agent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;parameters&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;email&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;agent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;parameters&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;email&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;collection&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;userDetails&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;add&lt;/span&gt;&lt;span class="p"&gt;({&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="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&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="na"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;email&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="nx"&gt;agent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Data added successfully!!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;intentMap&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Map&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="nx"&gt;intentMap&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;setDetails&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;getNameHandler&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="nx"&gt;agent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handleRequest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;intentMap&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;Deploy the function&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 5
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Open Simulator
&lt;/h4&gt;

&lt;p&gt;Enter the Test Name and Email Address.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--daWTWbFF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://firebasestorage.googleapis.com/v0/b/megahack-146b8.appspot.com/o/firestore-part-1%252F6.PNG%3Falt%3Dmedia%26token%3Ddcf5b3dd-51a4-4852-a648-1da21b478c02" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--daWTWbFF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://firebasestorage.googleapis.com/v0/b/megahack-146b8.appspot.com/o/firestore-part-1%252F6.PNG%3Falt%3Dmedia%26token%3Ddcf5b3dd-51a4-4852-a648-1da21b478c02" alt="Test Image" title="Input sample image" width="570" height="862"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After the message &lt;em&gt;Data added successfully!!&lt;/em&gt; Check Firestore. There will be one entry of the given input.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hP3e9_Zd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://firebasestorage.googleapis.com/v0/b/megahack-146b8.appspot.com/o/firestore-part-1%252F7.PNG%3Falt%3Dmedia%26token%3Db0df743a-5820-44e6-bc01-d371b718673a" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hP3e9_Zd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://firebasestorage.googleapis.com/v0/b/megahack-146b8.appspot.com/o/firestore-part-1%252F7.PNG%3Falt%3Dmedia%26token%3Db0df743a-5820-44e6-bc01-d371b718673a" alt="Test Image" title="Input sample image" width="800" height="414"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I hope, this post will help to understand firestore with Actions on Google. This is part of a series of posts. In the next post, I'll explain how to read the data from Cloud Firestore. Till then Happy Coding!! &lt;/p&gt;

&lt;p&gt;Read Part 2 &lt;a href="https://dev.to/smitjethwa/cloud-firestore-with-actions-on-google-part-2-2-52am"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Share your experience, and doubts in the comments or let's get connected with me on &lt;a href="https://twitter.com/jethwa_smit"&gt;Twitter&lt;/a&gt;. &lt;/p&gt;

</description>
      <category>actionsongoogle</category>
      <category>dialogflow</category>
      <category>firestore</category>
      <category>database</category>
    </item>
    <item>
      <title>Manage Inputs in Dialogflow</title>
      <dc:creator>Smit Jethwa</dc:creator>
      <pubDate>Sat, 14 Mar 2020 21:11:38 +0000</pubDate>
      <link>https://dev.to/smitjethwa/manage-inputs-in-dialogflow-433j</link>
      <guid>https://dev.to/smitjethwa/manage-inputs-in-dialogflow-433j</guid>
      <description>&lt;p&gt;Hello AoG Devs!&lt;/p&gt;

&lt;p&gt;In this post, I'll explain to you how to take inputs from the user in Dialogflow and perform an action. &lt;br&gt;
In the Dialogflow, Developer can specify the variables in the training phrase. If the variables are number, name of a famous place, date, location, time, temperature, etc. A system entity will be assigned to them.&lt;br&gt;
 &lt;br&gt;
For Example:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_uEea08i--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://firebasestorage.googleapis.com/v0/b/megahack-146b8.appspot.com/o/input%2520blog%252F1.PNG%3Falt%3Dmedia%26token%3Dd5637883-e4e3-43ee-b253-f1ef854fd5cf" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_uEea08i--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://firebasestorage.googleapis.com/v0/b/megahack-146b8.appspot.com/o/input%2520blog%252F1.PNG%3Falt%3Dmedia%26token%3Dd5637883-e4e3-43ee-b253-f1ef854fd5cf" alt="Image1" width="800" height="559"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the above snapshot,&lt;br&gt;
&lt;strong&gt;&lt;em&gt;noon&lt;/em&gt;&lt;/strong&gt; is automatically identified as sys. date-time and if the user enters a time. Likewise, &lt;strong&gt;&lt;em&gt;Mumbai&lt;/em&gt;&lt;/strong&gt; is a city and &lt;strong&gt;&lt;em&gt;12%&lt;/em&gt;&lt;/strong&gt; is recognized as a percentage etc.&lt;/p&gt;

&lt;p&gt;To explain the inputs in Dialogflow, I've created a simple calculator. In which we'll see how the developer can handle the user input.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step1:&lt;/strong&gt;&lt;br&gt;
Define Entity of Operator. For operands, the number entity is already defined (system entity).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ewtp0Zqe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://firebasestorage.googleapis.com/v0/b/megahack-146b8.appspot.com/o/input%2520blog%252F2.PNG%3Falt%3Dmedia%26token%3Dfeb82978-de0b-41e0-92e9-e615b7b2880b" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ewtp0Zqe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://firebasestorage.googleapis.com/v0/b/megahack-146b8.appspot.com/o/input%2520blog%252F2.PNG%3Falt%3Dmedia%26token%3Dfeb82978-de0b-41e0-92e9-e615b7b2880b" alt="Image2" width="800" height="287"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step2:&lt;/strong&gt;&lt;br&gt;
Define a variable in the training phrases.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--g8U2Adq0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://firebasestorage.googleapis.com/v0/b/megahack-146b8.appspot.com/o/input%2520blog%252F3.PNG%3Falt%3Dmedia%26token%3D461faedd-49d3-4ab0-a5ed-2b1813f74e53" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--g8U2Adq0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://firebasestorage.googleapis.com/v0/b/megahack-146b8.appspot.com/o/input%2520blog%252F3.PNG%3Falt%3Dmedia%26token%3D461faedd-49d3-4ab0-a5ed-2b1813f74e53" alt="Image3" width="800" height="551"&gt;&lt;/a&gt;&lt;br&gt;
An agent will automatically identify and assign the names to the value.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3:&lt;/strong&gt;&lt;br&gt;
In the Actions and Parameter section, &lt;br&gt;
Tick the checkbox of the REQUIRED option as all the parameters are required to operate.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qdQsNciP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://firebasestorage.googleapis.com/v0/b/megahack-146b8.appspot.com/o/input%2520blog%252F4.PNG%3Falt%3Dmedia%26token%3D78e04928-cf1d-443a-bb04-99fe78d6ffd4" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qdQsNciP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://firebasestorage.googleapis.com/v0/b/megahack-146b8.appspot.com/o/input%2520blog%252F4.PNG%3Falt%3Dmedia%26token%3D78e04928-cf1d-443a-bb04-99fe78d6ffd4" alt="Image4" width="800" height="312"&gt;&lt;/a&gt;&lt;br&gt;
PS: Developer can add a PROMPT message. It'll prompt the user if the parameter is missing in the input.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4:&lt;/strong&gt;&lt;br&gt;
Now, the result will vary according to user input. So using a static response will not work here. So we'll be using Webhook. Enable the Webhook from the Fulfillment section.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jP6Zhe0n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://firebasestorage.googleapis.com/v0/b/megahack-146b8.appspot.com/o/input%2520blog%252F5.PNG%3Falt%3Dmedia%26token%3D013529fd-0f94-4dc1-b61d-1e2b10fb0939" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jP6Zhe0n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://firebasestorage.googleapis.com/v0/b/megahack-146b8.appspot.com/o/input%2520blog%252F5.PNG%3Falt%3Dmedia%26token%3D013529fd-0f94-4dc1-b61d-1e2b10fb0939" alt="Image5" width="800" height="129"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 5:&lt;/strong&gt; &lt;br&gt;
In the Fulfillment tab, Enable the Inline Editor(Powered by Cloud Functions for Firebase).&lt;/p&gt;

&lt;p&gt;Code:&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;use strict;

// Import the Dialogflow module from the Actions on Google client library.
const {dialogflow} = require(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="nx"&gt;actions&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;on&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;google&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;);

// Import the firebase-functions package for deployment.
const functions = require(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="nx"&gt;firebase&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;functions&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;);

// Instantiate the Dialogflow client.
const app = dialogflow({debug: true});

// Handle the Dialogflow intent named &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="nx"&gt;favourite&lt;/span&gt; &lt;span class="nx"&gt;colour&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.
// The intent collects a parameter named &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="nx"&gt;colour&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.
app.intent(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="nx"&gt;Calculator&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;, (conv, {number1, number2, operator}) =&amp;gt; {
var answer = 0;
  if (operator==&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;){
    answer = number1 + number2;
  }
  else if (operator==&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;){
   answer = number1-number2;
  }
  else if (operator == &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;){
   answer = number1/number2;
  }    
  else if (operator == &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;){
   answer = number1*number2;
  }
  else{
   conv.close("GOT the error!!");
  }
    // Respond with the result and end the conversation.
    conv.close(number1 +" "+ operator +" "+ number2 + &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="nx"&gt;is&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt; + answer);
});

// Set the DialogflowApp object to handle the HTTPS POST request.
exports.dialogflowFirebaseFulfillment = functions.https.onRequest(app);
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This function will return the Result and end the conversation.&lt;/p&gt;

&lt;p&gt;Output:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--750Wcnth--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://firebasestorage.googleapis.com/v0/b/megahack-146b8.appspot.com/o/input%2520blog%252F6.PNG%3Falt%3Dmedia%26token%3Da3cd0e4c-2bb8-4b9f-91aa-6cb34df8da93" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--750Wcnth--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://firebasestorage.googleapis.com/v0/b/megahack-146b8.appspot.com/o/input%2520blog%252F6.PNG%3Falt%3Dmedia%26token%3Da3cd0e4c-2bb8-4b9f-91aa-6cb34df8da93" alt="Image6" width="575" height="832"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I hope, you understand how we take input from the user and perform the operation on the same. Thank you for reading! For any doubts, feel free to connect with me on Twitter- &lt;a href="https://twitter.com/jethwa_smit"&gt;smitjethwa&lt;/a&gt;&lt;/p&gt;

</description>
      <category>dialogflow</category>
      <category>actionsongoogle</category>
      <category>chatbot</category>
      <category>webhook</category>
    </item>
    <item>
      <title>Dialogflow Terminologies.</title>
      <dc:creator>Smit Jethwa</dc:creator>
      <pubDate>Tue, 10 Mar 2020 20:11:16 +0000</pubDate>
      <link>https://dev.to/smitjethwa/dialogflow-terminologies-3i46</link>
      <guid>https://dev.to/smitjethwa/dialogflow-terminologies-3i46</guid>
      <description>&lt;p&gt;Hello,&lt;/p&gt;

&lt;p&gt;In this blog, I'll explain to you the terminologies used in Dialogflow. &lt;/p&gt;

&lt;p&gt;Dialogflow is the Platform where one could build Natural Language-Based apps for multiple platforms like Google Assistant, Slack, Alexa,  Messenger, Skype, Telegram and many more.&lt;/p&gt;

&lt;p&gt;It mainly requests the designer/developer to create the intents/entities to capture the main keywords from the user’s queries.&lt;/p&gt;

&lt;p&gt;For example:-&lt;br&gt;
User:- Okay Google, What is the temperature in &lt;em&gt;Mumbai&lt;/em&gt;?&lt;br&gt;
Dialogflow:- Intent:- Mumbai(Entities:- City).&lt;/p&gt;

&lt;p&gt;User:- Hey Google, Order a &lt;em&gt;Margherita Pizza&lt;/em&gt; for me.&lt;br&gt;
Dialogflow:- Intent:- Pizza(Entities:- Food, Margherita (Flavour)).&lt;/p&gt;

&lt;p&gt;User:- &lt;/p&gt;

&lt;p&gt;Now, with the above values, it would depend on the designer to send the answer to the user in the form of the temperature API and related stuff.&lt;/p&gt;

&lt;p&gt;The main thing is Dialogflow internally designed the Machine Learning training and it has been owned by Google. So, the accuracy of the answer is also at a remarkable level.&lt;/p&gt;

&lt;p&gt;Here are a few terms used in Dialogflow.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;1.&lt;/strong&gt; &lt;strong&gt;Agent&lt;/strong&gt;:
&lt;/h4&gt;

&lt;p&gt;An agent handles conversations with the end users. It is a natural language understanding module that understands the nuances of human language. You design and build a Dialogflow agent to handle the types of conversations required for your system. One agent handles one Action. It consists of Intents, Entities, Fulfillment and Integration with other platforms.  &lt;a href="https://cloud.google.com/dialogflow/docs/agents-overview"&gt;Read more about Agent&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  Prebuilt Agent:
&lt;/h5&gt;

&lt;p&gt;These are the already trained agents. A developer needs to import the agent. Prebuilt agent general-purpose agents and used in most of the actions just like the libraries. For example, Agent for Navigation, News, Time, Translate, Weather etc.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;2.&lt;/strong&gt; &lt;strong&gt;Intent&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;If we go by the dictionary meaning, it is the intention or purpose. In our case, it is the intention of the user. The bot needs to understand the intention of the user and needs to know what the user wants from this chat.&lt;br&gt;
In the case of any chat platform, the intent is the intention of a user. The AI designer trains the bot to understand various user intentions based on a sample training data set. Then, when a user talks to the bot, the AI does Natural Language Processing (NLP) and tries to identify the user’s intention based on the training it has received. &lt;br&gt;
For Example, If a user wants to order a PIZZA. So intent name can be &lt;em&gt;PIZZA-ORDER&lt;/em&gt; &lt;a href="https://cloud.google.com/dialogflow/docs/intents-overview"&gt;Read more about Agent&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  2.1 Training Phrases:
&lt;/h5&gt;

&lt;p&gt;Training Phrases are used to train the intent. Every intent identification is backed by a confidence score, which means, the AI has guessed the user’s intent with X% confidence. As an AI designer, it is our task to identify a base-level confidence score called Threshold Confidence. Supposing the Threshold Confidence is 80%, then all NLP guesses made by our AI having Confidence above 80% will be automatically treated as correct and based on this a response will be generated for the user.&lt;br&gt;
For the given example, the training phrases can be, &lt;br&gt;
&lt;em&gt;Hey Google, Order a Pizza for me&lt;/em&gt;&lt;br&gt;
&lt;em&gt;Hey Google, I want to order a pizza&lt;/em&gt;&lt;br&gt;
&lt;em&gt;I'd like to have a Pizza&lt;/em&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  2.2 Context
&lt;/h5&gt;

&lt;p&gt;Contexts are a tool that allows Dialogflow developers to build complex, branching conversations that feel natural and real.&lt;br&gt;
Here’s an example of a context. &lt;a href="https://cloud.google.com/dialogflow/docs/contexts-overview"&gt;Read more about context&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;User: “&lt;em&gt;Will it rain in Mumbai today?&lt;/em&gt;”&lt;br&gt;
Agent: “&lt;em&gt;No, the forecast is for sunshine.&lt;/em&gt;”&lt;br&gt;
User: “&lt;em&gt;How about Delhi?&lt;/em&gt;”&lt;br&gt;
Agent: “&lt;em&gt;Delhi is expecting rain, so bring an umbrella!&lt;/em&gt;”&lt;/p&gt;

&lt;p&gt;While the follow-up, “How about Delhi?”, doesn’t make sense as a standalone question, the agent knows the contextual inquiry is still about rain.&lt;br&gt;
Dialogflow uses contexts to manage conversation state, flow and branching. You can use contexts to keep track of a conversation’s state, influence what intents are matched and direct the conversation based on a user’s previous responses. Contexts can also contain the values of entities and parameters, based on what the user has said previously.&lt;/p&gt;

&lt;h5&gt;
  
  
  2.3 Response
&lt;/h5&gt;

&lt;p&gt;The basic response type is a text response. Other types of responses are available (image, audio, synthesized speech, and so on), some of which are platform-specific. If you define more than one response variation for an intent, your agent will select a response at random. These may provide the end user with answers, ask the end user for more information, or terminate the conversation.&lt;br&gt;
Response types available in Google Assistant: Basic Card, Suggestions, Carousel Cards, List, Browse Carousel Cards, Media Content, Table etc.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;3&lt;/strong&gt;. &lt;strong&gt;Entity&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;In every message the user sends to our bot, there is some valuable information like Location, Time, Food to order etc… This valuable information is called Entities. e.g. the User Says: “I want to watch some comedy movie tonight.” So, in this case, the User intends to “Watch a movie” whereas valuable information viz. Entities are Content: Movie, Type: Comedy, Timing: Tonight. &lt;br&gt;
&lt;a href="https://cloud.google.com/dialogflow/docs/entities-overview"&gt;Read more about Entity&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  System
&lt;/h5&gt;

&lt;p&gt;System Entities are already defined Entities. A developer does not require to train to intent on such a response. For Example, &lt;em&gt;What is the Capital of India&lt;/em&gt;&lt;br&gt;
Here &lt;em&gt;INDIA&lt;/em&gt; is a part of the Country Entity. &lt;br&gt;
Few System Entity: Date, Time, Number, Country, Address, Date-time, Percentage, age, flight number, geo-capital, unit length, geo-city, unit currency, URL, language, colour, person, temperature, email etc.&lt;/p&gt;

&lt;h6&gt;
  
  
  Custom
&lt;/h6&gt;

&lt;p&gt;Custom Entities use defined entities. It is not possible to have an entity for every element so Developer can define its entity. For Example, the Entity &lt;em&gt;SPORT&lt;/em&gt; includes Cricket, Football, Volleyball, Hockey, Tennis etc.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;4.&lt;/strong&gt; &lt;strong&gt;Fulfillment&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Reply from the Response tab is custom. Fulfilment provides a dynamic Response. Fulfilment is code that's deployed as a webhook that lets your Dialogflow agent call business logic on an intent-by-intent basis. During a conversation, fulfilment allows you to use the information extracted by Dialogflow's natural-language processing to generate dynamic responses or trigger actions on the backend. Developers can use fulfilment in two methods. &lt;a href="https://cloud.google.com/dialogflow/docs/fulfillment-overview"&gt;Read more about Fulfillment&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  4.1 Webhook
&lt;/h5&gt;

&lt;p&gt;Webhook is used when code is too large and uses external APIs. &lt;/p&gt;

&lt;h5&gt;
  
  
  4.2 Inline Editor (Powered by Cloud Function)
&lt;/h5&gt;

&lt;p&gt;Inline Editor is used when the code is small and uses APIs Provided by Google Cloud Function.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;5.&lt;/strong&gt; &lt;strong&gt;Integration&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;A Developer can integrate the Actions with many platforms such as Telegram, Cortana, Skype, Web Integration, Bixby, Call etc. &lt;a href="https://cloud.google.com/dialogflow/docs/integrations"&gt;Read more about Integration&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://cloud.google.com/dialogflow/docs/"&gt;Read more about Dialogflow&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thank you for reading this blog, Hope you liked it. &lt;br&gt;
Open to suggestions!&lt;/p&gt;

</description>
      <category>dialogflow</category>
      <category>actionsongoogle</category>
      <category>chatbot</category>
      <category>nlp</category>
    </item>
    <item>
      <title>My First DevFest as a Speaker✨</title>
      <dc:creator>Smit Jethwa</dc:creator>
      <pubDate>Tue, 08 Oct 2019 15:56:45 +0000</pubDate>
      <link>https://dev.to/smitjethwa/my-first-devfest-as-a-speaker-4e2o</link>
      <guid>https://dev.to/smitjethwa/my-first-devfest-as-a-speaker-4e2o</guid>
      <description>&lt;p&gt;The first time you give a speech on a level as grand as Google is undoubtedly meant to be a special moment, a privilege, and the beginning of something special. I will surely never forget the once-in-a-lifetime opportunity. &lt;/p&gt;

&lt;p&gt;It was a fine Wednesday morning when I received the mail from Google Developer Group Hubli, that my talk on &lt;strong&gt;"Let's get started with Actions on Google"&lt;/strong&gt; is shortlisted for the DevFest Hubli 2019. I felt honoured. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_2bFn3Ci--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://firebasestorage.googleapis.com/v0/b/devfestmumbai.appspot.com/o/DevFest%2520Hubli%252FIMG_0052.jpg%3Falt%3Dmedia%26token%3Dcc85365b-6c40-4c4d-b1d2-8478640ab1bc" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_2bFn3Ci--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://firebasestorage.googleapis.com/v0/b/devfestmumbai.appspot.com/o/DevFest%2520Hubli%252FIMG_0052.jpg%3Falt%3Dmedia%26token%3Dcc85365b-6c40-4c4d-b1d2-8478640ab1bc" alt="Smit at DevFestHubli" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It soon dawned on me that I would be speaking for an audience of almost 100+ listeners. I felt a pang of nervousness but as the day of the event came closer, I felt a strong sense of determination forming in my mind. &lt;/p&gt;

&lt;p&gt;The two-day event was scheduled for the 28 and 29 of September 2019, of which my talk was to be happening on the 29th.&lt;br&gt;
It was a giant congregation of student developers from various institutions and technological backgrounds. I was intrigued and overwhelmed. &lt;/p&gt;

&lt;p&gt;I gave a talk on “Let's get started with Actions on Google" which most developers are not equipped with. I took the courtesy to elaborate on Intents, Entity, tools like Dialogflow, Firebase Realtime Database, Cloud Function, and response types such as card, and suggestion chip. I presented the display of &lt;em&gt;DevFest Mumbai&lt;/em&gt;, developed that I have worked on (Check out &lt;a href="https://assistant.google.com/services/a/uid/000000b735d74491?hl=en&amp;amp;source=web"&gt;Talk to DevFest Mumbai&lt;/a&gt; )&lt;br&gt;
 . Also, I shared insights on &lt;a href="https://www.qwiklabs.com/quests/61"&gt;Qwiklabs&lt;/a&gt; and &lt;a href="https://codelabs.developers.google.com/?cat=Assistant"&gt;Codelabs&lt;/a&gt; course of Actions on Google. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vwdwBo5V--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://firebasestorage.googleapis.com/v0/b/devfestmumbai.appspot.com/o/DevFest%2520Hubli%252FIMG_9936.jpg%3Falt%3Dmedia%26token%3Dec78c2a5-c7d3-419e-a42d-710d8d48378e" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vwdwBo5V--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://firebasestorage.googleapis.com/v0/b/devfestmumbai.appspot.com/o/DevFest%2520Hubli%252FIMG_9936.jpg%3Falt%3Dmedia%26token%3Dec78c2a5-c7d3-419e-a42d-710d8d48378e" alt="DevFest Hubli Image" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The most spectacular moment for me was the interaction with Mr Nikhil Raichur. (Community Manager @Google). &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Wsg5MNNL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://firebasestorage.googleapis.com/v0/b/devfestmumbai.appspot.com/o/DevFest%2520Hubli%252F_MG_0241.jpg%3Falt%3Dmedia%26token%3D51d632bd-0383-488b-8826-c33a04e77e42" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Wsg5MNNL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://firebasestorage.googleapis.com/v0/b/devfestmumbai.appspot.com/o/DevFest%2520Hubli%252F_MG_0241.jpg%3Falt%3Dmedia%26token%3D51d632bd-0383-488b-8826-c33a04e77e42" alt="Speaker group photo" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I had a memorable experience throughout my stay at BVB College of Engineering, Hubballi. Thanks to GDG Hubbali for giving me an opportunity and for the warm welcome and generous hospitality. &lt;br&gt;
I’d also like to thank GDG Mumbai &amp;amp; GDG Cloud Mumbai community for motivating me. You all are my constant support! &lt;/p&gt;

&lt;p&gt;I feel honoured and privileged to the core. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.slideshare.net/smitjethwa20/hey-hubballi-talk-on-actions-on-google-devfesthubali"&gt;Check out my slide&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devfest</category>
      <category>speaker</category>
      <category>actionsongoogle</category>
      <category>devfesthubli</category>
    </item>
  </channel>
</rss>
