Final code

Fetching our data from the database we've just created in the previous step.

Explanation

Dummy responses are great but we want to fetch our data from a database since we can't add everyone at the entity values.

For each of the 'get_location', 'get_name' and 'get_skill' intents enable the fulfilment.

Enable fulfillment for each intent

Then we need to add the intent names at the intent map in our inline editor:

  1. Click Fulfilment

  2. In your Inline Editor(Powered by Cloud Functions for Firebase) make sure you have the code below:

then we need to initialize our database:

Finally, we need to create our 3 methods:

Final Code

This is how the final code can look like.

IMPORTANT: make sure you have your own Database URL, instead of: https://wtm-summit-f6708.firebaseio.com

And the package.json tab:

{ "name": "dialogflowFirebaseFulfillment", "description": "This is the default fulfillment for a Dialogflow agents using Cloud Functions for Firebase", "version": "0.0.1", "private": true, "license": "Apache Version 2.0", "author": "Google Inc.", "engines": { "node": "~6.0" }, "scripts": { "start": "firebase serve --only functions:dialogflowFirebaseFulfillment", "deploy": "firebase deploy --only functions:dialogflowFirebaseFulfillment" }, "dependencies": { "actions-on-google": "2.0.0-alpha.4", "firebase-admin": "^5.4.2", "firebase-functions": "^0.5.7", "dialogflow": "^0.1.0", "dialogflow-fulfillment": "0.3.0-beta.3" }}

Last updated