Skip to content

Commit

Permalink
dependency and readme updates
Browse files Browse the repository at this point in the history
Change-Id: Ie7cb468f2a85ae24fd27706ec153d7fafd8bdb8a
  • Loading branch information
Sarah Dwyer committed Oct 1, 2018
1 parent 411a50a commit 56a11b5
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 20 deletions.
52 changes: 37 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,52 @@
# Dialogflow Firestore Sample
This sample demonstrates how to connect Dialogflow to the Firestore database. Dialogflow parses user's 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 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
Dialogflow → Webhook Request → Firebase Function → Firestore Database
```

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, retrive relevent data from your systems or enable your users to collaborate via chat/voice.

## Setup Instructions
## Setup

### Dialogflow and Fulfillment Setup
Click on the **Add to Dialogflow** button below and follow the prompts to create a new agent:

[![Firestore Sample](https://storage.googleapis.com/dialogflow-oneclick/deploy.svg "Firestore Sample")](https://console.dialogflow.com/api-client/oneclick?templateUrl=https://storage.googleapis.com/dialogflow-oneclick/dialogflow-agent-firestore.zip&agentName=FirestoreSample)
To create this agent from our template:

1. Click on the button above and click `Create agent`
1. After the creation is complete (this may take a few minutes) click `Open agent`
<a href="https://console.dialogflow.com/api-client/oneclick?templateUrl=https://oneclickgithub.appspot.com/dialogflow/fulfillment-firestore-nodejs" target="blank">
<img src="https://dialogflow.com/images/deploy.png">
</a>

### Firestore Setup
1. Click on the ["Fulfillment" tab](https://console.dialogflow.com/api-client/#/agent//fulfillment) in your Dialogflow agent
1. Click on `View execution logs in the Firebase console` at the bottom of the fulfillment page to open the Firebase console
1. Click `Database` in the left panel of the Firebase console and click `Create database`
1. Select `Start in locked mode` and click `Enable`
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](https://console.dialogflow.com), in the Dialogflow simulator on the right, query your Dialogflow agent with `Write Bobby Tables to the database` and then query `What's in the database?` to get the response "Bobby Tables". You can replace "Dialogflow rules" with any string in your query.
1. In [Dialogflow's console](https://console.dialogflow.com), 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](https://github.com/dialogflow/fulfillment-regex-nodejs) | Node.js |
| [Weather: Fulfillment & WWO API](https://github.com/dialogflow/fulfillment-weather-nodejs) | Node.js |
| [Bike Shop: Fulfillment & Google Calendar API](https://github.com/dialogflow/fulfillment-bike-shop-nodejs)| Node.js |
| [Temperature Trivia: Fulfillment & Actions on Google](https://github.com/dialogflow/fulfillment-temperature-converter-nodejs) | Node.js |
| [Fulfillment & Actions on Google](https://github.com/dialogflow/fulfillment-actions-library-nodejs) | Node.js |
| [Fulfillment & Firestore Database](https://github.com/dialogflow/fulfillment-firestore-nodejs) | Node.js |
| [Multi-language/locale](https://github.com/dialogflow/fulfillment-multi-locale-nodejs) | Node.js |
| [Basic Slot Filling](https://github.com/dialogflow/fulfillment-slot-filling-nodejs) | Node.js |

For Fulfillment Webhook [JSON Requests & Responses](https://github.com/dialogflow/fulfillment-webhook-json).

## References & Issues
+ Questions? Try [StackOverflow](https://stackoverflow.com/questions/tagged/dialogflow) or [Dialogflow Developer Community](https://plus.google.com/communities/103318168784860581977).
+ Find a bug? Report it on [GitHub](https://github.com/dialogflow/fulfillment-webhook-json/issues).
+ Dialogflow [Documentation](https://dialogflow.com/docs/getting-started/basics).
+ [Dialogflow's console](https://console.dialogflow.com).

## How to make contributions?
Please read and follow the steps in the CONTRIBUTING.md.
Expand Down
10 changes: 5 additions & 5 deletions functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
"license": "Apache Version 2.0",
"author": "Google Inc.",
"engines": {
"node": "~4.2"
"node": "6"
},
"scripts": {
"lint": "semistandard --fix \"**/*.js\"",
"start": "firebase deploy --only functions",
"deploy": "firebase deploy --only functions"
},
"dependencies": {
"firebase-admin": "^5.12.1",
"firebase-functions": "^1.0.3",
"dialogflow-fulfillment": "^0.4.1",
"actions-on-google": "^2.1.3"
"firebase-admin": "^6.0.0",
"firebase-functions": "^2.0.5",
"dialogflow-fulfillment": "0.5.0",
"actions-on-google": "2.3.0"
}
}

0 comments on commit 56a11b5

Please sign in to comment.