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
Dialogflow and Fulfillment Setup
To create this agent from our template:
- In Dialogflow's console, in the left menu > go to Fulfillment > Enable Inline Editor > Deploy.
- At the bottom, go to View execution logs in the Firebase console.
- In the Firebase console, go to Database > Create database.
- Select Start in locked mode > Enable.
Running the sample
- In Dialogflow's console, in the Dialogflow simulator on the right, query your Dialogflow agent with
Write Buzz Aldrin to the databaseand then query
What's in the database?to get the response "Buzz Aldrin".
|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|
|Basic Slot Filling||Node.js|
For Fulfillment Webhook JSON Requests & Responses.
References & Issues
- Questions? Try StackOverflow or Dialogflow Developer Community.
- Find a bug? Report it on GitHub.
- Dialogflow Documentation.
- Dialogflow's console.
How to make contributions?
Please read and follow the steps in the CONTRIBUTING.md.
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.