the "Bulls and Cows" number-guessing app as an app for Google Assistant. • Points while designing • Points while implementing • Points at submitting for a review
• Many companies and communities are finding a way. Many tools might be provided from now. • We don't have any tools, but we need some tool to design VUI apps. It is necessary to find some method by own (or refer to recommendations on Actions on Google)
of the conversation changed. Then extract before and after change as "context". • "Listen to a three-digit number, and answer the judgment result" • "After answering correctly, ask whether play again one more time" • "After three mistakes, ask whether want to hear the hint"
and the "hear_hint" context. 789 Hint 1 Bull 0 Cow. Do you need a hint? Yes The sum of three digit numbers is 16. The sum of three digit numbers is 16. I see. Please say three digit numbers. 1 Bull and 0 Cow I didn't understand well. Please say three digit numbers. No 123 ??? * Rounded corners are Context, Rectangles are Intent.
is rare. The response will be changed dynamically depending on user's phrases, contexts and app's statuses. → Fulfillment decides them. • Output contexts • Response To specify a process to the fulfillment, define actions.
code. • Can use something which can handle HTTP and JSON. • Generally, actions-on-google-nodejs for Node.js is used. ◦ https://github.com/actions-on-google/actions-on-google-nodejs • Fulfillment has an affinity for Cloud Functions. ◦ GCP/Firebase Cloud Functions (Free plan can be used if no external API accesses) ◦ Other alike solutions should also be no problem.
(req, res) => { const app = new DialogflowApp({request: req, response: res}); const inputWelcome = app => { app.ask("Hello, this is ***. ..."); }; const actionMap = new Map(); actionMap.set(ACTION_INPUT_WELCOME, inputWelcome); app.handleRequest(actionMap); }; This is a template code for Fulfillment.
Continue the conversation, and say a next phrase from the user. app.ask("Great! You got three bulls. Do you want to play again?"); // Specify re-prompts as 2nd argument for when the user doesn't say anything. app.ask( "Great! You got three bulls. Do you want to play again?", ["Sorry, I can't hear you well. Play again?", ...] ); // End the conversation app.tell("I see. See you again.");
Specify the output Context. const CONTEXT_PLAY_AGAIN = "play_again"; app.setContext(CONTEXT_PLAY_AGAIN, 1); // The value "1" is for Lifespan // Delete the input Context const CONTEXT_GAME = "game"; app.setContext(GAME, 0); // Deleted by specifying "0"
conversations. // Keep information within the conversation session. app.data.answer = "123"; // Keep information for a next conversation after ending the conversation. app.userStorage.answer = "123";
const answer = app.data.answer; if (number === answer) { app.setContext("game", 0); app.setContext("play_again", 1); app.ask("Bingo! Do you want to play again?"); } else { app.setContext("game", 1); app.ask("1 bull and 0 cow."); } }; Actual code sample.
in all contexts. → In the review process, the reviewer will confirm whether the conversation can be ended by the phrase "Finish". → Note that the reviewer may reject the application because the reviewer cannot end the conversation with the phrase in the context answering "yes" or "no" with app.askForConfirmation()... Can end the conversation anytime
description • Image, icon • Invocation phrases • Developer information • Privacy policy, Terms of use • Category • Other... Basically, need to register information to satisfied the page of the right image.
be invoked with the app name by Google Assistant as your expectation in advance. → Try calling the app name on Google Assistant, and know the text recognized by the assistant. → And, app name is first come, first served.
invoked with all registered phrases. → Also, on all devices. If not invoked, the application will be rejected. Especially, it is important to confirm Implicit Invocation on all devices.
of them is not checked well at the review. → However, it is important to protect me, therefore you must write them with responsibility. The review checks whether "a correct app name" is written in them.
Google Assistant, you need to know below described in this material in advance: • Points during designing • Points during implementing • Points at submitting for a review