This tutorial shows you how to get started developing for Actions on Google using a Google Cloud Function with Bespoken.

Prerequisites

Getting Started

Clone the Super Simple Google Action repo:

$ git clone https://github.com/bespoken/super-simple-google-action

Go to the root level of the sample:

$ cd super-simple-google-action/

Install the dependencies:

$ npm install

Configure your API.AI Action

For a detailed walkthrough on setting up an Action on Google with API.AI, go here.

Start bst proxy

For Google Cloud Functions, the bst proxy command, in addition to setting up the proxy, will run your function for you and even reload it on changes.

This will start the function:

$ bst proxy function index.js simpleFunction

Try it out

You can test things out right inside API.AI - just enter "Hello" into the "Try it now" field on the top-right.

You should see the request and response come across the console where the bst proxy is running, like so:

Or you can try it in the Actions on Google Web Simulator.

Hooking into the Bespoken Dashboard

To use our monitoring and logging facility, sign up here.

Once you have signed in, create a new source by clicking on the "+" button at the bottom or link at the top:

Name your source and then hit "Create Source". On the following page, select "Next: Check For Logs".

On the right-hand side of the page, select "Show" over the Secret Key:

Cut and paste the secret key into the index.js file in Super Simple Google Action project:

The line is at the bottom of the file.

Now, the summary and log data for your action will be available in the Dashboard, both while using the proxy for development and once you go live!

Next Steps

You can now start adding functionality to your action. To learn more about working with Actions on Google, see the official documentation

You can also try it out on a Google Home or Google Assistant-enabled phone, as long as it is registered with your account. Just say "Talk To {Your Invocation Name}" to use it.