This sample google assistant dialogflow is a facts-based action designed to report metrics out of firebase. The idea is that something external would update firebase, which would then be read through google assistant.
- Install NodeJS
- A Google Project is created
- the project should have enabled firebase, cloud functions Deployment Manager V2 API
- a service account should be created. For production, the role should be restricted but for now Owner will work.
- the credentials JSON should be placed in root of the project, as serverless will need it
- A firebase collection must be created for facts.
- The collection should contain a field of "metric" i. The field should be lowercase space separated words
- The collection should have a "total_count" and "response" attributes
- The following environment variables should be baked into your system
GOOGLE_APPLICATION_CREDENTIALS
- path to credentials filePROJECT_ID
- available in admin console
- Clone the repository
- Run
npm install
- Start building your action in the google actions console
- Click ‘Add Action’ and build a custom intent. This will open dialogflow.
- Create an intent called metrics. In the Action and parameters menu, set parameter name, entity, and value to
metrics, @metrics, $metrics
exclusively. Also enable all options under Fulfillment. - Update entities.yml with the entities and synonyms for your metric (Note: metric names correlate 1:1 back to firebase metrics)
- Run
npm run-script update-entities
to deploy your entities - run
sls deploy
ornpm run-script deploy
to index to google cloud. - In dialogflow, go to Fulfillment on the left side, enable web hook, and place the URL given by serverless as the fulfillment address. https://us-central1-<Project_ID>.cloudfunctions.net/index
- Go to integrations and add your intent to the implicit invocation. Then click
See how it works in Google Assistant.
to try your new skill out. If you notice your entities are not catching on, you may need to train the assistant back under intents.
Once you start adding entities, add them below.