/fulfillment-firestore-nodejs

Integrating Firebase's Firestore database with Dialogflow

Primary LanguageJavaScriptApache License 2.0Apache-2.0

Dialogflow Firestore Sample

  • This sample demonstrates how to connect Dialogflow to the Firestore database.
  • Dialogflow parses users' requests and sends requests to Firebase function indicating whether it should add or retrieve an entry from the Firestore database. The Firebase function queries the database to add or retrieve the entry and then compiles the proper response to the user. You can speak to your Dialogflow agent and tell it to write something to the database or retrieve it.
  • The sample will save what you tell it to save into the database as well as retrieve the value you store previously.
  • When you speak to your Dialogflow agent a webhook call is sent to Firebase functions which talks to the Firestore database to retrieve or add a entry as see below:

This sample is meant to be a starting point for anyone looking to connect a database to their Dialogflow agent and can be expanded to store users preferences, retrieve relevant data from your systems or enable your users to collaborate via chat/voice.

Dialogflow → Webhook Request → Firebase Function → Firestore Database

Setup

Dialogflow and Fulfillment Setup

To create this agent from our template:

Firestore Setup

  1. In Dialogflow's console, in the left menu > go to Fulfillment > Enable Inline Editor > Deploy.
  2. At the bottom, go to View execution logs in the Firebase console.
  3. In the Firebase console, go to Database > Create database.
  4. Select Start in locked mode > Enable.

Running the sample

  1. In Dialogflow's console, in the Dialogflow simulator on the right, query your Dialogflow agent with Write Buzz Aldrin to the database and then query What's in the database? to get the response "Buzz Aldrin".

Related Samples

Name Language
Fulfillment & Regex Validation Node.js
Weather: Fulfillment & WWO API Node.js
Bike Shop: Fulfillment & Google Calendar API Node.js
Temperature Trivia: Fulfillment & Actions on Google Node.js
Fulfillment & Actions on Google Node.js
Fulfillment & Firestore Database Node.js
Multi-language/locale Node.js
Basic Slot Filling Node.js

For Fulfillment Webhook JSON Requests & Responses.

References & Issues

How to make contributions?

Please read and follow the steps in the CONTRIBUTING.md.

License

See LICENSE.

Terms

Your use of this sample is subject to, and by using or downloading the sample files you agree to comply with, the Google APIs Terms of Service.