title: How to connect Dialogflow to Cloud Firestore via the Inline Editor in Dialogflow?
body: <p>I have a Cloud Firestore database that stores the number of inhabitants of all cities in England in 2017.</p>
  
  <p>Then I have a Dialogflow. Whenever I tell the name of a city to Dialogflow, I want it to get the number of inhabitants in that city from Firestore and return it to Dialogflow.</p>
  
  <p>Specifically, I want to implement this via the Inline Editor.</p>
  
  <p><strong>Question</strong>: What lines of code do I need to add to the code below in order to make this happen?</p>
  
  <p>So here is the code that I write in the Inline Editor in Dialogflow > Fulfillment > index.js:</p>
  
  <pre><code>'use strict';
  
  const functions = require('firebase-functions');
  const firebaseAdmin = require('firebase-admin');
  const {WebhookClient} = require('dialogflow-fulfillment');
  const {Card, Suggestion} = require('dialogflow-fulfillment');
  
  const App = require('actions-on-google').DialogflowApp;
  
  process.env.DEBUG = 'dialogflow:debug'; // enables lib debugging statements
  
  exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) =&gt; {
    const agent = new WebhookClient({ request, response });
    console.log('Dialogflow Request headers: ' + JSON.stringify(request.headers));
    console.log('Dialogflow Request body: ' + JSON.stringify(request.body));
  
    function welcome(agent) {
      agent.add(`Hello and welcome!`);
    }
  
    function fallback(agent) {
      agent.add(`I didn't understand`);
      agent.add(`I'm sorry, can you try again?`);
  }
  
  
    let intentMap = new Map();
    intentMap.set('Default Welcome Intent', welcome);
    intentMap.set('Default Fallback Intent', fallback);
  
    agent.handleRequest(intentMap);
  });
  </code></pre>