Use Google Sheets as CMS for your Voice App

by Jan König on Dec 20, 2018

Tutorial: Using Google Spreadsheets for your Alexa Skills and Google Actions

Learn how to use Google Spreadsheets as a content management system (CMS) for your Alexa Skills and Google Actions with the Jovo CMS integration.

You can find the full example code on GitHub.

Watch the video here:

Introduction

Why a CMS?

Right now, most people manage the content of their Alexa Skills and Google Actions in the code. This lets you start building out the functionality quickly without having to care about integrating external systems. Plus, Jovo offers an i18next integration that allows you to localize content right from a JSON file.

However, with growing teams working on voice apps for Alexa and Google Assistant, changes are becoming higher that content is managed from a variety of people that don't necessarily have access to the code. Also, for adding fresh new content, or even doing minor changes, redeploying the complete code base can seem like a tedious task.

With the Jovo CMS Integrations, we want to remove that hurdle and help people work on content more collaboratively.

Why Google Sheets?

We experienced ourselves that using Google Sheets as a CMS for our own Alexa Skills and Google Actions was the solution that required the least effort, while still being quite powerful and flexible.

Here are some reasons for using Google Sheets for content:

  • It's a familiar interface (spreadsheets, Excel)
  • Google Sheets has all the collaboration and permission features already built in
  • You can create several sheets (displayed as tabs) in one spreadsheet, allowing you to manage several content types (we offer different Sheet Types for this)

Let's get started with Google Sheets and Jovo.

Preparing the Google Spreadsheet

First, we need to prepare a Google Spreadsheet and add some content. We will just use a responses sheet that includes a key and a locale (in our case en for English).

Take a look at the sample spreadsheet we created:

Google Spreadsheet as CMS for Alexa and Google Assistant

You can find the Hello World Spreadsheet here.

To use it for yourself, click File > Make a copy... and save it to your own Google Drive.

You can then edit the content as much as you want. After editing, make sure that you publish it to the web by going to File > Publish to the web.... Your spreadsheet needs to be accessible to anyone with the link. You can make sure it is by clicking on the blue SHARE button to the top right. It should look like this:

Google Spreadsheet Sharing Settings

After it's available for anyone, you can get the spreadsheet ID by copying the relevant part from the URL.

Using the Jovo Google Sheets CMS Integration

In this section, we will integrate the Google Spreadsheet with a Jovo voice app in three simple steps:

You can find the full documentation here: Jovo Google Sheets CMS Integration.

Installation

This integration works with Jovo v2. Learn how to migrate from a v1 project here.

To get started, we need to enable the Google Sheets integration.

In your app.js file, register it with the use command:

Configuration

You can simply add the following to your config.js file in the src folder:

The Google Sheets integration allows you to add several different sheets of various sheet types. For this example, we're just going to use the Responses sheet type.

Learn everything about Sheet configuration here.

Accessing the Content

Now let's take a look at the app.js file in the src folder. Because we're using the Responses sheet type, you can access the content strings with the this.('key') method:

If you want to pass additional parameters, you can add them as an object:

Learn more about i18n here.

Next Steps

That's it! If you now test it, you should be able to get the responses you defined in your Google Spreadsheet.

You can test it locally by using the following command:

There are lots of additional things you can do with this integration, which we are going to focus on in upcoming tutorials.

For example:

Any questions? Please let us know in the comments below 👇. You can also reach us on Twitter or Slack.


Jan König

Co-founder at Jovo

Comments and Questions

Any specific questions? Just drop them below. Alternatively, you can also fill out this feedback form. Thank you!

Join Our Newsletter

Be the first to get our free tutorials, courses, and other resources for voice app developers.