Daily updates (Dialogflow)

A user subscribing to an Action's daily updates on their phone

If your Action provides value to users every day, give users a reminder to use it by configuring daily updates. When a user subscribes to daily updates for your Action, they'll receive a push notification they can tap to invoke one of your Action's intents.

A user's experience of these updates is as follows:

  1. The user invokes one of your Action's intents that you've configured as a daily update.
  2. The user follows a prompt for subscribing to daily updates. This prompt is given mid-conversation or as a suggestion chip when the conversation ends.
  3. The user schedules a time of day that they'd like to receive your daily update, registering your update with the Google Assistant.
  4. At their scheduled time each day, the user receives an Assistant notification on their mobile device.
  5. When the user opens this notification, they invoke the intent that you configured as a daily update and interact with your Action.

By default, the daily update registration prompt appears as a suggestion chip when the user exits your Action successfully. You can also add a mid-conversation registration prompt or personalize the user's updates.

Use cases

Daily updates can be a useful engagement tool but should not be incorporated in every Action. Consider these tips when deciding whether to add daily update subscriptions to an Action:

  • Make sure the daily updates will result in the user seeing different, useful information every day. If tapping a daily update results in the same prompt every time, the user will probably unsubscribe after a couple days.
  • Make sure your dialog makes sense to your user if they jump straight to your daily update's intent. Your user won't necessarily start from the beginning of the conversation, so they shouldn't be expected to have much context.
  • Show your user the benefit of your Action before prompting them to register for daily updates. Your user should be thinking "I want this content every day" when they are given the option to subscribe.
  • Don't overwhelm the user with repeated suggestions to register. Offer a daily update subscription right after showing the user what they'd subscribe to, and avoid repeating the offer in other contexts.
  • Keep the conversation short after the update intent is triggered. Most daily updates should only consist of a single response then close without requiring user input.

Set up daily updates

Explore in Dialogflow

Click Continue to import our Daily updates sample in Dialogflow. Then, follow the steps below to deploy and test the sample:

  1. Enter an agent name and create a new Dialogflow agent for the sample.
  2. After the agent is done importing, click Go to agent.
  3. From the main navigation menu, go to Fulfillment.
  4. Enable the Inline Editor, then click Deploy. The editor contains the sample code.
  5. From the main navigation menu, go to Integrations, then click Google Assistant.
  6. In the modal window that appears, enable Auto-preview changes and click Test to open the Actions simulator.
  7. In the simulator, enter Talk to my test app to test the sample!
Continue

To configure one of your Action's intents for daily updates, follow these instructions:

1. Prepare an update intent

Configure one of your Action's intents as a triggering intent. This intent enables a daily update to be sent to users; when a user opens their daily update notification, the intent triggers and the conversation continues from there.

To define a triggering intent in Dialogflow, do the following:

  1. In the Dialogflow Console, click on Integrations.
  2. Under the Google Assistant section, click on Integration Settings.
  3. Under Discovery > Implicit invocation, click on Add intent and select your triggering intent if it's not already there.
  4. Turn on Auto-preview changes if it's not already enabled.
  5. Click Close.

In the Actions SDK, define your update intent as a triggering intent in the Action package.

2. Enable updates

To turn on daily updates for your triggering intent, do the following:

  1. In the Actions console, navigate to Develop > Actions.
  2. Select your triggering intent. If your intent doesn't appear in the list, make sure it's configured as a triggering intent and Dialogflow's Assistant integration is set to auto-preview changes.
  3. Scroll down to the User engagement section and turn on Would you like to offer daily updates to users.
  4. Enter a Content title.
  5. Click Save.

You've now configured your Action to offer daily update subscriptions for an intent. You can now test your daily updates on your own mobile device.

Customize update registration (optional)

In addition to the suggestion chip and Assistant-handled daily update registration flow, subscribe users to daily updates with your own dialog and registration prompt.

For a complete example of an Action that handles optional daily update features, see the Actions on Google user engagement samples (Node.js and Java).

To add a custom daily update registration prompt to your conversation, follow these instructions:

1. Add registration prompt

Add dialogue and a suggestion chip to the conversation when you want to prompt users to subscribe to daily updates. Offer these prompts after the user interacts with your update intent, so they understand the contents of your daily updates.

The following example code prompts a user to subscribe to daily updates that offer the lowest expected temperature each day:

Node.js
app.intent('Daily Lowest Temperature', (conv, params) => {
  const today = DAYS[new Date().getDay()];
  const lowestTemperature = lowestTemperatures[today];
  conv.ask(`The lowest temperature for today is ${lowestTemperature}`);
  conv.ask('I can send you daily updates with the lowest temperature' +
    ' of the day. Would you like that?');
  conv.ask(new Suggestions('Send daily updates'));
});
Java
@ForIntent("Daily Lowest Temperature")
public ActionResponse dailyLowestTemperature(ActionRequest request) {
  ResponseBuilder responseBuilder = getResponseBuilder(request);
  Integer lowestTemperature =
      LOWEST_TEMPERATURES.get(LocalDate.now().getDayOfWeek());
  responseBuilder
      .add("The lowest temperature for today is " +  lowestTemperature + " degrees Fahrenheit.")
      .add("I can send you daily updates with the lowest temperature of " +
          "the day. Would you like that?")
      .addSuggestions(new String[] {
          "Send daily updates"
      });
  return responseBuilder.build();
}
Dialogflow JSON

Note that the JSON below describes a webhook response.

{
  "payload": {
    "google": {
      "expectUserResponse": true,
      "richResponse": {
        "items": [
          {
            "simpleResponse": {
              "textToSpeech": "The lowest temperature for today is 75 degrees Fahrenheit"
            }
          },
          {
            "simpleResponse": {
              "textToSpeech": "I can send you daily updates with the lowest temperature of the day. Would you like that?"
            }
          }
        ],
        "suggestions": [
          {
            "title": "Send daily updates"
          }
        ]
      }
    }
  }
}
Actions SDK JSON

Note that the JSON below describes a webhook response.

{
  "expectUserResponse": true,
  "expectedInputs": [
    {
      "possibleIntents": [
        {
          "intent": "actions.intent.TEXT"
        }
      ],
      "inputPrompt": {
        "richInitialPrompt": {
          "items": [
            {
              "simpleResponse": {
                "textToSpeech": "The lowest temperature for today is 75 degrees Fahrenheit"
              }
            },
            {
              "simpleResponse": {
                "textToSpeech": "I can send you daily updates with the lowest temperature of the day. Would you like that?"
              }
            }
          ],
          "suggestions": [
            {
              "title": "Send daily updates"
            }
          ]
        }
      }
    }
  ]
}

2. Handle update registration

Set up a new intent that triggers when the user follows your registration prompt. In the fulfillment for this new intent, trigger the actions_intent_CONFIGURE_UPDATES built-in intent with the following parameters:

  • intent - Set to the update intent you configured.
  • frequency - Set to "DAILY".

The following code registers daily updates for the "Daily Lowest Temperature" intent:

Dialogflow Node.js
app.intent('Subscribe to Daily Updates', (conv) => {
  conv.ask(new RegisterUpdate({
    intent: 'Daily Lowest Temperature',
    frequency: 'DAILY',
  }));
});
Actions SDK Node.js
conv.ask(new RegisterUpdate({
  intent: 'Daily Lowest Temperature',
  frequency: 'DAILY',
}));
Dialogflow Java
@ForIntent("Subscribe to Daily Updates")
public ActionResponse subscribeToDailyUpdates(ActionRequest request) {
  ResponseBuilder responseBuilder = getResponseBuilder(request);
  return responseBuilder.add(new RegisterUpdate()
      .setIntent("Daily Lowest Temperature")
      .setFrequency("DAILY"))
      .build();
}
Actions SDK Java
ResponseBuilder responseBuilder = getResponseBuilder(request);
return responseBuilder.add(new RegisterUpdate()
    .setIntent("Daily Lowest Temperature")
    .setFrequency("DAILY"))
    .build();
Dialogflow JSON
{
  "payload": {
    "google": {
      "expectUserResponse": true,
      "systemIntent": {
        "intent": "actions.intent.REGISTER_UPDATE",
        "data": {
          "@type": "type.googleapis.com/google.actions.v2.RegisterUpdateValueSpec",
          "intent": "Daily Lowest Temperature",
          "triggerContext": {
            "timeContext": {
              "frequency": "DAILY"
            }
          }
        }
      }
    }
  }
}
Actions SDK JSON
{
  "expectUserResponse": true,
  "expectedInputs": [
    {
      "possibleIntents": [
        {
          "intent": "actions.intent.REGISTER_UPDATE",
          "inputValueData": {
            "@type": "type.googleapis.com/google.actions.v2.RegisterUpdateValueSpec",
            "intent": "Daily Lowest Temperature",
            "triggerContext": {
              "timeContext": {
                "frequency": "DAILY"
              }
            }
          }
        }
      ]
    }
  ]
}

3. Handle the result

The Assistant takes over your conversation and walks the user through the rest of their daily updates configuration. When the registration is complete, the Assistant triggers an intent with a parameter indicating whether the registration was a success or not.

The instructions for this step are different depending on whether you use Dialogflow or the Actions SDK for development.

Dialogflow

Follow these steps to create an intent that handles the registration result:

  1. In the Dialogflow console, create a new intent.
  2. Add the actions_intent_REGISTER_UPDATE event.
  3. Turn on webhook fulfillment for the intent.
  4. Click Save.
In your fulfillment for the intent, check the registered parameter for the result, and pivot the conversation accordingly.
Dialogflow Node.js
app.intent('Confirm Daily Updates Subscription', (conv, params, registered) => {
  if (registered && registered.status === 'OK') {
    conv.close(`Ok, I'll start giving you daily updates.`);
  } else {
    conv.close(`Ok, I won't give you daily updates.`);
  }
});
Dialogflow Java
@ForIntent("Confirm Daily Updates Subscription")
public ActionResponse confirmDailyUpdatesSubscription(ActionRequest request) {
  ResponseBuilder responseBuilder = getResponseBuilder(request);
  if (request.isUpdateRegistered()) {
    responseBuilder.add("Ok, I'll start giving you daily updates.");
  } else {
    responseBuilder.add("Ok, I won't give you daily updates.");
  }
  return responseBuilder.endConversation().build();
}
Dialogflow JSON
{
  "payload": {
    "google": {
      "expectUserResponse": false,
      "richResponse": {
        "items": [
          {
            "simpleResponse": {
              "textToSpeech": "Ok, I'll start giving you daily updates."
            }
          }
        ]
      }
    }
  }
}
Actions SDK

In your fulfillment code, add handling for the actions.intent.REGISTER.UPDATE built-in intent. Check the registered parameter for the result, and pivot the conversation accordingly.

Actions SDK Node.js
app.intent('actions.intent.REGISTER_UPDATE', (conv, params, registered) => {
  if (registered && registered.status === 'OK') {
    conv.close(`Ok, I'll start giving you daily updates.`);
  } else {
    conv.close(`Ok, I won't give you daily updates.`);
  }
});
Actions SDK Java
@ForIntent("actions.intent.REGISTER_UPDATE")
public ActionResponse confirmDailyUpdatesSubscription(ActionRequest request) {
  ResponseBuilder responseBuilder = getResponseBuilder(request);
  if (request.isUpdateRegistered()) {
    responseBuilder.add("Ok, I'll start giving you daily updates.");
  } else {
    responseBuilder.add("Ok, I won't give you daily updates.");
  }
  return responseBuilder.endConversation().build();
}
Actions SDK JSON
{
  "expectUserResponse": false,
  "finalResponse": {
    "richResponse": {
      "items": [
        {
          "simpleResponse": {
            "textToSpeech": "Ok, I'll start giving you daily updates."
          }
        }
      ]
    }
  }
}

Personalize updates (optional)

To personalize your update intent, add custom parameters when users register daily updates. When you fulfill the update intent, reference these parameters to customize the daily update for that user.

The instructions for this feature are different depending on whether you use Dialogflow or the Actions SDK for development.

Dialogflow

Define a Dialogflow entity to handle custom parameters for the update, then hand off the parameter's value as an argument for your update intent. To set up personalized updates in Dialogflow, do the following steps:

  1. In the Dialogflow console, create a new entity.
  2. Add some entries and synonyms that are relevant for your parameter.
  3. Click Save, then open your update intent.
  4. In the Actions and parameters section, set actions.intent.CONFIGURE_UPDATES as the event. In the same section, add a parameter with the same type as the new entity.
  5. Open the "update registration" intent that handles the CONFIGURE_UPDATES built-in intent.
  6. In the Actions and parameters section, add a required parameter and set its type to the entity previously created.
  7. Update your registration intent's fulfillment code to include an arguments object with the following contents:
    • name - The name of your parameter as configured in Dialogflow.
    • textValue - Your parameter's value.

The following code reads the value of the parameter and uses it in the update registration request:

Dialogflow Node.js
app.intent('setup_update', (conv) => {
  conv.ask(new RegisterUpdate({
    intent: 'update_of_the_day',
    arguments: [
      {
        name: 'category',
        textValue: 'Daily_lowest_temperature',
      },
    ],
    frequency: 'DAILY',
  }));
});
Dialogflow Java
@ForIntent("setup_update")
public ActionResponse setupUpdate2(ActionRequest request) {
  List<Argument> args =
      Arrays.asList(
          new Argument()
              .setName("category")
              .setTextValue(request.getParameter("category").toString()));
  return getResponseBuilder(request)
      .add(new RegisterUpdate().setIntent("intent_name").setArguments(args).setFrequency("DAILY"))
      .build();
}
Dialogflow JSON
{
  "payload": {
    "google": {
      "expectUserResponse": true,
      "richResponse": {
        "items": [
          {
            "simpleResponse": {
              "textToSpeech": "PLACEHOLDER"
            }
          }
        ]
      },
      "userStorage": "{\"data\":{}}",
      "systemIntent": {
        "intent": "actions.intent.REGISTER_UPDATE",
        "data": {
          "@type": "type.googleapis.com/google.actions.v2.RegisterUpdateValueSpec",
          "intent": "update_of_the_day",
          "arguments": [
            {
              "name": "category",
              "textValue": "Daily_lowest_temperature"
            }
          ],
          "triggerContext": {
            "timeContext": {
              "frequency": "DAILY"
            }
          }
        }
      }
    }
  },
  "outputContexts": [
    {
      "name": "/contexts/_actions_on_google",
      "lifespanCount": 99,
      "parameters": {
        "data": "{}"
      }
    }
  ]
}
Actions SDK

Request additional information from the user in your intent fulfillment, then hand off the information as an argument for your update intent. To set up personalized updates in the Actions SDK, do the following steps:

  1. Prompt the user for information that you want to use for personalization.
  2. In your fulfillment code for your "update registration" intent that handles the CONFIGURE UPDATES include an arguments object with the following contents:
    • name - A name for your argument.
    • textValue - Information from the user, to be passed as an argument.

The following code sends an argument with the update registration request:

Actions SDK Node.js
app.intent('actions.intent.TEXT', (conv) => {
  if (conv.input.raw === 'Send daily') {
    conv.ask(new RegisterUpdate({
      intent: 'update_of_the_day',
      arguments: [
        {
          name: 'category',
          textValue: 'Daily_lowest_temperature',
        },
      ],
      frequency: 'DAILY',
    }));
  }
});
Actions SDK Java
@ForIntent("actions.intent.CONFIGURE_UPDATES")
public ActionResponse configureUpdatesActionsSdk(ActionRequest request) {
  List<Argument> args =
      Arrays.asList(
          new Argument()
              .setName("category")
              .setTextValue(request.getParameter("category").toString()));
  return getResponseBuilder(request)
      .add(new RegisterUpdate().setIntent("intent_name").setArguments(args).setFrequency("DAILY"))
      .build();
}

@ForIntent("actions.intent.TEXT")
public ActionResponse text(ActionRequest request) {
  ResponseBuilder rb = getResponseBuilder(request);
  String input = request.getRawInput().getQuery();
  if (input.equals("DAILY_NOTIFICATION_SUGGESTION")) {
    rb.add("For which category do you want to receive daily updates?");
  } else {
    rb.add("Sorry, I didn't get that. Please try again later").endConversation();
  }
  return rb.build();
}
Actions SDK JSON
{
  "expectUserResponse": true,
  "expectedInputs": [
    {
      "inputPrompt": {
        "richInitialPrompt": {
          "items": [
            {
              "simpleResponse": {
                "textToSpeech": "PLACEHOLDER"
              }
            }
          ]
        }
      },
      "possibleIntents": [
        {
          "intent": "actions.intent.REGISTER_UPDATE",
          "inputValueData": {
            "@type": "type.googleapis.com/google.actions.v2.RegisterUpdateValueSpec",
            "intent": "update_of_the_day",
            "arguments": [
              {
                "name": "category",
                "textValue": "Daily_lowest_temperature"
              }
            ],
            "triggerContext": {
              "timeContext": {
                "frequency": "DAILY"
              }
            }
          }
        }
      ]
    }
  ],
  "conversationToken": "{\"data\":{}}",
  "userStorage": "{\"data\":{}}"
}

When the user invokes your daily update, your update intent now includes arguments containing the values given by the user during registration. Use these values to personalize the update for each user.

Test daily updates

Test your daily updates using a mobile device with the Google Assistant using the same Google account that you used to build your Action. Invoke your Action and subscribe to daily updates, then check your device's notifications around the update time.