Increasing the user engagement with notifications and Daily Updates

Neto Marin
Oct 11, 2018 · 12 min read

Imagine this scene: background music plays as a person slowly wakes up. While she’s getting out of bed, smart windows change their opacity level, allowing the exact amount of light to enter and softly illuminate the room. At the same time, one of the smart windows displays information about the weather and a list of upcoming appointments. Our character goes to the bathroom and, in the mirror, sees information about her health like her heart rate, how many hours she slept, and a reminder to take the vitamins prescribed by her doctor. She says, “start the espresso, and I’ll be ready to leave in 30 minutes”. While she drinks her espresso, she checks the traffic along her work route and receives a notification that her transport will arrive in two minutes.

Does the previous paragraph sound familiar to you? Maybe it’s because you’ve already seen these types of scenes in futuristic movies or Sci-Fi TV shows, right?

Until recently, this kind of technology was only the result of authors’ and screenwriters’ imaginations.Recently, though, we’ve started seeing interesting applications towards these kinds of ideas, like smart windows and mirrors, connected appliances, and, mainly, personal assistants like the Google Assistant, which make all of these work together.

The Google Assistant helps us get things done in different ways, like answering questions or helping us find information (about weather, traffic, etc.). The Assistant also helps us with real-world interactions, like finding the best route to an appointment, changing air-conditioning temperature, starting the vacuum-cleaner, asking for a ride, and much more.

As developers, we can extend the Assistant with Actions on Google and create Actions for several tasks, integrations, and situations that happen during the day. Once you have the user’s attention with your Action, it’s important to have tools that increase user engagement and allow your Action to help users the moment they need it. By doing this, your Action will become indispensable to your users.

Use suggestion chips to keep users in your Action

To fully engage with your Action, a user needs to know what the Action is capable of and then be able to explore all these opportunities. For example, the user might find your Action for a given need. But, when they discover other features, they might be even more satisfied with the experience and become loyal and active users. Instead of letting the user learn all the features by themselves, you can suggest features related to the last interaction they had.

For example, after reading some news about cryptocurrencies, Elisa got curious about a recently launched cryptocurrency that was becoming very famous with the code ETH. Because it was a superficial text, she didn’t find the name of that cryptocurrency, so she became even more curious about it. Using an Action called Crypto Guru that she found in the Actions on Google directory, she asked what the Action knew about the cryptocurrency with the code ETH. As we can see below, the answer was the name, description, and the launch date:

Screenshot for a simple response

This conversation could have stopped there since Elisa found out the name for that cryptocurrency. However, Crypto Guru developers anticipated that, if someone asks about a cryptocurrency, they may also want to ask about the cryptocurrency quote. They did this using suggestions chips and added the suggestion “Check ETH quote”.

Screenshot with Suggestion chip to check ETH price

Because of this chip, Elisa, who had only wanted to know the cryptocurrency name, decided to check ETH quote:

Screenshot with ETH price

Suggestion chips are part of what we call Rich responses, which are responses that are richer and more detailed. You can use the Node.js client library to add a suggestion chip to a response, as shown below:

To show a suggestion chip, the user must be using a device with a screen (chips are not read by the Assistant, only displayed). To offer an alternative for those using a speaker, like Google Home, we can create different texts for voice and screen; then, we can give the user a hint about what actions are possible. This suggestion is made using SimpleResponse instead of using only the string into conv.ask(). For example:

Encourage users to return to your Action

As we saw above, we have already been able to make our character, Elisa, explore more of our Action rather than stop after the first interaction. Now, we have a new challenge: make the Action useful not only for a specific moment, but also bring information to the user when they need it. This may be before the user even realizes they need it!

One way to do that is by offering the user the option to be notified according to an event, or related to a specific task. For example, we could provide the notification about a new cryptocurrency launch, since Elisa is so interested in this topic. Or, when a given cryptocurrency drops 10% on market value, we could send her a notification so she can decide to buy or sell. This opt-in is done using a suggestion chip, and, when selected, it will trigger another intent. This intent is responsible for getting the user to opt-in and save the necessary data (an ID) to send the push notification according to the user preferences. Here is a screenshot with the suggestion chip:

Screenshot with the Suggestion chip for push notification opt-in

The first step is to enable (to each intent that can send a notification) the option to send push notifications in the Actions console. In our example, let’s enable this to the Action “Exchange rate”, the Action triggered to return the cryptocurrency value. Doing this is pretty straightforward:

  1. Access the Actions console and choose your working project.
  2. In the left menu, select Build → Actions and look for the Action to be triggered.
  3. In the Action screen, scroll down to the bottom of the page and expand the section User engagement.
  4. Enable the option, “Would you like to send push notifications? If yes, user permission will be needed.”, and then give a name to your notification.
  5. Click Save, and you are good to go!
Enabling Push Notifications on Actions Console

Now, it’s time to offer the notification suggestion so the user can accept the opt-in and start receiving notifications. Let’s add the suggestion chip to the cryptocurrency exchange rate return:

For this suggestion to work, we need to create a new intent with training phrases that correspond to the suggestion text, so it can be triggered by the Assistant when the user selects the chip. Remember to enable the fulfillment option so that we can ask permission. In our case, let’s name this new intent exchange_rate_setup_push:

Intent to trigger user’s authorization

After saving the intent, it’s time to add it to our back-end code:

When the intent exchange_rate_setup_push is triggered, the Assistant will take control and ask the user to give permission to your Action to send notifications. At this point, you don’t have to worry about different answers or conversation variations because the Assistant will handle it for you.

To receive the opt-in result and the ID to use when sending push notifications, you need to create a new intent. In our case, we’ll name it finish_exchange_rate_setup_push, and it should be configured to handle the event actions_intent_PERMISSION. Don’t forget to enable the fulfillment option! Also, to avoid unexpected errors when integrating, put the intent name as the training phrase. Your intent should look like this:

Intent to handle user’s authorization for Push notifications

After saving your new intent, it’s necessary to handle the authorization result in your back-end, which adds the function for the new intent. For this intent, you need to check if the authorization was granted with the argument PERMISSION. If yes, you have to save the argument UPDATES_USER_ID, because you will need this ID to send your push notifications.

You should save this UPDATES_USER_ID in your database, or in any other resource you prefer, because it will only be returned the first time. Even if your Action requests for authorization again, this ID won’t be returned again. The fulfillment code will look like this:

After completing these steps, your Action is ready to receive notifications. However, to be able to send notifications, there are a few more configuration steps. The first one is to enable the Actions API, which will be used to send notifications, in the Google APIs console. After selecting your working project, click ENABLE.

Google APIs console to enable Actions API

You will now need the credentials to exchange the service account key with the access token, which will be used during the communication with Google servers when doing API calls. Click CREATE CREDENTIALS to create these credentials; then, look for the link Service Account and click on it.

Click on CREATE SERVICE ACCOUNT to fill the data about the new account. Name it something easily identifiable, like “Notification”, and define the role as Project → Owner. Then, click SAVE.

Creating service account

After saving the account, click on it. In the details screen, go to the edit mode so that you can create the key. Click on + CREATE KEY…, select JSON, and click CREATE. The key will then be downloaded to your machine. Click SAVE, and your account and key are ready to use.

Selecting JSON key format

As we mentioned before, to send push notifications, you must exchange the service account key with the access key and then make API calls using this new key. This exchange can be done using the Node.js client library if you want to use the same infrastructure (or Cloud Function) you are already using for your fulfillment. Or, if you already have a back-end using another language (or you just don’t want to use Node.js), the Google API Client Library is available on several languages, like Java, Python, PHP, .Net, etc.

After exchanging the access token, it’s possible to send push notifications. In the section “Exchange the key for an access token and send a notification”, you will find instructions about how to get the access token. In our sample Actions on Google tips, you can see the code to send push notifications.

Keep your user up to date and your Action relevant

Our user, Elisa, is already pleased with the Action “Crypto Guru”. She not only got the name she wanted, but is now also being warned when a cryptocurrency has a significant price change. But what if we could further increase our Action’s usefulness to her?

At the beginning, we talked about a smart window or the bathroom mirror showing information. Did you know that your Action can do something similar?

With Daily Updates, users can receive daily notifications about a topic they choose at the right moment for them. For example, we can offer our user a daily update about the cryptocurrency price at the time she prefers. Because of this, even if the price doesn’t change enough to trigger the notification, she will stay well-informed about the quote.

The setup is very similar to what we just did for push notifications. Begin in the Actions console and find the Action that will be triggered when the user clicks on the daily update notification. Enable the option, “Would you like to offer daily updates to users?”. Define a title and click SAVE. In our case, the triggered Action returns the price:

Enabling Daily Updates on Actions Console

According to the default behavior, when using this Action, the Assistant will give the user the chance to subscribe to receive daily updates. Then, every day at the specified time, she will receive a notification on her devices. When she clicks on it, the Action will be triggered to return the cryptocurrency price.

But what if we need a more customized flow according to our Action, or according to a given parameter (like a cryptocurrency, for example)? Is it possible? Yes, of course!

The initial setup is the same as what we just explained. The difference is like what we did for notifications — it’s necessary to handle the user opt-in, and then create a new intent that corresponds to the suggestion presented and requires you to treat specific conditions. So, let’s change the intent cryptocurrency_price to add the daily update suggestion:

So, when the user asks about a cryptocurrency price, two suggestions will be displayed:

Screenshot with Daily Updates opt-in Suggestion chip

Just like for notifications, it’s necessary to create a new intent. In our case, we’ll name this intent setup_price_update, and add the suggestion text as the training phrase. For the Assistant to know which Action to trigger after the user answers the opt-in, we’ll need to configure an Action name in the “Action and parameters” section, like configure_price_updates. Make sure to enable the Fulfillment option to call the back-end function. The new intent should look like this:

Intent to trigger authorization request

To have the flow continue after the user’s opt-in answer, it’s necessary to create a new intent (in our case, we named it configure_price_updates) to be triggered by Google Assistant through the event actions_intent_CONFIGURE_PRICE_UPDATES. The event name corresponds to the action we defined in the intent setup_price_update (as shown in the previous image). The new intent should look like this:

Intent to handle Daily updates configuration

At the back-end, it’s necessary to call the opt-in operation and then redirect to the intent that will check if the authorization was granted or not. The code would look something like the following:

To finalize the subscription cycle for daily updates, it’s necessary to create the intent that will receive the user’s answer about the authorization. We’ll name this intent finish_price_update_setup and configure it to handle the event actions_intent_REGISTER_UPDATE. We’ll also make sure fulfillment is enabled so we can properly handle the response. After the user answers the opt-in, the Assistant will trigger this new intent:

Intent to handle user’s authorization answer

At the back-end, we have to see if the authorization was granted, so we’ll check if the parameter registered.status is equal to OK:

At this point, our Action is almost ready to receive daily updates, but do you remember how the whole flow began? Our user asked the price of a specific cryptocurrency (in our case, ETH), but there are over 200 cryptocurrencies available for searching. So, we need to ask our user about which cryptocurrency she wants to receive daily updates about. The Assistant can help us with that!

The first step is to open the intent that will be triggered to send the daily update (for this sample, it’s the Action cryptocurrency_price) and add to it the event actions_intent_CONFIGURE_PRICE_UPDATES. Now, create a new parameter according to the entity Cryptocurrency. For this sample, it’s already a parameter because we need this information to return the expected price:

Daily update intent setup to receive a parameter

Open the intent that handles the update configuration, which in our case is setup_price_update, and add the same parameter that was configured on the previous intent (the cryptocurrency parameter). Mark it as required. The intent should look like this:

Daily update parameter configuration

We need to change the back-end as well, so we can read the parameter value and send it to the intent that will finalize the update configuration:

Now, when the intent setup_price_update is triggered, the first question will be about the parameter (the cryptocurrency, in this example), and the next ones about the other information needed to send the daily updates. This way, the Assistant will be able to trigger the intent cryptocurrency_price is sending the parameter cryptocurrency according to the value said by our user. Then, at the chosen time every day, Elisa will receive the cryptocurrency price.

User engagement is key for a successful Action

Making your Action more relevant for your users and keeping them engaged will help your Action to be successful and reach more users. With the tips we shared above, you can offer a better experience for your users, and they will likely return to your Action more often.

For more details, check our guide about User Engagement. If you have questions or comments, come talk with us in our G+ community, or send something to our Twitter @ActionsOnGoogle (don’t forget to use the hashtag #AoGDevs)!

Google Developers

Engineering and technology articles for developers, written…

Neto Marin

Written by

Actions on Google DevRel, aiming to help developers to create awesome Actions for Google Assistant. But first of all a passionate and dedicated dad and husband!

Google Developers

Engineering and technology articles for developers, written and curated by Googlers. The views expressed are those of the authors and don't necessarily reflect those of Google.

Neto Marin

Written by

Actions on Google DevRel, aiming to help developers to create awesome Actions for Google Assistant. But first of all a passionate and dedicated dad and husband!

Google Developers

Engineering and technology articles for developers, written and curated by Googlers. The views expressed are those of the authors and don't necessarily reflect those of Google.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store