Google assistant bot that knows about holidays in Argentina based on api.ai and Google Cloud Functions
- Install Node.js
- Install Google Cloud SDK
- Install ngrok to test locally
- Create an api.ai account
- Have or create a Google Cloud Project with Cloud Functions API and billing enabled
$ git clone https://github.com/eisenjulian/holidays.git
$ cd holidays
$ # install dependencies
$ npm install
$ # install cloud functions emulator
$ npm install -g @google-cloud/functions-emulator
$ gloud init
$ gcloud components update && gcloud components install beta
$ gcloud config set project <project_id>
$ # create a bucket in Google Cloud Storage to store files: if you use a different name update package.json
$ gsutil mb gs://holiday-bot-bucket
$ # deploy your cloud function
$ # in the logs you will get the URL for your cloud function to use in the api.ai integrations page
$ npm run deploy
- Use the Actions on Google Console to add a new project with a name of your choosing.
- Click "Use API.AI" and then "Create Actions on API.AI" which will redirect you to api.ai.
- Click "Save" to save the project.
- Click on the gear icon to see the project settings.
- Select "Export and Import".
- Select "Restore from zip". Follow the directions to restore from the holidayPal.zip in this repo.
- In the Fulfillment page of the API.AI console, enable Webhook, set the URL to the hosting URL, then save.
- Open API.AI's Integrations page, open the Settings menu for Actions on Google, then click Test.
- Click View to open the Actions on Google simulator.
- Type "Talk to my test app" in the simulator, or say "OK Google, talk to my test app" to any Actions on Google enabled device signed into your developer account.
$ npm run deploy
$ functions start
$ npm run start
$ <ngrok_location>/ngrok http 8010
You will get a URL that looks like https://XXXXXX.ngrok.io/<you-project>/<your-zone>/holidayPal
that points to your local server and where changes are updated immediately. Go to your api.ai agent integrations page and update the webhook. Don't forget to change it back when you're done testing
- The data of holidays in Argentina comes from github.com/pjnovas/nolaborables
- The code and documentation for this app are based on the Google Actions samples