Actions on Google – Part 2

You can read Part 1 from here:- https://devworx.digit.in/etc/actions-google-part-1-1105461.html

DESIGN AN APP
In the following segments we will attempt to design our own app for the Google Assistant platform. In the spirit of the new year, let us try to keep things light and try to design an application that tells you your fortune in a comic manner. To start off, we should come up with a set of sample conversations to get an idea of how we want our app to look. Thankfully, as we said, prototyping on Dialogflow is
pretty easy.

Create an Actions project and Dialogflow agent

To develop for Actions on Google, you need to create an Actions project and Dialogflow agent. The Actions project lets you register your actions, manage your app through the approval process,
view analytics for your app, and more. The Dialogflow agent defines what users can say to your app and
how your app processes user input.

Creating an Actions Project
• Open the Google Developer Console > navigate to Actions on Google.
• Click on Add Project, enter FortuneGuru for the project name, and click Create Project.
• In the Dialogflow flashcard, click on the BUILD button and then ‘Create Actions On Dialogflow’ to start building actions.
• On the next screen, you see the Dialogflow console with information automatically populated in
an agent. Click Create to save the demo agent.
• Your agent will eventually call some fulfillment logic that you’ll build later to return a response
with the user’s fortune, but for now let’s keep a dummy fulfillment.
• Click the Fulfillment menu item and then move the disabled slider for Webhook to the right to ‘Enabled’. Enter a dummy URL for now,
like https://fortune.guru.fulfillment. We’ll update this URL when our actual fulfillment service is ready.
Finally click Save.

Define actions and invocation
• When creating a Dialogflow agent a default intent is automatically created. This intent represents
the main entry to your conversation app. All your apps must have at least this main action defined,
so that Actions on Google knows how to invoke your app. The intent has an action field that specifies
an action name. When an intent is triggered, this is sent to your fulfillment so it can map the action’s name to the task to carry out.
• For the default Welcome Intent, delete the pre-populated responses in the Text response fields by clicking on the trash can icon in the upperright corner. Click on ADD MESSAGE CONTENT > Text response, specify the following response instead, and click Save.
“Hi! Welcome to FortuneGuru! Let’s get started. What is your birth date?”
• Now, when users invoke your app, they face the above welcome message and can know experience your app. In general, responses should guide users on what to say next and to stay within your conversation
grammar.

Define your conversation grammar
• A group of Dialogflow intents collectively constitute your app’s conversation grammar and what
tasks to carry out when users speak particular phrases of your grammar. As Dialogflow already pre-packages a natural language understanding (NLU) engine, it auformation, and Voice & Audio Activity
permissions on the Activity controls page for your Google account. Without this you will not be able to use the Actions Simulator, which lets you test your actions on the web without a hardware device. Click on try in Google Assistant link on the upper right hand side of the Actions page.
Note: If you’re presented with the Actions simulator splash screen, click Start to authenticate with your Google account.
In the Actions Simulator, type in talk to my test app in the Input area of the simulator to begin testing the app. Enter a birth date and then a color when the app prompts you to receive your ‘fortune’.

PRE-RELEASE
Now that we have successfully designed conversations and developed actions, let us take a look at how to share them with users. Before you make your agent available to Google Assistant users, however, make sure that it’s discoverable and also completely ready for deployment. Here are a few things that you could do to make sure that’s the case.
• Review your Actions to verify that they’re working properly and comply with Google’s policies. Get
your apps approved and deployed as smoothly as possible by reviewing them for common errors and
easy-to-miss policy violations.
• Get ready for deployment by preparing your assets and information for your listing. As part of the
submission process, you provide Google with images and descriptions for use in the Directory listing.
• Review your invocation methods. Follow the guidelines for creating good invocation name and triggering phrases. Users access and find out about your apps through triggering phrases, so it’s worthwhile to spend some time reviewing invocation. You may also want to register and reserve your invocation name before you’re ready for deployment, just to avoid someone else already reserving it.

PREPARE FOR DEPLOYMENT
When you submit your app for approval, Google expects and verifies that they meet a minimal set of
requirements before publishing them to users. Use the following pointers to prepare your app and submit them for review.
• Check for policy violations: Verify that your action follows the policies for Actions on Google.
• Be specific: Users must be able to call your invocation, specifically. Don’t be too abstract or general, since you want users to trigger your action. For example, use “Talk to WeatherApp to check the weather for [city]” instead of “Check the weather for [city]” as the appropriate action phrase.
• Avoid prohibited content: Unless it serves a scientific, artistic or educational purpose, apps with
explicitly sexual, violent, illegal, or hateful content violate the policies and will consequently be rejected or taken down.
• Respect copyrights and intellectual property: Make sure you have adequate rights to use the content
offered by your app.
• Be honest: Don’t mislead or deceive users with false claims or promises and always be clear about what your app can exactly do.
• Protect users’ privacy and security: Be transparent in how you handle user data, transmit user
data securely, and provide a general privacy or data policy.
• Don’t listen to users unprompted: Make sure your app notifies the user when it’s waiting for a command, to reduce the risk that your app is rejected. It is against the policies to listen to a user without explicitly specifying a ‘prompt’ that notifies them of such behaviour.
• Review your invocation and display names: Make sure your invocation name is consistent with
the display name, and that both are specific enough that users can easily call your action. Your invocation and display names must also follow the policies for Actions on Google. This is how people will instinctively know how to initiate a conversation with your app or give it a command, so yeah, this is quite important.

TEST YOUR APP
This is when you make sure everything works. Check for the common errors and violations such as the
Transport Protocol’s security, verification of the HTTPs (TLS) encryption on the transport for your webhooks. Then go ahead and ensure that you’re signing your webhook requests and verifying them in your webhook.
Disable SmallTalk, if you want to avoid answers to inquiries like “hello” and “goodbye”. Not all apps are intended to be chatty.
Also, make sure that the app name you’ve set consistently triggers your app. Use a hardware device and speak your invocation name repeatedly, in real-world scenarios (i.e., with noise in the background, or at different distances from the device). If your invocation name is not consistently recognized, you may need to look at a way to change it.
Finally, try to test on real devices. While the web simulator is great for testing your app quickly during development, you should always test invocation and dialogs on real devices, such as voice-activated speakers. This is the best way to be sure about the functioning of your app in real life so that you can go ahead and create a truly fulfilling experience for the user.

Leave a Comment

Your email address will not be published. Required fields are marked *