Google Assistant Collection St Albans
Google action that can be invoke from your Google device to display the next Recycling and Refuse collection for St Albans.
##Setup Google Actions
- Go to https://console.actions.google.com/
- Create a new project ( I used ga-collection-stalbans )
- Select Games & Fun ( at the moment is the only type that allows interactive canvas)
- Select type of Conversational
- Decide the invoke key
- Go to Deploy and enable Interactive Canvas
- Add a new action, press Get Started and select Play Game
DialogFlow
- Choose your agent's name ( I used ga-collection-stalbans )
- Go under Setting and Export & Import
- Restore the zip file actions.zip
Firebase
- Go to https://console.firebase.google.com/
- Select your project
- You have to change to Blaze plan due to external API call, but it wont charge you if you dont use too much, have a look at the pricing.
- Go under Setting and copy your project ID
- Run
firebase login
- Run
firebase use <project id>
Dependency
- Run
npm install
in the root folder 2) Run
npm install
in the function folder 3) Run
npm run build
to build the website 4) Run
firebase deploy
Update links
- Once you run firebase deploy, go back to firebase page ( https://console.firebase.google.com/ )
- In functions, copy the link
- Go back to https://dialogflow.cloud.google.com/
- In Fulfillment, enable webook and input the url link
- Copy the hosting url and update the variable URL in functions/index.js
- Save and run deploy again
Test it
- Open https://console.actions.google.com/ and go to test
Screenshots
Commands
Run server
npm start
Build website
npm run build
Deploy
firebase deploy
Intents
Clear
Clear the user storage
Collection
Invoke the main script to pull the new date from the API
Collection search
Search for the address and retrieve the UPRN code
Collection setup
Finalise the setup with the UPRN code
Fallback
Trigger whatever the action is not reconising the command
Welcome
Invoke the main script
ISSUES
You might get this error that is common due to npm not installing the developer package
HtmlResponse is not supported on this device..
To fix it, install
npm install actions-on-google@preview
Another fix is to make sure Interactive Canvas is enable in https://console.actions.google.com/
TODO
- Cache data and dont pull each time