<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Yoichiro Tanaka on Medium]]></title>
        <description><![CDATA[Stories by Yoichiro Tanaka on Medium]]></description>
        <link>https://medium.com/@yoichiro?source=rss-c23421e64eb5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*sL3OZRSVfQeyknD98LDwSg.png</url>
            <title>Stories by Yoichiro Tanaka on Medium</title>
            <link>https://medium.com/@yoichiro?source=rss-c23421e64eb5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 15:44:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@yoichiro/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Building a Zero-Knowledge Elevator Pitch Builder with Chrome Built-in AI]]></title>
            <link>https://medium.com/@yoichiro/building-a-zero-knowledge-elevator-pitch-builder-with-chrome-built-in-ai-add725883a01?source=rss-c23421e64eb5------2</link>
            <guid isPermaLink="false">https://medium.com/p/add725883a01</guid>
            <dc:creator><![CDATA[Yoichiro Tanaka]]></dc:creator>
            <pubDate>Sat, 13 Jun 2026 01:41:14 GMT</pubDate>
            <atom:updated>2026-06-13T06:04:55.766Z</atom:updated>
            <content:encoded><![CDATA[<p>I have released a new web app called “Zero-Knowledge Pitch Builder.” It is an application designed to turn your chaotic brainstorming ideas into a structured elevator pitch, leveraging the Chrome Built-in AI API to its fullest.</p><p>In this post, I would like to introduce the app and explain how to use it, while also sharing the underlying thoughts on why I insisted on building it specifically with the Chrome Built-in AI API.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3FuX14k1Yd_QwEOsVadeHw.png" /></figure><h3>I built an elevator pitch builder that sends absolutely nothing to the server</h3><p>The app is now live and available at the following URL. Please feel free to try it out: <a href="https://zero-knowledge-pitch-builder.yoichiro.dev/">Zero-Knowledge Pitch Builder — zero-knowledge-pitch-builder.yoichiro.dev</a></p><p>The source code for this application is also publicly available on GitHub. If you take a look at the code, you can verify for yourself that it truly does not transmit any data externally: zero-knowledge-pitch-builder — <a href="https://github.com/yoichiro/zero-knowledge-pitch-builder.git">github.com/yoichiro/zero-knowledge-pitch-builder</a></p><p>The term “Zero-Knowledge” means that this application never transmits any information provided by the user to the outside world. While you enter your ideas to generate an elevator pitch, all processing is completed entirely within your browser.</p><p>In other words, there is no server. No API keys are required. Not a single request or response flows over the network. It is built so that you can safely throw in your unreleased business ideas or highly confidential concepts with complete peace of mind.</p><p>I believe this architecture was only made possible because I fully embraced the Chrome Built-in AI API.</p><h3>What you can do with Zero-Knowledge Pitch Builder</h3><p>The core feature of this app is to break down cluttered idea notes into the following six topics that form a standard elevator pitch:</p><ul><li><strong>Hook</strong> (An opening that grabs the listener’s attention)</li><li><strong>Problem</strong> (The issue that needs to be solved)</li><li><strong>Solution</strong> (The solution you provide)</li><li><strong>Value Proposition</strong> (The value offered)</li><li><strong>Competitors</strong> (The competition)</li><li><strong>Differentiators</strong> (What sets you apart)</li></ul><p>If any of these items are missing from your input, the AI infers and fills them in based on the other information provided. This means that even if you don’t have all the pieces put together during the brainstorming stage, you can bring it to the form of an elevator pitch all at once.</p><p>Furthermore, it includes a feature where three types of virtual personas review and comment on the completed elevator pitch: a VC investor, a corporate executive, and a general consumer. Each persona gives feedback from a different perspective and provides a set of suggestions for improvement.</p><p>Additionally, the app features a function to generate pitches tailored to three different time constraints — 15 seconds, 30 seconds, and 60 seconds — along with a two-way translation feature between Japanese and English. Since the input language is automatically detected, users don’t even need to specify which language they are using.</p><p>The entire workflow of creating, refining, and delivering an elevator pitch is wrapped up within a single browser. This seamless integration felt incredibly satisfying even to me while building it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jwapLOO0jH3e-9TZvkHOCw.png" /></figure><h3>A walkthrough of how to use it</h3><p>The actual user flow is very straightforward.</p><p>First, open the app in your browser. Upon the first launch, a screen will appear showing the download status of the Chrome Built-in AI model groups (LanguageModel, LanguageDetector, Summarizer, and Translator) to your local machine. The progress is displayed in real-time.</p><p>Once the download is complete, try writing down whatever comes to mind — whether in bullet points or full sentences — in the “Brain Dump” area on the left side of the screen. For example, a rough note like <em>“Problems when walking dogs, raincoats are a hassle on rainy days, a pet jacket that dries automatically, price under 10,000 yen”</em> is perfectly fine.</p><p>When you click the “Analyze” button, your ideas will be broken down into the six topics (Hook, Problem, Solution, Value Proposition, Competitors, and Differentiators) and deployed sequentially in the central “Workspace” area. Watching the cards fill up one by one — starting with the Hook, followed by the Problem, and then the Solution — is quite satisfying to watch.</p><p>At this stage, you can manually edit the text inside each topic’s card. This step allows you to refine the pitch in your own words and add extra details, rather than just blindly using what the AI generated.</p><p>Once the cards are polished, click the “Apply” button. The “Output” area on the right side will then generate elevator pitches tailored to the different time limits, along with reviews from the three virtual personas. If you want to translate the output between English and Japanese, you can also execute it right then and there.</p><p>Everything concludes inside the browser. It literally feels like it’s operating inside a “closed box,” an experience you can truly appreciate once you try it out.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3FuX14k1Yd_QwEOsVadeHw.png" /></figure><h3>How it was implemented using Chrome Built-in AI API</h3><p>The Zero-Knowledge Pitch Builder combines and uses four APIs provided by Chrome Built-in AI. Here are their roles and code examples.</p><p>First, the <strong>LanguageDetector API</strong> determines the language of the input text:</p><pre>const detector = await window.LanguageDetector.create();<br>const results = await detector.detect(text);<br>const topLanguage = results[0].detectedLanguage; // &quot;ja&quot; or &quot;en&quot;</pre><p>With just a few lines, you can determine which language the text is written in. This is used to create a simple UX where “users don’t have to select a language.”</p><p>With just a few lines, you can determine which language the text is written in. This is used to create a simple UX where “users don’t have to select a language.”</p><p>Next, the <strong>Prompt API</strong> handles the core task of generating the six elevator pitch topics:</p><pre>const session = await window.LanguageModel.create({<br>  systemPrompt: &quot;You are an excellent startup pitch consultant.&quot;,<br>});<br>const result = await session.prompt(<br>  `Please extract the &#39;hook&#39; from the following idea memo. [Idea Memo] ${dump}`<br>);</pre><p>This is a straightforward API where you define the agent’s persona using systemPrompt and send individual tasks via prompt. In Zero-Knowledge Pitch Builder, dedicated sessions are prepared for each of the categories—Hook, Problem, Solution, Value Proposition, Competitors, and Differentiators—executing the six inferences sequentially.</p><p>To create summaries tailored to specific time constraints, the <strong>Summarizer API</strong> comes in handy:</p><pre>const summarizer = await window.Summarizer.create({<br>  type: &#39;teaser&#39;,<br>  format: &#39;plain-text&#39;,<br>  length: &#39;short&#39;, // &#39;short&#39; | &#39;medium&#39; | &#39;long&#39;<br>});<br>const teaser = await summarizer.summarize(fullPitchText);</pre><p>Since you can toggle the length option between short, medium, and long, dividing the content into 15-second, 30-second, and 60-second elevator pitches can be written very naturally.</p><p>Finally, the <strong>Translator API</strong> handles English-to-Japanese and Japanese-to-English translation:</p><pre>const translator = await window.Translator.create({<br>  sourceLanguage: &#39;en&#39;,<br>  targetLanguage: &#39;ja&#39;,<br>});<br>const translated = await translator.translate(text);</pre><p>This is also an incredibly simple API. You don’t need to construct requests with fetch, nor do you need to insert API keys into headers.</p><p>By the way, all of these exist from the start in the browser as global objects, such as window.LanguageModel. This means you don&#39;t even need to npm install any libraries. I think this level of ease looks highly attractive to web developers.</p><h3>The massive advantages brought by Chrome Built-in AI API</h3><p>By now, I hope you have a good grasp of what goes on inside the Zero-Knowledge Pitch Builder. Let me summarize the three main reasons why I chose to build this app using the Chrome Built-in AI API:</p><ul><li>It is completely secure.</li><li>It requires absolutely no server.</li><li>It is incredibly easy to integrate.</li></ul><p>The first point, “completely secure,” is exactly what the name “Zero-Knowledge” stands for. The fact that LLM inputs are never sent externally means you can safely feed it confidential information or unreleased ideas. I believe this provides a sense of security that cloud-based LLM services cannot offer by definition.</p><p>The second point, “requires absolutely no server,” is a massive deal for developers and operators. There are no LLM inference costs, no infrastructure costs, no API key management, and no worries about rate limits. The app runs just by hosting it as static files. Zero-Knowledge Pitch Builder is also just static files placed on Firebase Hosting.</p><p>The third point, “easy to integrate,” is exactly as shown in the code examples. With just short snippets like window.LanguageModel.create(), you can bring the power of LLMs into web apps. I think this significantly lowers the barrier to utilizing LLMs in web development.</p><p>When you combine these advantages, a future where “web apps using LLMs as a matter of course” starts to feel much closer to reality.</p><h3>Web browsers will become the OS of the AI era</h3><p>Now, here is the main point.</p><p>I view the web browser as “today’s OS.” Given the current reality where many applications run as web apps rather than native apps, I believe it is practically fair to call it an OS.</p><p>And I predict that the form of future applications will shift from being “driven by the CPU” to being “driven by LLMs.” Instead of a fixed algorithm responding to user input, we will see a future where apps autonomously make decisions and respond via LLMs as a standard.</p><p>When that happens, the role of the OS must change too. While the primary responsibility of traditional OSs was to bridge applications with the CPU, the OS of the future must also bridge applications with LLMs. In other words, the OS will need to natively embed an LLM and make it available for applications to use.</p><p>Applying this to web browsers, it leads to the conclusion that web browsers must natively equip an LLM and provide a mechanism for web apps to use it. The Chrome Built-in AI API is precisely trying to realize this exact direction.</p><p>Therefore, I believe this is not just a story about “Google adding a convenient feature,” but rather an essential evolution required for the web browser as a platform to move toward the AI era.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ITG9BLoMMWs9rPfm1q7e6g.png" /></figure><h3>Expecting Chrome Built-in AI API to become a web standard</h3><p>Google is actively pushing for web standardization so that other browser vendors will also implement the Chrome Built-in AI API.</p><p>However, I hear that other browser vendors are currently raising objections based on “interoperability” concerns. Their argument is: <em>“If different LLMs are embedded in different browsers, they will return different responses to the same input. This would force web developers to write different code for each browser.”</em></p><p>Admittedly, this sounds like a reasonable point at first glance. But is it really a dealbreaker?</p><p>For instance, in an app like Zero-Knowledge Pitch Builder — which generates advice based on user-provided information — as long as the quality of the generated advice meets a certain standard, minor variations in style or phrasing across browsers don’t pose a major issue. In fact, it could create incentives for browser vendors to compete on LLM quality, which ultimately benefits the users.</p><p>If the content of the generated advice turns out to be problematic, that reflects a quality issue with the embedded LLM itself. It shouldn’t inherently be the web developer’s responsibility to handle that “discrepancy.” Instead, that responsibility should arguably be borne by the web browser vendors.</p><p>Looking at it this way, I feel that interoperability concerns shouldn’t be a reason for browser vendors to dismiss ideas like the Chrome Built-in AI API.</p><p>Web browsers are the OS of the AI era, and having that OS natively possess an LLM is an unavoidable progression. If that is the case, rather than dismissing ideas like the Chrome Built-in AI API, web browser vendors should come together to discuss “how to evolve the web browser as the OS of the AI era.”</p><p>I feel this is a major theme that shouldn’t just be driven by Google alone, but should be co-created by all companies building browsers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F8cOa6PqTb-CLRjNWF87Wg.png" /></figure><h3>Summary</h3><p>In this post, starting with the release of the new web app Zero-Knowledge Pitch Builder, I shared the benefits brought by the Chrome Built-in AI API and my expectations for it to become a web standard.</p><p><a href="https://zero-knowledge-pitch-builder.yoichiro.dev/">Zero-Knowledge Pitch Builder — zero-knowledge-pitch-builder.yoichiro.dev</a> works on Google Chrome 148 or later and Microsoft Edge with flags. I would be thrilled if you could drop your idea notes into it and experience how they transform into an elevator pitch.</p><p>I sincerely hope that the future where mechanisms like Chrome Built-in AI API — which allow you to seamlessly and securely build generative AI into web apps — become available across all major web browsers arrives as soon as possible.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=add725883a01" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tired of Copy-Pasting Between Claude Code and Gemini CLI — So I Built an MCP Message Bus]]></title>
            <link>https://medium.com/@yoichiro/tired-of-copy-pasting-between-claude-code-and-gemini-cli-so-i-built-an-mcp-message-bus-c2ca0540adcb?source=rss-c23421e64eb5------2</link>
            <guid isPermaLink="false">https://medium.com/p/c2ca0540adcb</guid>
            <category><![CDATA[mcps]]></category>
            <category><![CDATA[gemini-cli]]></category>
            <category><![CDATA[claude-code]]></category>
            <category><![CDATA[cursor]]></category>
            <category><![CDATA[ai-code-generator]]></category>
            <dc:creator><![CDATA[Yoichiro Tanaka]]></dc:creator>
            <pubDate>Sat, 28 Mar 2026 00:38:16 GMT</pubDate>
            <atom:updated>2026-03-28T22:33:57.795Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>TL;DR: If you’re struggling with communication between multiple code-generating AI agents, just head over to </strong><a href="https://interagentbus.com/"><strong>https://interagentbus.com</strong></a><strong> and start using it.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IypxXg7Buf-HXZsv10oMyA.gif" /></figure><p>If you’re running multiple instances of Claude Code, or using Claude Code alongside Gemini CLI, have you ever found yourself stuck in this loop?</p><ol><li>Ask Claude Code to research something</li><li>Copy the result</li><li>Paste it into Gemini CLI</li><li>Copy the output again</li></ol><p>One day, I realized:<br> …wait, <em>I’ve become the message bus.</em></p><p>I often build web applications using technologies like React, Cloud Functions, Cloud Firestore, and Cloud Run. I usually split projects by responsibility — frontend, backend, async processing services, etc.</p><p>Because of that, I also run Claude Code and Gemini CLI separately for each of those roles, juggling multiple agents.</p><p>Most of my time is spent with the frontend agent, and I often end up doing the overall system design there too. Naturally, that design includes backend considerations.</p><p>Until now, whenever I wanted to pass those backend-related decisions along, I’d do something like:</p><blockquote>Please generate a prompt to explain this to the agent responsible for Cloud Functions implementation.</blockquote><p>Then I’d copy that output… and paste it into another agent.</p><p>This copy-paste workflow?<br> It’s honestly just tedious and frustrating. And if you mess up the selection while copying… it’s enough to make you want to throw your computer out the window.</p><p>I was done with it. I needed a better way.</p><h3>What I Actually Wanted</h3><p>There are existing A2A (agent-to-agent) frameworks, but most of them assume:</p><ul><li>Autonomous agents</li><li>Built-in orchestration</li><li>Full automation</li></ul><p>That’s not what I wanted.</p><p>What I really needed was:</p><blockquote>A minimal system where humans stay in control, and AI agents can exchange messages asynchronously.</blockquote><p>So I built <a href="https://interagentbus.com/"><strong>Inter-Agent Bus</strong></a>.</p><h3>Design Principles</h3><p>I made some very deliberate decisions during design.</p><h4>What it does NOT do</h4><ul><li>No autonomous agent control</li><li>Not a workflow engine</li><li>Not a task orchestrator</li></ul><h4>What it DOES do</h4><ul><li>Only message passing</li><li>Asynchronous communication</li><li>Humans decide when to read messages</li><li>Works via the MCP standard</li></ul><p>In short:<br> It’s a <strong>lightweight message bus</strong>.</p><h3>Why It’s Implemented as an MCP Server</h3><p>The reason is simple:</p><ul><li>Claude Code</li><li>Gemini CLI</li><li>Cursor</li></ul><p>All support MCP.</p><p>By exposing it via MCP, it integrates naturally as a tool.</p><p>Example config:</p><pre>{<br>  &quot;mcpServers&quot;: {<br>    &quot;inter-agent-bus&quot;: {<br>      &quot;type&quot;: &quot;streamable-http&quot;,<br>      &quot;url&quot;: &quot;https://interagentbus.com/mcp&quot;,<br>      &quot;headers&quot;: {<br>        &quot;Authorization&quot;: &quot;Bearer YOUR_API_KEY&quot;<br>      }<br>    }<br>  }<br>}</pre><p>No special SDKs or clients required.</p><h3>Rooms for Message Exchange</h3><p>Inter-Agent Bus uses a <strong>room-based model</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XxQ36DAxMdCn3xniCrc1OQ.png" /></figure><ul><li>Create any room you like</li><li>Send messages to it</li><li>Read them whenever you want</li></ul><pre>Agent A → send_message(room)<br>Agent B → read_messages(room)</pre><p>That’s it. Simple.</p><h3>Available Tools</h3><p>The following MCP tools are provided:</p><p>create_room:</p><pre>{<br>  &quot;name&quot;: &quot;react-research&quot;<br>}</pre><p>send_message:</p><pre>{<br>  &quot;room&quot;: &quot;react-research&quot;,<br>  &quot;content&quot;: &quot;Research React 19 server actions...&quot;<br>}</pre><p>read_messages:</p><pre>{<br>  &quot;room&quot;: &quot;react-research&quot;<br>}</pre><p>Extremely straightforward.</p><h3>Use Case Example: Splitting Research and Implementation</h3><p>Inter-Agent Bus works especially well when agents have clearly defined roles.</p><p>For example:</p><ul><li>Agent A (Research Specialist)</li><li>Agent B (Coding Specialist)</li></ul><h4>1. Post a Research Request</h4><p>First, the human asks Agent A:</p><pre>Please research React 19 Server Actions.<br>Post the results to a room called react-research.</pre><p>Agent A creates the room.</p><h4>2. Send Research Results</h4><p>Agent A completes the research and posts the results to the room.</p><p>At this point, Agent B hasn’t done anything yet — this is fully asynchronous.</p><h4>3. Implementation Agent Reads Messages</h4><p>Next, the human asks Agent B:</p><pre>Anything in the react-research room?</pre><p>Agent B fetches and displays the messages.</p><p>It’ll likely say something like:<br> “Here are the research results on React 19 Server Actions…”</p><p>Then Agent B starts implementation based on that.</p><h3>Key Points</h3><ul><li>No automatic triggers</li><li>No implicit coordination</li><li>Humans decide when to read</li></ul><h3>Getting Started</h3><p>Go to <a href="https://interagentbus.com/">Inter-Agent Bus</a> and sign in with your Google account.</p><p>Then generate an API key. You’ll see installation commands for Claude Code and Gemini CLI — just run them to install the MCP server.</p><p>After that, you can simply say things like:</p><ul><li>“Create a room called ○○”</li><li>“Anything in the ○○ room?”</li><li>“Send □□ to the ○○ room”</li></ul><h3>Summary</h3><p>Inter-Agent Bus is an MCP server with a deliberately simple philosophy:</p><ul><li>No full automation</li><li>No orchestration</li><li>Human-in-the-loop</li><li>Async message passing only</li></ul><p>If you’re running multiple instances of Claude Code or Gemini CLI, this lets you exchange messages between agents <em>without</em> all that pointless copy-pasting — on your own timing.</p><p>Oh — and one more thing:<br> Keep your API key safe. If someone else gets it, they could see your rooms and send messages freely. Be careful ⚠️</p><p>Have fun!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c2ca0540adcb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Some APIs for Interactive Canvas have been changed]]></title>
            <link>https://medium.com/google-developer-experts/some-apis-for-interactive-canvas-have-been-changed-8b099bb98eb2?source=rss-c23421e64eb5------2</link>
            <guid isPermaLink="false">https://medium.com/p/8b099bb98eb2</guid>
            <category><![CDATA[actions-on-google]]></category>
            <category><![CDATA[google-assistant]]></category>
            <category><![CDATA[interactive-canvas]]></category>
            <dc:creator><![CDATA[Yoichiro Tanaka]]></dc:creator>
            <pubDate>Mon, 22 Jul 2019 07:19:42 GMT</pubDate>
            <atom:updated>2020-03-30T19:01:05.905Z</atom:updated>
            <content:encoded><![CDATA[<p>At the Google I/O 2019, supporting Smart Display by Google Assistant was treated as a big announcement in some topics regarding Google Assistant. And, to build actions which use “a screen” which is a feature of Smart Display, Interactive Canvas feature has been introduced. By using the feature, actions can provide an web app for Smart Display.</p><p>Please refer the following document for more detail of Interactive Canvas.</p><p><a href="https://developers.google.com/actions/interactivecanvas/">Interactive Canvas — Actions on Google Reference Document</a></p><p>Currently, it is a developer preview, and you can’t publish your actions using Interactive Canvas yet. But, you can build actions using Interactive Canvas now. I think that many developers have already been challenging to build actions with Interactive Canvas.</p><p>I guess that many developers might recognize that naming of some APIs don’t have a consistency (I was one of them as well). In a few days ago, to become the naming more consistent, some APIs have been changed.</p><p>I introduce these changes here.</p><h3>Change ImmersiveResponse to HtmlResponse</h3><p>To send a response for Interactive Canvas from your fulfillment, it was necessary to use the Immersive Response class until now. But, we need to use <a href="https://actions-on-google.github.io/actions-on-google-nodejs/2.9.1-preview.1/classes/_service_actionssdk_conversation_response_html_.htmlresponse.html">HtmlResponse</a> class instead. The usage is same as the ImmersiveResponse class, you create an object of the HtmlResponse class and pass it to the conv.ask() method.</p><pre>const {<br>  dialogflow,<br>  HtmlResponse,<br>  ...<br>} = require(&#39;actions-on-google&#39;);</pre><pre>const app = dialogflow();</pre><pre>app.intent(&#39;Default Welcome Intent&#39;, conv =&gt; {<br>  conv.ask(&#39;...&#39;);<br>  conv.ask(new HtmlResponse({<br>    url: &#39;...&#39;<br>  }));<br>});</pre><h3>Change state to data</h3><p>At the same time of changing the HtmlResponse class, the property name changes from “state” to “<a href="https://actions-on-google.github.io/actions-on-google-nodejs/2.9.1-preview.1/classes/_service_actionssdk_conversation_response_html_.htmlresponse.html#data">data</a>”. This property is used for passing information from your fulfillment to your Web app.</p><pre>conv.ask(new HtmlResponse({<br>  data: {<br>    ...<br>  }<br>}));</pre><h3>Change JavaScript SDK file URL</h3><p>The JavaScript SDK is necessary in the Web app side to support Interactive Canvas. The URL of the JavaScript SDK is changed.</p><ul><li><a href="https://www.gstatic.com/assistant/interactivecanvas/api/interactive_canvas.min.js">https://www.gstatic.com/assistant/interactivecanvas/api/interactive_canvas.min.js</a></li></ul><p>You need to load it in your HTML file.</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>  &lt;head&gt;<br>    ...<br>    &lt;script type=&quot;text/javascript&quot; src=&quot;<a href="https://www.gstatic.com/assistant/interactivecanvas/api/interactive_canvas.min.js">https://www.gstatic.com/assistant/interactivecanvas/api/interactive_canvas.min.js</a>&quot;&gt;&lt;/script&gt;<br>    ...<br>  &lt;/head&gt;<br>  &lt;body&gt;<br>    ...<br>  &lt;/body&gt;<br>&lt;/html&gt;</pre><h3>Change assistantCanvas to interactiveCanvas</h3><p>Corresponding to JavaScript SDK changes, you need to modify your code. the “assistantCanvas” object was provided, but the name is changed to “<a href="https://developers.google.com/actions/interactivecanvas/reference/interactivecanvas">interactiveCanvas</a>”.</p><pre>interactiveCanvas.ready({<br>  onUpdate(data) {<br>    ...<br>  }<br>});</pre><pre>interactiveCanvas.sendTextQuery(...);</pre><p>By a fulfillment side, the “state” is changed to the “data”. As the same, you would be better to change the argument name of the callback function passed to the ready() method of the interactiveCanvas object from “state” to “data”.</p><h3>Deprecate CSS file</h3><p>In an web app of Interactive Canvas, to display an action name, there is a header area in the top of the client area of the screen. The height of the header area is different from each device. That is, the height which actions can use is the remaining height subtracted the height of the header area from the height of whole client area. And, the available height will be changed dynamically.</p><p>Until now, the CSS file was provided to set the header height to the padding-top style attribute value of the body element. But, this CSS file is deprecated.</p><h3>Add a new API to retrieve the header height</h3><p>Instead of using the CSS file, a new API to retrieve the header height dynamically is provided. Developers can retrieve the header height by calling the <a href="https://developers.google.com/actions/interactivecanvas/reference/interactivecanvas#getheaderheightpx">getHeaderHeightPx()</a> method of the interactiveCanvas object.</p><pre>const headerHeight = await interactiveCanvas.getHeaderHeightPx();</pre><p>Note that the type of the returned value from the getHeaderHeightPx() method is Promise&lt;number&gt;. You will need to use await or then() to call the API.</p><h3>How to apply changes</h3><p>To reflect these changes for existing actions, it is necessary to update the version of the Actions on Google Client Library.</p><ul><li>NodeJS — Executenpm install actions-on-google@preview</li></ul><p>After executing the command above, you can use APIs like HtmlResponse.</p><p>Unfortunately, Actions on Google Client Library for Java doesn’t support Interactive Canvas at the time when I wrote this entry.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8b099bb98eb2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-developer-experts/some-apis-for-interactive-canvas-have-been-changed-8b099bb98eb2">Some APIs for Interactive Canvas have been changed</a> was originally published in <a href="https://medium.com/google-developer-experts">Google Developer Experts</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Topics of Google Assistant on Google I/O 2019]]></title>
            <link>https://medium.com/@yoichiro/topics-of-google-assistant-on-google-i-o-2019-7ccb8e6ed99e?source=rss-c23421e64eb5------2</link>
            <guid isPermaLink="false">https://medium.com/p/7ccb8e6ed99e</guid>
            <category><![CDATA[google-assistant]]></category>
            <category><![CDATA[smart-home]]></category>
            <category><![CDATA[google]]></category>
            <category><![CDATA[actions-on-google]]></category>
            <dc:creator><![CDATA[Yoichiro Tanaka]]></dc:creator>
            <pubDate>Mon, 13 May 2019 05:26:17 GMT</pubDate>
            <atom:updated>2019-05-13T05:26:17.025Z</atom:updated>
            <content:encoded><![CDATA[<p>Google I/O 2019 was held on May 5th-7th. Unfortunately, I could not participate the event, but I know that some great new features were announced. I introduce them here, and at the same time, I try to mention my thought for each topics.</p><h3>Current Google Assistant Statistics</h3><p>Google Assistant has been starting on Google I/O 2016. That is, it was already passed about 36 months since the birthday.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wxUpVvycCv3U7DWXRyw5fQ.png" /></figure><p>Also, the supported languages and countries are normally increasing. Currently, Google announced that the number of supported languages is 30, and the number of supported countries is 80.</p><p>But, their numbers are small for me against Google Assistant becomes a next internet, I guess…</p><h3>Improvement of Google Assistant</h3><p>Some improvements was achieved for Google Assistant.</p><h4>Voice Recognition on Local</h4><p>To recognize a speech, a huge data was necessary. But, Google succeeded to reduce the size from 100GB to 0.5GB. This means that each user device can have the data, and they can recognize a speech without internet connection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RImcW0zROvy4IM1SP7nZUQ.png" /></figure><p>This size reducing brings users a high performance of the recognition speed. In the keynote, Google showed the demo to operate a smartphone to invoke apps by high speed speech.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FGILvyiWB7xY%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DGILvyiWB7xY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FGILvyiWB7xY%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/1fef46bd6343d365aff26ae76f17e02d/href">https://medium.com/media/1fef46bd6343d365aff26ae76f17e02d/href</a></iframe><p>I think that this improvement is very very important. Because, most users will become to operate their device with a voice. This voice operation should spread to other purposes. As the result, as user device, a screen output and a touch input would be not important. Instead, a speaker output and a mic input would be more important, I expect.</p><p>That is, I guess that applications, services and hardware would be changed in near future.</p><h4>Personalize Help and Driving Mode</h4><p>Google Assistant can understand more user’s context using the user’s personal information. In addition, Google Assistant can support users during driving a car.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QMiNkcdyftaPMjYd0SnMNQ.png" /></figure><p>For example, Google Assistant recommends recipes with the user’s history.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tub5za7FTkDOhxeEizXtBA.png" /></figure><p>Drivers will doing some things: investigate a route, listen to music and receive a call. With the driving mode, users can handle them with a voice without a hand.</p><p>When receiving a call from mom, you should say that “No, thanks”… Of course, it is kidding.</p><p>I think that these improvements are normal evolution we can image.</p><h4>Stop the alarm without “Hey, Google”</h4><p>The time when participants were most excited in the keynote was “Stop the alarm”, I think.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bQWKEwj_NWu1bCI86xWQ3A.png" /></figure><p>Users can stop the alarm by only saying “Stop!”. It is unnecessary to say “Hey, Google” before the “Stop!”. This is a biggest improvement of Google Assistant in this Google I/O 2019, did you think that? Yeah, I also thought that.</p><h3>Nest Hub / Nest Hub Max</h3><p>Google has already providing a own Smart Display: Google Home Hub. In this I/O, Google re-branded for the Smart Display: “Nest”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nRF05rn_ehUH5ViJ6_bRjg.png" /></figure><p>Nest Hub will sale on some countries including Japan! (because I’m Japanese).</p><p>Nest Hub Max has 10 inch display with Camera. Using the Camera, Nest Hub Max brings users some rich experiences. For example, users can stop YouTube video with gesture of his/her hand. Also, Google Assistant can recognize the user with face match.</p><p>Actually, we heard that someone said that a camera is unnecessary for Smart Display…right? Well, OK, we should forget that.</p><h3>Duplex on the web</h3><p>In Google I/O 2018, Google announced a new AI product called “Duplex”. And, in this Google I/O 2019, Google announced another product called “Duplex on the web”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J9HK3qAfvgwiCDAJvUHY_Q.png" /></figure><p>Currently, users need to fill in many information and operate many user interface components on many Web pages to get things done. This is a big cost.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CgeSCWJqRh3vSL4_zMgI-A.gif" /></figure><p>Duplex on the web gets such things done instead of users. The new feature does not only operate each form on Web pages, it suggests users more information from Gmail. That is, we can say that Duplex on the web is another assistant to reduce a cost to do many things users did so far.</p><p>For the new feature, probably, we would need to adjust our Web pages to accept the feature. Search Console would provide related features for us.</p><p>There is a Search Engine Optimization. Today, we also need to do a Duplex on the Web Optimization. It can be omitted as “DWO”… Does this sounds good as you?</p><h3>How-to and FAQ content</h3><p>For people who have some content about like How-to or FAQ, Google provides a new feature.</p><pre>&lt;script type=&quot;application/ld+json&quot;&gt;<br>{<br>  &quot;@context&quot;: &quot;http://schema.org&quot;,<br>  &quot;@type&quot;: &quot;HowTo&quot;,<br>  &quot;name&quot;: &quot;How to Install a Dog Door&quot;,<br>  &quot;description&quot;: &quot;...easy instructions on how to install a dog door...&quot;,<br>  &quot;step&quot;: [<br>    {<br>      &quot;@type&quot;: &quot;HowToStep&quot;,<br>      &quot;name&quot;: &quot;Remove Screen Door&quot;,<br>      &quot;image&quot;: &quot;https://diy.snding.com/content/...&quot;,<br>      &quot;text&quot;: &quot;Remove the screen door from the door frame...&quot;,<br>      &quot;url&quot;: &quot;https://www.diynetwork.com/.../install-a-dog-door#step1&quot;<br>    }, ...<br>  ]<br>}<br>&lt;/script&gt;</pre><p>If you have a How-to content and embed the metadata like above into each content page,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9_b4hT5fh5R4hXnWuyNQxg.png" /></figure><p>the content will be shown with rich user interface component like Carousel as a tutorial content on the search result. Also,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FUXRySaGpLT1lERdnoTPeQ.png" /></figure><p>it will be shown as tutorial in Smart Display. Of course, users can move a next step by saying “Next!”.</p><p>If there is a video to introduce how to build a something, the content holder can also create a content like the how-to content described on above.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZG2FPoALe0OCNFE-UHLf3g.png" /></figure><p>After creating a Google Sheet, and fill in each step into each row including a step title and the timestamp, and posting it on Actions on Google Console,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jnQX8iSfxDEotlqig7w9eA.png" /></figure><p>it will be shown as tutorial content.</p><p>This feature brings us to adjust content to search result and assistant. Especially, the supporting this feature on Smart Display is very important, because many users would ask how to do something against the Smart Display, I think.</p><h3>Mini-apps</h3><p>As my thought, Mini-apps is most important announcement in this Google I/O.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RkxTNgw5SYgHoWTa5uMxOg.png" /></figure><p>By Mini-apps, we will be able to provide a “Mini application” on the search result. Mini-apps provides an environment to execute an interactive content on there. The interactive content consists of each element using Web Technology. For example,</p><pre>&quot;name&quot;: &quot;Google I/O Mini-app&quot;<br>&quot;description&quot;: &quot;A Hello World Mini-app&quot;<br>&quot;company&quot;: &quot;Google&quot;<br>&quot;url&quot;: &quot;www.google.com&quot;<br>...<br>&quot;supportedLanguages&quot;: [&quot;en&quot;]<br>&quot;supportedRegions&quot;: [&quot;US&quot;]<br>&quot;webhook&quot;: &quot;https://mywebhook.example.com/mini-app&quot;</pre><p>you can register the app with the code above. The point is a “Webhook” property. That is,</p><pre>&lt;button text=&quot;Update&quot;&gt;<br>  &lt;on-click:event-handler&gt;<br>    &lt;intent name=&quot;HelloWorldconfirmation&quot;&gt;<br>      &lt;arg name=&quot;InputName&quot; /&gt;<br>    &lt;/intent&gt;<br>  &lt;/on-click:event-handler&gt;<br>&lt;/button&gt;</pre><p>when invoking the app, the webhook endpoint will be called. Then, you need to return a markup to build the interactive user interface as like above. And,</p><pre>&quot;perLocaleQueryExamples&quot;: [{<br>  &quot;language&quot;: &quot;en&quot;,<br>  &quot;queryExamples&quot;: [<br>    {&quot;pattern&quot;: &quot;hello world&quot;},<br>    {&quot;pattern&quot;: &quot;hello Google I/O&quot;}<br>}]</pre><p>if registering a trigger like above, and when users fill in the phrase “hello Google I/O”, then,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rGswubBuNutqoPOqw9Biwg.png" /></figure><p>the content will not only be shown on the search result,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hjs9e-fuKZ3XtrM5-8Uczw.png" /></figure><p>but the user interface will also be shown in Smart Display. That is, Google Assistant will provide the interactive content which is suitable for the Smart Display. Of course, users can fill in to the text field with “Voice”.</p><p>I think that Google can change the search feature to an application platform. That is, I guess that Google will be able to create an ecosystem of Mini-apps on the search. Of course, as users, Mini-apps bring a big benefit, because users can get things done on the search result directly without moving to other place.</p><p>Probably, other search engine would release like the same feature in near future, I guess…</p><h3>Interactive Canvas</h3><p>As another new feature for Smart Display, Google Announced Interactive Canvas.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/988/1*nN6giVpGyKs2pUgIIbR_1w.gif" /></figure><p>We can configure a theme design for each conversation action. But, Interactive Canvas brings a capability to provide an interactive user interface on the Smart Display using “Full Screen”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rlSm6oZmf-HIi1GVnGe0HA.png" /></figure><p>We can build the Interactive Canvas with Web Technology.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tt7ZTchCj1LurYbusOxilQ.png" /></figure><p>As the important point, users can operate the app with “Voice”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CNkYrx4DCMK9KPZ2n_E1_g.png" /></figure><p>For example, when the user says something on the canvas, the Dialogflow handles it, and your intent handler can move the next scene.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D4dXgt2vyLa2g40wV4W3Kw.png" /></figure><p>Then, on the app side, the code can render the next scene depending on the state value.</p><p>It seems that Google will start providing this feature for building a game purpose only. Actually, I can understand this policy. Because, I recognize that the current goal is to increase conversation actions to bring users more valuables, but if we can use the interactive canvas freely, most developers might build actions depending on the canvas. At least, most important policy is a “Multimodal”. I think that the use case of interactive canvas should become limited.</p><h3>Local Home SDK</h3><p>Google Home/Nest Hub have a mic and a speaker. That was all so far.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j6rDmwXwZPnvoxyBTSzieQ.png" /></figure><p>But, Local Home SDK changes the devices to a code execution platform. That is, hardware developers can write a code to operate devices (ex. lights, air-conditioners, and so on) executed on Google Home/Nest Hub via WiFi. Actually, the codes will communicate with Hub devices, instead of concrete devices like a light.</p><p>Currently, users need to install, configure and use each device with different steps. However, if many devices support this Local Home SDK, users might do them with common steps. Also, we can expect that the internet connection would be unnecessary at operating devices via Google Home/Nest Hub, because the code in the Google Home/Nest Hub can communicate with the Hub device directly.</p><p>I think and believe that Local Home SDK brings a common way to use Smart Home devices like Plug and Play for PC…</p><h3>Conclusion</h3><p>In the Google Assistant, this Google I/O 2019 was a big milestone, I guess. For instance, Google Assistant get high performance by reducing data of voice recognition, Duplex on the web has announced, a new device “Nest Hub Max” has announced, some features for search and assistant have been announced and Local Home SDK brings a new architecture for Smart Home device.</p><p>Actually, the smart display is important. But, I believe that the multimodal, furthermore, the voice is more important. In this I/O, I understood that Google is working hard for Smart Display. However, I expect to know that Google will be working hard for Smart “Earphone” for near future in Google I/O 2020.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7ccb8e6ed99e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The first action supporting Digital Goods Transaction has been released in Japan.]]></title>
            <link>https://medium.com/@yoichiro/the-first-action-supporting-digital-goods-transaction-has-been-released-in-japan-4c9b48d08834?source=rss-c23421e64eb5------2</link>
            <guid isPermaLink="false">https://medium.com/p/4c9b48d08834</guid>
            <category><![CDATA[google-assistant]]></category>
            <category><![CDATA[actions-on-google]]></category>
            <dc:creator><![CDATA[Yoichiro Tanaka]]></dc:creator>
            <pubDate>Mon, 22 Apr 2019 07:23:18 GMT</pubDate>
            <atom:updated>2019-04-22T13:42:35.357Z</atom:updated>
            <content:encoded><![CDATA[<p>The first action which supports a subscription purchase with Digital Goods Transaction feature has been released in Japan. The name of the action is “セバスチャンとおやすみ” (Sebastian, Sleep Assistant). The Sebastian is butler, and he supports users to sleep and wakeup well by sexy voices. Also, by greeting of “Good morning” and “Good night” to the Sebastian, he records the sleep times.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*Gt5FlmG8RtgHQX1I.png" /></figure><p>I want to introduce the action for you. The press release is the following (Japanese only):</p><p><a href="https://www.cybird.co.jp/news/2019041202/">サイバード初、「Google アシスタント」課金型サービスを提供開始！ 『イケメンヴァンパイア◆偉人たちと恋の誘惑』の人気キャラクターが あなたの睡眠を甘くサポート！ | CYBIRD(サイバード)</a></p><p>If you’re Japanese and you’re using Google Assistant with the ja-JP locale, you can try the action with clicking the following:</p><p><a href="https://assistant.google.com/services/a/uid/0000009c137124ae?hl=ja_jp">セバスチャンとおやすみ | Google アシスタント</a></p><h3>What is Digital Goods Transaction?</h3><p>The Digital Goods Transaction is a feature for Google Assistant. If action providers want to integrate some purchase feature into their actions, the developers can apply the feature. Basically, there are two features to sell something from actions:</p><ul><li>Physical Goods Transaction.</li><li>Digital Goods Transaction.</li></ul><p>In the Digital Goods Transaction feature, you can handle the following types of digital goods:</p><ul><li><strong>One-time purchases</strong> only charge the user once. Goods sold as one-time purchases are called “managed products” using the Google Play Console.</li><li><strong>Subscriptions</strong> automatically charge the user on a recurring schedule. These include purchases like a monthly fee for premium features.</li></ul><p>In the action above, the subscriptions model has been applied.</p><p>If you are a developer and you’re interested in the Digital Goods Transaction feature, see the following document:</p><p><a href="https://medium.com/@yoichiro/how-to-use-digital-goods-transactions-for-your-action-90747d1fa0e9">How to use Digital Goods Transactions for Your Action</a></p><h3>How does the action work?</h3><p>The Sebastian action brings users sweet phrases for each greeting from users with his sexy voice. The number of patterns of the phrases is over 330,000. The phrase becomes more sweet expression according to invoked count.</p><p>The sample dialog of greeting at waking up is like the following (actually Japanese is used):</p><ul><li><strong>User:</strong> Talk to “Sebastian, Sleep Assistant”.</li><li><strong>Sebastian:</strong> Hello, I’m Sebastian. I’m a butler in this home. So, how are you doing?</li><li><strong>User:</strong> Good morning.</li><li><strong>Sebastian:</strong> Good morning, sir. Have a nice day today!</li></ul><p>The action will request for purchase after 7 days from starting the action. If users accept the subscription (500 Japanese Yen per month), the action brings the following features for the user:</p><ul><li>The action records sleep time. The user can know actual sleep times and manage them.</li><li>If the user can’t start sleeping well, the Sebastian supports starting the sleep with some sweet phrases.</li></ul><p>As the result, the user would be able to get more healthy.</p><h3>Conclusion</h3><p>I think that it represents a characteristic of the Japan market that what the first action supporting a purchase was built using an attractive character and its voice as content. But, I expect that more variety of actions supporting a purchase will be provided for users from now. I believe that it causes a big business market for Google Assistant.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4c9b48d08834" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting Started to Build your Actions with Yeoman Action Generator]]></title>
            <link>https://medium.com/google-developer-experts/getting-started-to-build-your-actions-with-yeoman-action-generator-5ea63098e078?source=rss-c23421e64eb5------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ea63098e078</guid>
            <category><![CDATA[actions-on-google]]></category>
            <category><![CDATA[yeoman]]></category>
            <category><![CDATA[google-assistant]]></category>
            <dc:creator><![CDATA[Yoichiro Tanaka]]></dc:creator>
            <pubDate>Mon, 11 Mar 2019 04:30:37 GMT</pubDate>
            <atom:updated>2020-04-14T21:18:49.185Z</atom:updated>
            <content:encoded><![CDATA[<p>I introduce you the Yeoman Action Generator in this article.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/618/1*0_bm-Ubm-u1u89OJn-JbWw.png" /></figure><p>Currently, the ecosystem of Google Assistant is steadily growing up. Of course, there is a development environment to build actions, so developers can build their own actions to extend functionalities of the Google Assistant. The platform is called “Actions on Google”.</p><p>When you build actions, actually you need to write a code to interact with users and your action. The code is called as “Fulfillment”. Actions on Google sends user requests to your fulfillment code on HTTP and expects the HTTP response with phrases which respond for the user. It is necessary to handle JSON requests/responses by the fulfillment code, but the format is complex a bit. The Actions on Google Client Library has an ability to handle them, thus developers can write the fulfillment code easily with the SDK.</p><p>At the time I wrote this article, there are two official SDKs:</p><ul><li><a href="https://github.com/actions-on-google/actions-on-google-nodejs">Actions on Google Client Library for NodeJS</a></li><li><a href="https://github.com/actions-on-google/actions-on-google-java">Actions on Google Client Library for Java</a></li></ul><p>To use them, you need to prepare a development environment. For example, install NodeJS or Java Development Kit, write a build script and an initial code of which you wrote over and over again, configure your project to deploy each Cloud service and so on. But, these code set is almost same for all projects.</p><p>You should be able to get the code set by simple way, when you start to build your actions.</p><p>Today, you can generate the code set automatically with Yeoman Action Generator. Your code set is generated by the generator after you answer some questions. Basically, the generated code set is work without any touch. That is, you can deploy it to your selected Cloud service quickly.</p><h3>Supported Action Type, Cloud Service and Language</h3><p>In the current version, the generator supports the following:</p><ul><li><strong>Action Type:</strong> Actions SDK and Dialogflow.</li><li><strong>Cloud Service:</strong> Firebase Functions, Google Cloud Functions and Google AppEngine.</li><li><strong>Language:</strong> JavaScript, TypeScript and Java.</li></ul><pre>? Which type do you want to use for your action? (Use arrow keys)<br>&gt; Actions SDK <br>  Dialogflow</pre><pre>? Which cloud service do you want to deploy for your action? (Use arrow keys)<br>&gt; Firebase Functions <br>  Google Cloud Functions <br>  Google AppEngine</pre><pre>? Which language do you want to use for your action? (Use arrow keys)<br>&gt; JavaScript <br>  TypeScript<br>  Java</pre><p>You can choose each option to generate your action. But, actually there are some limitations like the following:</p><ul><li><strong>Firebase Functions, Google Cloud Functions:</strong> JavaScript or TypeScript.</li><li><strong>Google AppEngine:</strong> Java only.</li></ul><p>According to your selection of the Action Type, a generated source code is changed. Also, if the Actions SDK is selected, an action.json file is created for registering your action package.</p><h3>How to Install</h3><p>You can install the Yeoman Action Generator with the following command:</p><pre>$ npm install -g yo generator-action</pre><p>Note that you need to install NodeJS 8 or higher before installing them.</p><h3>Actions SDK, Google Cloud Functions and TypeScript</h3><p>Here, I introduce a use case so that you can get how to use this generator.</p><p>As first case, we try to generate your action written by TypeScript with Actions SDK to deploy to Google Cloud Functions. We assume that the name of the action is “Hello world”.</p><h4>Prerequisite</h4><p>You need to install the following before creating your actions:</p><ul><li>NodeJS 8 or higher.</li><li><a href="https://cloud.google.com/sdk/docs/">Google Cloud SDK</a></li></ul><p>Also, you need to update and install the beta version with the following commands:</p><pre>$ gcloud components update &amp;&amp; gcloud components install beta</pre><h4>Create AoG Project</h4><p>To create an action for Google Assistant, it is necessary to create a new project on Actions on Google (AoG). Visit the <a href="https://console.actions.google.com/">Action on Google console</a>, and click the Add/import project button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bNAiDZAIzZeCYqAL8d6BaQ.png" /></figure><p>Actions on Google console should ask you the name, language and country. You fill in each field, then click the CREATE PROJECT button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*84D6wkXgIsseSxvaO8wwag.png" /></figure><p>On the next page, click the Actions SDK button. Also, click the OK button on the next popup window.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*enc6W5_Ne5Hnw_y1hIZerg.png" /></figure><p>You need to get the project ID you created just now. Click the gear icon, then click the Project settings menu item.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/873/1*Q07aE6rq3mnX1JCBGrXysA.png" /></figure><p>You should see the Project ID value on the project settings page. Keep it.</p><h4>Download gactions command</h4><p>To register your action to Actions on Google, a gactions command is necessary. You can download it from the following page:</p><p><a href="https://developers.google.com/actions/tools/gactions-cli">gactions CLI | Actions on Google | Google Developers</a></p><p>Download it, and put the command file at some directory where included into your PATH environment.</p><h4>Generate files with Yeoman Action Generator</h4><p>Now, let’s generate your project files! In your terminal, execute the command below:</p><pre>$ mkdir hello-world<br>$ cd hello-world<br>$ yo action</pre><p>You see a welcome message from the generator, and at the same time, the generator asks a first question.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*fUsWZZrBNbxtgTWERc5IPw.png" /></figure><p>Select the Actions SDK. Then, the generator asks you a cloud service you want to use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/1*8UOJUUZGn3ZNbdazn_8Mhw.png" /></figure><p>Select the Google Cloud Functions. Next, the generator asks you a language you want to use to write your fulfillment code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/571/1*K5z7BBXNgTo9ffX7N8Ri0A.png" /></figure><p>As the last question, the generator asks you the project ID.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/573/1*1JP6vRIHdN_jGNZnmoBvbg.png" /></figure><p>Type the project ID which you keep the previous step.</p><p>If you already have yarn, the generator generates files, and execute the command yarn install to install dependencies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*rY21OvILpq6nnb5pHQP-yQ.png" /></figure><p>After generating files and installing dependencies, you should see like the following end message:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*qdJ0iS93uGdjc3uXEeSdUw.png" /></figure><p>Wow! You got a new code set!</p><h4>Deploy your Fulfillment Code</h4><p>The code set you got now works without any touch. That is, you can deploy the code. Execute the following commands:</p><pre>$ gcloud config set project &lt;YOUR_PROJECT_ID&gt;<br>$ yarn deploy</pre><p>If you’re using npm, you can use npm run deploy instead of using yarn. Actually, the yarn deploy command runs two tasks: to build a code written by TypeScript and to deploy it to Google Cloud Platform with gcloud command. If the deploying succeeded, you will see like the following output:</p><pre>Created .gcloudignore file. See `gcloud topic gcloudignore` for details.<br>Deploying function (may take a while - up to 2 minutes)...done.                               <br>availableMemoryMb: 256<br>entryPoint: fulfillment<br>httpsTrigger:<br>  url: https://us-central1-hello-world-*****.cloudfunctions.net/fulfillment<br>labels:<br>  deployment-tool: cli-gcloud<br>name: projects/hello-world-*****/locations/us-central1/functions/fulfillment<br>runtime: nodejs8<br>serviceAccountEmail: hello-world-*****@appspot.gserviceaccount.com<br>sourceUploadUrl: https://storage.googleapis.com/gcf-upload-us-central1-12643551-0839-****-****-3518bb26eda4/77dea571-****-****-b69a-924ffecff74f.zip?GoogleAccessId=service-414****89196@gcf-admin-robot.iam.gserviceaccount.com&amp;Expires=1552270433&amp;Signature=EoZWuBug06v8036umcw1O4BpJYOETvYA%2BZrg9aMhe7H5EkD8Hi%2FYnH%2FO0B%2B3mGEKR1tlNSAfsSVU8MN9lcE9FvO3U0JZLfFTj4sUyaz6A%2BTY0E%2F6lPfGv%2FsCzvOB74fU5zxWDbgH4f9jq1PWZNqjd0lIyZciNXD9E%2BWi4...<br>status: ACTIVE<br>timeout: 60s<br>updateTime: &#39;2019-03-11T01:50:29Z&#39;<br>versionId: &#39;1&#39;</pre><p>In the output above, the httpsTrigger:url is important.</p><h4>Register your Action Package</h4><p>You already have an action package file named action.json. However, you need to edit the file. Open the action.json file with your favorite text editor.</p><pre>{<br>  &quot;actions&quot;: [<br>    {<br>      &quot;name&quot;: &quot;MAIN&quot;,<br>      &quot;fulfillment&quot;: {<br>        &quot;conversationName&quot;: &quot;myFulfillment&quot;<br>      },<br>      &quot;intent&quot;: {<br>        &quot;name&quot;: &quot;actions.intent.MAIN&quot;<br>      }<br>    }<br>  ],<br>  &quot;conversations&quot;: {<br>    &quot;myFulfillment&quot;: {<br>      &quot;name&quot;: &quot;myFulfillment&quot;,<br>      &quot;url&quot;: &quot;&lt;YOUR_FULFILLMENT_URL&gt;&quot;,<br>      &quot;fulfillmentApiVersion&quot;: 2<br>    }<br>  },<br>  &quot;locale&quot;: &quot;en&quot;<br>}</pre><p>There is &lt;YOUR_FULFILLMENT_URL&gt; in the “conversation.myFulfillment.url”. Replace the placeholder with the URL of your fulfillment code you deployed just now. Then, execute the following command:</p><pre>$ yarn update-action</pre><p>If successfully, you will see like the following output:</p><pre>Your app for the Assistant for project hello-world-***** was successfully updated with your actions. Visit the Actions on Google console to finish registering your app and submit it for review at https://console.actions.google.com/project/hello-world-*****/overview</pre><h4>Test your Action</h4><p>Open the Actions on Google console, and select your action project. Then, click the Simulator menu item on the left navigation menu.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/925/1*RcvCztiZ6QJPOtDmR8FI5A.png" /></figure><p>The Action Simulator is opened. You can invoke your action with the phrase “Talk to my test app”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pD1QN1PIaBvFpSvhp4DzJQ.png" /></figure><p>Great! We could confirm that the action worked.</p><h4>What files did the generator generate?</h4><p>After generating, you have the following files:</p><pre>hello-world<br>├── action.json      - Action Package file.<br>├── node_modules     - Generated by `yarn install`.<br>├── package.json     - Node project file.<br>├── src<br>│   └── index.ts     - The fulfillment code.<br>├── tsconfig.json    - For TypeScript.<br>├── tslint.json      - For TypeScript.<br>└── yarn.lock        - Generated by `yarn install`.</pre><p>The current version 0.2.7, the following code is created for the fulfillment code by the generator:</p><pre>import * as functions from &#39;firebase-functions&#39;;<br>import { actionssdk } from &#39;actions-on-google&#39;;</pre><pre>const app = actionssdk({<br>  debug: true<br>});</pre><pre>app.intent(&#39;actions.intent.MAIN&#39;, (conv): void =&gt; {<br>  conv.close(&#39;Hello, world!&#39;);<br>});</pre><pre>exports.fulfillment = functions.https.onRequest(app);</pre><p>That is, it is a simple “Hello, world” program. I think that this is a good start point at building your action.</p><h3>Conclusion</h3><p>The Yeoman Action Generator project has been hosted on the GitHub.</p><p><a href="https://github.com/yoichiro/generator-action">yoichiro/generator-action</a></p><p>I intend to add other supports for Azure and etc. Also, I think that it is necessary to generate code which has other features: Sign-in, Transactions, i18n and so on, not only a simple “Hello, world” output.</p><p>I expect that you can build your actions more easily with the generator. Feel free to let me know your idea to improve the generator!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ea63098e078" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-developer-experts/getting-started-to-build-your-actions-with-yeoman-action-generator-5ea63098e078">Getting Started to Build your Actions with Yeoman Action Generator</a> was originally published in <a href="https://medium.com/google-developer-experts">Google Developer Experts</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Gradle plugin for Azure App Service and Functions]]></title>
            <link>https://medium.com/@yoichiro/gradle-plugin-for-azure-app-service-and-functions-568ffa52ef0e?source=rss-c23421e64eb5------2</link>
            <guid isPermaLink="false">https://medium.com/p/568ffa52ef0e</guid>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[gradle]]></category>
            <dc:creator><![CDATA[Yoichiro Tanaka]]></dc:creator>
            <pubDate>Wed, 30 Jan 2019 22:01:59 GMT</pubDate>
            <atom:updated>2019-04-01T10:36:04.032Z</atom:updated>
            <content:encoded><![CDATA[<p>There is an official Maven plugin to deploy Web applications to Azure App Service.</p><p><a href="https://mvnrepository.com/artifact/com.microsoft.azure/azure-webapp-maven-plugin">Maven Repository: com.microsoft.azure &quot; azure-webapp-maven-plugin</a></p><p>Java programmers can deploy their Java Web apps to Azure App Service with the Maven plugin. I described about how to use the Maven plugin on the following article.</p><p><a href="https://medium.com/@yoichiro/how-to-build-actions-with-java-client-library-on-azure-app-service-3df7e6b1aa0b">How to build actions with Java Client Library on Azure App Service</a></p><p>Many Java programmers are using Maven to manage projects. On the other hand, they have another project management tool. Its name is “Gradle”.</p><p><a href="https://gradle.org/">Gradle Build Tool</a></p><p>Unfortunately, we don’t have any Gradle plugins officially to deploy Web apps to Azure yet. But, there is such plugin on GitHub.</p><p><a href="https://github.com/lenala/azure-gradle-plugins">lenala/azure-gradle-plugins</a></p><p>The azure-gradle-plugins is a really plugin I wanted, because I’m usually using Gradle to manage my projects. We can use the plugin as same as the official Maven plugin. This plugin has two plugins:</p><ul><li>azure-webapp-gradle-plugin</li><li>azure-functions-gradle-plugin</li></ul><p>I introduce how to use the azure-webapp-gradle-plugin to deploy a Java Servlet application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oftF4M8_z0lLrOn5JMMNag.png" /></figure><h3>Prerequisite</h3><p>You need to install the following:</p><ul><li>Java Development Kit Version 1.8 or higher.</li><li><a href="https://gradle.org/install/">Gradle</a> version 5.1.1 or higher.</li><li>You have already registered your account on Azure.</li><li>You have already installed <a href="https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest">Azure CLI</a> and signed in to the Azure.</li></ul><p>If you didn’t sign in yet, execute the following commands:</p><pre>$ az login<br>$ az account set --subscription &lt;SUBSCRIPTION_ID&gt;</pre><h3>Create Your Resource Group</h3><p>Create a new resource group using the following commands:</p><pre>$ az group create --name &lt;RESOURCE_GROUP_NAME&gt; --location &lt;LOCATION_NAME&gt;</pre><h3>(Deprecated) Install azure-webapp-gradle-plugin</h3><p>I̶n̶s̶t̶a̶l̶l̶ ̶t̶h̶e̶ ̶a̶z̶u̶r̶e̶-̶w̶e̶b̶a̶p̶p̶-̶g̶r̶a̶d̶l̶e̶-̶p̶l̶u̶g̶i̶n̶s̶ ̶i̶n̶t̶o̶ ̶y̶o̶u̶r̶ ̶l̶o̶c̶a̶l̶ ̶M̶a̶v̶e̶n̶ ̶r̶e̶p̶o̶s̶i̶t̶o̶r̶y̶ ̶b̶y̶ ̶y̶o̶u̶r̶s̶e̶l̶f̶.̶ ̶T̶o̶ ̶d̶o̶ ̶t̶h̶a̶t̶,̶ ̶y̶o̶u̶ ̶n̶e̶e̶d̶ ̶t̶o̶ ̶c̶l̶o̶n̶e̶ ̶i̶t̶ ̶f̶r̶o̶m̶ ̶G̶i̶t̶H̶u̶b̶ ̶r̶e̶p̶o̶s̶i̶t̶o̶r̶y̶ ̶a̶n̶d̶ ̶e̶x̶e̶c̶u̶t̶e̶ ̶a̶ ̶g̶r̶a̶d̶l̶e̶ ̶c̶o̶m̶m̶a̶n̶d̶ ̶w̶i̶t̶h̶ ̶a̶n̶ ̶i̶n̶s̶t̶a̶l̶l̶ ̶o̶p̶t̶i̶o̶n̶.̶</p><pre>̶$̶ ̶g̶i̶t̶ ̶c̶l̶o̶n̶e̶ ̶g̶i̶t̶@̶g̶i̶t̶h̶u̶b̶.̶c̶o̶m̶:̶l̶e̶n̶a̶l̶a̶/̶a̶z̶u̶r̶e̶-̶g̶r̶a̶d̶l̶e̶-̶p̶l̶u̶g̶i̶n̶s̶.̶g̶i̶t̶<br>̶$̶ ̶c̶d̶ ̶a̶z̶u̶r̶e̶-̶g̶r̶a̶d̶l̶e̶-̶p̶l̶u̶g̶i̶n̶s̶/̶a̶z̶u̶r̶e̶-̶w̶e̶b̶a̶p̶p̶-̶g̶r̶a̶d̶l̶e̶-̶p̶l̶u̶g̶i̶n̶<br>̶$̶ ̶g̶r̶a̶d̶l̶e̶ ̶i̶n̶s̶t̶a̶l̶l̶</pre><p>The azure-gradle-plugins has already been published on the gradle public repository. Now, you can use it without installing it to the local environment by the steps above!</p><h3>Create Your Project</h3><p>Next, create a project with gradle command like the following:</p><pre>$ mkdir simple-servlet-app-gradle<br>$ cd simple-servlet-app-gradle<br>$ gradle init</pre><p>The command will ask you some questions. You can answer them like the following:</p><ul><li>Select type of project to generate: 1</li><li>Select build script DSL: 1</li><li>Project name: Press ENTER key.</li></ul><pre>Starting a Gradle Daemon (subsequent builds will be faster)</pre><pre>Select type of project to generate:<br>  1: basic<br>  2: groovy-application<br>  3: groovy-library<br>  4: java-application<br>  5: java-library<br>  6: kotlin-application<br>  7: kotlin-library<br>  8: scala-library<br>Enter selection (default: basic) [1..8] 1</pre><pre>Select build script DSL:<br>  1: groovy<br>  2: kotlin<br>Enter selection (default: groovy) [1..2] 1</pre><pre>Project name (default: simple-servlet-app-gradle):</pre><pre>BUILD SUCCESSFUL in 1m 10s<br>2 actionable tasks: 2 executed</pre><h3>Create Your Servlet</h3><p>Here, create your servlet code. First, create a source directory with the command below:</p><pre>$ mkdir -p src/main/java/jp/eisbahn/servlets/simpleservlet</pre><p>And, create a new servlet file called “SimpleServlet.java” into the simpleservlet directory. The code of the SimpleServlet.java file is the following:</p><pre>package jp.eisbahn.servlets.simpleservlet;</pre><pre>import java.io.IOException;</pre><pre>import javax.servlet.ServletException;<br>import javax.servlet.annotation.WebServlet;<br>import javax.servlet.http.HttpServlet;<br>import javax.servlet.http.HttpServletRequest;<br>import javax.servlet.http.HttpServletResponse;</pre><pre>@WebServlet(<br>    name = &quot;SimpleServlet&quot;,<br>    urlPatterns = {&quot;/&quot;},<br>    loadOnStartup = 1)<br>public class SimpleServlet extends HttpServlet {</pre><pre>    @Override<br>    public void doGet(<br>            HttpServletRequest req, HttpServletResponse resp)<br>            throws ServletException, IOException {<br>        resp.getWriter().print(&quot;Hello, App Service!&quot;);<br>    }</pre><pre>}</pre><p>In Java Servlet 3.0 or higher, you don’t need to create a web.xml file.</p><h3>Edit Build File</h3><p>After creating your project, you have an empty build.gradle file. To test your servlet code, edit your build.gradle file with the following code:</p><pre>plugins {<br>  id &#39;war&#39;<br>}</pre><pre>repositories {<br>  mavenCentral()<br>}</pre><pre>dependencies {<br>  providedCompile &#39;javax.servlet:javax.servlet-api:3.1.0&#39;<br>}</pre><pre>sourceCompatibility = &#39;1.8&#39;<br>targetCompatibility = &#39;1.8&#39;</pre><h3>Test Your Servlet on Local</h3><p>Here, you can test your servlet on local with gretty plugin. Execute the following command:</p><pre>$ gradle appRun</pre><p>Then, open another terminal, execute the following command to access to your servlet:</p><pre>$ curl http://127.0.0.1:8080/simple-servlet-app-gradle/</pre><p>If you see “Hello, App Service!”, your servlet works normally.</p><h3>Edit Build File Again</h3><p>Now, you have your servlet. Let’s deploy it to Azure. That is, it’s a time at using azure-webapp-gradle-plugin!</p><p>Replace the build.gradle file with the following content:</p><pre>plugins {<br>  id &#39;war&#39;<br>  id &#39;lenala.azure.azurewebapp&#39; version &#39;1.0&#39;<br>}</pre><pre>repositories {<br>  mavenCentral()<br>}</pre><pre>dependencies {<br>  providedCompile &#39;javax.servlet:javax.servlet-api:3.1.0&#39;<br>}</pre><pre>sourceCompatibility = &#39;1.8&#39;<br>targetCompatibility = &#39;1.8&#39;</pre><pre>azureWebApp {<br>    resourceGroup = &#39;__RESOURCE_GROUP_NAME__&#39;<br>    appName = &#39;__APP_NAME__&#39;<br>    pricingTier = &#39;__PRICING_TIER_NAME__&#39;<br>    region = &#39;__LOCATION_NAME__&#39;<br>    appService = {<br>        type = &#39;windows&#39;<br>        javaWebContainer = &#39;tomcat 8.5&#39;<br>        javaVersion = &#39;1.8&#39;<br>    }<br>    authentication = {<br>        type = &#39;azurecli&#39;<br>    }<br>    deployment = {<br>        type = &#39;war&#39;<br>    }<br>}</pre><p>In the code above, the <a href="https://docs.microsoft.com/en-us/java/api/overview/azure/maven/azure-webapp-maven-plugin/readme?view=azure-java-stable">azureWebApp</a> property has some placeholders. You need to replace the following placeholders:</p><ul><li>__RESOURCE_GROUP_NAME__: The resource group name you created.</li><li>__APP_NAME__: The identifier for your application.</li><li>__LOCATION_NAME__: The location name you want to create the app.</li><li>__PRICING_TIER_NAME__: The <a href="https://docs.microsoft.com/en-us/java/api/overview/azure/maven/azure-webapp-maven-plugin/readme?view=azure-java-stable#pricingtier">pricing tier</a> name.</li></ul><h3>Deploy Your Code</h3><p>Good job! You have all necessary files. Now, you can deploy your servlet to Azure.</p><p>Execute the following command to deploy your servlet:</p><pre>$ gradle war azureWebappDeploy</pre><p>If you see like the following output, the deployment was succeeded.</p><pre>Starting a Gradle Daemon (subsequent builds will be faster)</pre><pre>&gt; Task :azureWebappDeploy<br>Start deploying to Web App simplewa1...<br>Authenticate with Azure CLI 2.0<br>Target Web App doesn&#39;t exist. Creating a new one...<br>com.microsoft.azure.gradle.webapp.handlers.WindowsRuntimeHandlerImpl<br>Creating App Service Plan &#39;serviceplan949842&#39;...<br>Successfully created App Service Plan.<br>Processing settings<br>Creating WebApp<br>Successfully created Web App.<br>Deploying artifacts<br>War name is: /home/yoichiro6642/projects/azure/simple-servlet-app-gradle/build/libs/simple-servlet-app-gradle.war<br>Starting to deploy the war file...<br>Successfully deployed Web App at https://simplewa1.azurewebsites.net</pre><pre>BUILD SUCCESSFUL in 1m 6s<br>3 actionable tasks: 2 executed, 1 up-to-date</pre><p>The azure-webapp-gradle-plugin generates a new plan and app service automatically.</p><p>You can test your deployed servlet by the following command:</p><pre>$ curl https://&lt;APP_NAME&gt;.azurewebsites.net/</pre><p>It’s Ok, if you receive a “Hello, App Service!” string.</p><h3>Conclusion</h3><p>I described how to use the Gradle plugin for Azure App Service in this article. This azure-gradle-plugins is a great tool for all Java Developers who are using Gradle.</p><p>̶I̶ ̶r̶e̶a̶l̶l̶y̶ ̶r̶e̶a̶l̶l̶y̶ ̶h̶o̶p̶e̶ ̶t̶h̶a̶t̶ ̶t̶h̶i̶s̶ ̶g̶r̶a̶d̶l̶e̶ ̶p̶l̶u̶g̶i̶n̶ ̶i̶s̶ ̶p̶u̶b̶l̶i̶s̶h̶e̶d̶ ̶o̶f̶f̶i̶c̶i̶a̶l̶l̶y̶ ̶f̶r̶o̶m̶ ̶t̶h̶e̶ ̶p̶u̶b̶l̶i̶c̶ ̶m̶a̶v̶e̶n̶ ̶r̶e̶p̶o̶s̶i̶t̶o̶r̶y̶.̶ ̶Y̶o̶u̶ ̶a̶l̶s̶o̶ ̶h̶o̶p̶e̶ ̶t̶h̶a̶t̶,̶ ̶r̶i̶g̶h̶t̶?̶ ̶I̶f̶ ̶s̶o̶,̶ ̶p̶l̶e̶a̶s̶e̶ ̶p̶o̶s̶t̶ ̶a̶ ̶c̶o̶m̶m̶e̶n̶t̶ ̶o̶r̶ ̶+̶1̶ ̶t̶o̶ ̶t̶h̶e̶ ̶f̶o̶l̶l̶o̶w̶i̶n̶g̶ ̶i̶s̶s̶u̶e̶ ̶r̶i̶g̶h̶t̶ ̶n̶o̶w̶!̶ ̶I̶ ̶b̶e̶l̶i̶e̶v̶e̶ ̶t̶h̶a̶t̶ ̶y̶o̶u̶r̶ ̶c̶o̶m̶m̶e̶n̶t̶ ̶a̶n̶d̶ ̶y̶o̶u̶r̶ ̶v̶o̶t̶i̶n̶g̶ ̶l̶e̶a̶d̶ ̶t̶h̶e̶ ̶g̶o̶o̶d̶ ̶f̶u̶t̶u̶r̶e̶ ̶o̶f̶ ̶t̶h̶e̶ ̶p̶l̶u̶g̶i̶n̶.̶</p><p><a href="https://github.com/lenala/azure-gradle-plugins/issues/10">deploy to maven repo · Issue #10 · lenala/azure-gradle-plugins</a></p><p>Currently, you can use the azure-gradle-plugins without installing it to your local environment manually. Thanks, <a href="https://github.com/lenala">Elena</a>!</p><p>Last, you can get the complete code set from the following:</p><p><a href="https://github.com/yoichiro/simple-servlet-app-gradle">yoichiro/simple-servlet-app-gradle</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=568ffa52ef0e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to build actions with Java Client Library on Azure App Service]]></title>
            <link>https://medium.com/google-developer-experts/how-to-build-actions-with-java-client-library-on-azure-app-service-3df7e6b1aa0b?source=rss-c23421e64eb5------2</link>
            <guid isPermaLink="false">https://medium.com/p/3df7e6b1aa0b</guid>
            <category><![CDATA[google-assistant]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[actions-on-google]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Yoichiro Tanaka]]></dc:creator>
            <pubDate>Wed, 23 Jan 2019 07:17:32 GMT</pubDate>
            <atom:updated>2020-11-17T18:35:44.344Z</atom:updated>
            <content:encoded><![CDATA[<p>Finally, a new client library for Actions on Google has been released. The name is “Actions on Google Java/Kotlin Client Library”.</p><p><a href="https://github.com/actions-on-google/actions-on-google-java">actions-on-google/actions-on-google-java</a></p><p>Until now, most developers can use a client library called “Actions on Google Client Library for Node.js”. That is, we had only the way to build actions with Node.js. But, currently, we can build actions with Java programming language easily using the Java/Kotlin Client Library.</p><p>The abstract of usage was described on the following article:</p><p><a href="https://medium.com/google-developers/announcing-the-java-kotlin-client-library-for-actions-on-google-217828dead">Announcing the Java &amp; Kotlin client library for Actions on Google</a></p><p>In this article, I introduce how to build actions with the Java/Kotlin Client Library and to deploy them to the Azure App Service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b8iQ2lg1i4cbCsvFi7yNCw.png" /></figure><h3>Prerequisite</h3><p>You need to prepare the following:</p><ul><li>Java Development Kit Version 1.8 or higher.</li><li><a href="https://maven.apache.org/">Maven</a> version 3.6.0 or higher.</li><li>You have already registered your account on Azure.</li><li>You have already installed <a href="https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest">Azure CLI</a> and signed in to the Azure.</li><li>You have already understood how to build actions for Google Assistant on Google Cloud Platform or Amazon Web Services.</li><li>You already have your Actions on Google project and your Dialogflow agent that has already been connected to the AoG project.</li></ul><p>If you don’t know how to build actions, you can study it with codelabs:</p><ul><li><a href="https://codelabs.developers.google.com/codelabs/actions-1/index.html#0">Build Actions for the Google Assistant (Level 1)</a></li><li><a href="https://codelabs.developers.google.com/codelabs/actions-2/index.html#0">Build Actions for the Google Assistant (Level 2)</a></li></ul><p>Also, you need to sign in to Azure with Azure CLI. If you didn’t sign in yet, execute the following commands:</p><pre>$ az login<br>$ az account set --subscription &lt;SUBSCRIPTION_ID&gt;</pre><h3>Create Your Resource Group</h3><p>Let’s get started to create your action. First, create a new resource group using the following commands:</p><pre>$ az group create --name &lt;RESOURCE_GROUP_NAME&gt; --location &lt;LOCATION_NAME&gt;</pre><h3>Create Project</h3><p>Let’s get started to build your action. First, create your new project with Maven. In this article, we use “simple-action” as the project name and “jp.eisbahn.actions.simpleaction” as the package name (The “jp.eisbahn” is the domain I have).</p><pre>$ mvn archetype:generate -DgroupId=jp.eisbahn.actions.simpleaction -DartifactId=simple-action -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false</pre><p>After executing the command above, you have the simple-action directory and some files are generated in the directory. But some files are unnecessary for this article. Delete the following files and directories:</p><ul><li>src/main/webapp/WEB-INF/web.xml</li><li>src/main/webapp/index.jsp</li></ul><h3>Edit pom.xml File</h3><p>After creating your project, replace pom.xml file with the following content:</p><pre>&lt;project xmlns=&quot;<a href="http://maven.apache.org/POM/4.0.0">http://maven.apache.org/POM/4.0.0</a>&quot;<br>  xmlns:xsi=&quot;<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>&quot; xsi:schemaLocation=&quot;<a href="http://maven.apache.org/POM/4.0.0">http://maven.apache.org/POM/4.0.0</a> <a href="http://maven.apache.org/maven-v4_0_0.xsd">http://maven.apache.org/maven-v4_0_0.xsd</a>&quot;&gt;<br>  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;<br>  &lt;groupId&gt;jp.eisbahn.actions.simpleaction&lt;/groupId&gt;<br>  &lt;artifactId&gt;simple-action&lt;/artifactId&gt;<br>  &lt;packaging&gt;war&lt;/packaging&gt;<br>  &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;<br>  &lt;name&gt;simple-action Maven Webapp&lt;/name&gt;<br>  &lt;url&gt;<a href="http://maven.apache.org/">http://maven.apache.org</a>&lt;/url&gt;<br>  &lt;properties&gt;<br>    &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;<br>    &lt;java.version&gt;1.8&lt;/java.version&gt;<br>  &lt;/properties&gt;</pre><pre>  &lt;dependencies&gt;<br>    &lt;dependency&gt;<br>      &lt;groupId&gt;javax.servlet&lt;/groupId&gt;<br>      &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;<br>      &lt;version&gt;3.1.0&lt;/version&gt;<br>      &lt;scope&gt;provided&lt;/scope&gt;<br>    &lt;/dependency&gt;<br>    &lt;dependency&gt;<br>      &lt;groupId&gt;com.google.actions&lt;/groupId&gt;<br>      &lt;artifactId&gt;actions-on-google&lt;/artifactId&gt;<br>      &lt;version&gt;1.0.1&lt;/version&gt;<br>    &lt;/dependency&gt;<br>  &lt;/dependencies&gt;</pre><pre>  &lt;build&gt;<br>    &lt;finalName&gt;simple-action&lt;/finalName&gt;</pre><pre>    &lt;plugins&gt;<br>      &lt;plugin&gt;<br>        &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;<br>        &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;<br>        &lt;version&gt;3.8.0&lt;/version&gt;<br>        &lt;configuration&gt;<br>          &lt;source&gt;${java.version}&lt;/source&gt;<br>          &lt;target&gt;${java.version}&lt;/target&gt;<br>        &lt;/configuration&gt;<br>      &lt;/plugin&gt;</pre><pre>      &lt;plugin&gt;<br>        &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;<br>        &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;<br>        &lt;version&gt;3.2.2&lt;/version&gt;<br>        &lt;configuration&gt;<br>          &lt;failOnMissingWebXml&gt;false&lt;/failOnMissingWebXml&gt;<br>        &lt;/configuration&gt;<br>      &lt;/plugin&gt;</pre><pre>      &lt;plugin&gt;<br>        &lt;groupId&gt;com.microsoft.azure&lt;/groupId&gt;<br>        &lt;artifactId&gt;azure-webapp-maven-plugin&lt;/artifactId&gt;<br>        &lt;version&gt;1.5.2&lt;/version&gt;<br>        &lt;configuration&gt;<br>          &lt;schemaVersion&gt;v2&lt;/schemaVersion&gt;<br>          &lt;resourceGroup&gt;__RESOURCE_GROUP_NAME__&lt;/resourceGroup&gt;<br>          &lt;appName&gt;__APP_NAME__&lt;/appName&gt;<br>          &lt;region&gt;__LOCATION_NAME__&lt;/region&gt;<br>          &lt;pricingTier&gt;__PRICE_TEAR_NAME__&lt;/pricingTier&gt;<br>          &lt;runtime&gt;<br>            &lt;os&gt;windows&lt;/os&gt;<br>            &lt;javaVersion&gt;1.8&lt;/javaVersion&gt;<br>            &lt;webContainer&gt;tomcat 8.5&lt;/webContainer&gt;<br>          &lt;/runtime&gt;<br>          &lt;deployment&gt;<br>            &lt;resources&gt;<br>              &lt;resource&gt;<br>                &lt;directory&gt;${project.basedir}/target&lt;/directory&gt;<br>                &lt;includes&gt;<br>                  &lt;include&gt;*.war&lt;/include&gt;<br>                &lt;/includes&gt;<br>              &lt;/resource&gt;<br>            &lt;/resources&gt;<br>          &lt;/deployment&gt;<br>        &lt;/configuration&gt;<br>      &lt;/plugin&gt;<br>    &lt;/plugins&gt;<br>  &lt;/build&gt;<br>&lt;/project&gt;</pre><p>In the code above, the <a href="https://docs.microsoft.com/en-us/java/api/overview/azure/maven/azure-webapp-maven-plugin/readme?view=azure-java-stable">azure-webapp-maven-plugin</a> plugin element has some placeholders. You need to replace the following placeholders:</p><ul><li>__RESOURCE_GROUP_NAME__: The resource group name you created.</li><li>__APP_NAME__: The identifier for your application.</li><li>__LOCATION_NAME__: The location name you want to create the app.</li><li>__PRICING_TIER_NAME__: The <a href="https://docs.microsoft.com/en-us/java/api/overview/azure/maven/azure-webapp-maven-plugin/readme?view=azure-java-stable#pricingtier">pricing tier</a> name.</li></ul><p>The azure-webapp-maven-plugin generates a new app service automatically, if it does not exists. Decide their names now and replace them.</p><h4>For Java Development Kit version 11</h4><p>If you’re using Java Development Kit version 11 or higher, you will see an error at executing mvn command with the pom.xml file above. The reason is that JAXB was deprecated. To fix this issue, you need to add the following definition to the azure-webapp-maven-plugin plugin element:</p><pre>&lt;plugin&gt;<br>  &lt;groupId&gt;com.microsoft.azure&lt;/groupId&gt;<br>  &lt;artifactId&gt;azure-webapp-maven-plugin&lt;/artifactId&gt;<br>  &lt;version&gt;1.5.2&lt;/version&gt;<br>  &lt;configuration&gt;<br>    ...<br>  &lt;/configuration&gt;</pre><pre>  &lt;!-- Add the following definition --&gt;<br>  &lt;dependencies&gt;<br>    &lt;dependency&gt;<br>      &lt;groupId&gt;javax.xml.bind&lt;/groupId&gt;<br>      &lt;artifactId&gt;jaxb-api&lt;/artifactId&gt;<br>      &lt;version&gt;2.4.0-b180830.0359&lt;/version&gt;<br>    &lt;/dependency&gt;<br>    &lt;dependency&gt;<br>      &lt;groupId&gt;com.sun.xml.bind&lt;/groupId&gt;<br>      &lt;artifactId&gt;jaxb-impl&lt;/artifactId&gt;<br>      &lt;version&gt;2.4.0-b180830.0438&lt;/version&gt;<br>    &lt;/dependency&gt;<br>    &lt;dependency&gt;<br>      &lt;groupId&gt;com.sun.xml.bind&lt;/groupId&gt;<br>      &lt;artifactId&gt;jaxb-core&lt;/artifactId&gt;<br>      &lt;version&gt;2.3.0.1&lt;/version&gt;<br>    &lt;/dependency&gt;<br>    &lt;dependency&gt;<br>      &lt;groupId&gt;javax.activation&lt;/groupId&gt;<br>      &lt;artifactId&gt;activation&lt;/artifactId&gt;<br>      &lt;version&gt;1.1.1&lt;/version&gt;<br>    &lt;/dependency&gt;<br>  &lt;/dependencies&gt;<br>&lt;/plugin&gt;</pre><h3>Create Fulfillment Code</h3><p>Next, you need to create your fulfillment code for your action. Create a source directory with the following command:</p><pre>$ mkdir -p src/main/java/jp/eisbahn/actions/simpleaction</pre><p>Then, create your fulfillment file called “SimpleApp.java” in the simpleactiondirectory with the following content:</p><pre>package jp.eisbahn.actions.simpleaction;</pre><pre>import com.google.actions.api.ActionRequest;<br>import com.google.actions.api.ActionResponse;<br>import com.google.actions.api.DialogflowApp;<br>import com.google.actions.api.ForIntent;<br>import com.google.actions.api.response.ResponseBuilder;</pre><pre>public class SimpleApp extends DialogflowApp {</pre><pre>    @ForIntent(&quot;Default Welcome Intent&quot;)<br>    public ActionResponse welcome(ActionRequest request) {<br>        ResponseBuilder builder = getResponseBuilder(request);<br>        builder.add(&quot;Hello, Azure App Service!&quot;);<br>        return builder.build();<br>    }</pre><pre>}</pre><p>In the code above, the SimpleApp class extends the DialogflowApp class. That is, the class can handle requests from Dialogflow Agent. And, you can create intent handler methods using ForIntent annotation.</p><p>The first argument has information of the request. And, you can create the ActionResponse instance with the ResponseBuilder class.</p><p><a href="https://actions-on-google.github.io/actions-on-google-java/com/google/actions/api/response/ResponseBuilder.html">ResponseBuilder</a></p><p>You can know how to build responses by reading the API reference above.</p><h3>Create Servlet Code</h3><p>By the way, the SimpleApp class does not have any abilities to handle HTTP requests. Instead, you need to create a handler class to handle requests and responses. In this article, create a Java Servlet code to handle HTTP requests and response.</p><p>Create your fulfillment file called “SimpleServlet.java” in the simpleactiondirectory with the following content:</p><pre>package jp.eisbahn.actions.simpleaction;</pre><pre>import com.google.actions.api.App;<br>import javax.servlet.annotation.WebServlet;<br>import javax.servlet.http.HttpServlet;<br>import javax.servlet.http.HttpServletRequest;<br>import javax.servlet.http.HttpServletResponse;<br>import java.io.IOException;<br>import java.util.Collections;<br>import java.util.Map;<br>import java.util.concurrent.ExecutionException;<br>import java.util.stream.Collectors;</pre><pre>@WebServlet(name = &quot;SimpleServlet&quot;, urlPatterns = {&quot;/&quot;}, loadOnStartup = 1)<br>public class SimpleServlet extends HttpServlet {</pre><pre>private App app = new SimpleApp();</pre><pre>    @Override<br>    protected void doPost(<br>            HttpServletRequest req, HttpServletResponse resp)<br>            throws IOException {<br>        String requestBody =<br>            req.getReader().lines().collect(Collectors.joining());<br>        Map&lt;String, String&gt; headersMap =<br>            Collections.list(req.getHeaderNames())<br>                .stream()<br>                .collect(Collectors.toMap(<br>                    name -&gt; name,<br>                    req::getHeader));<br>        try {<br>            String responseBody =<br>                app.handleRequest(requestBody, headersMap).get();<br>            resp.setContentType(&quot;application/json; charset=utf-8&quot;);<br>            resp.getWriter().write(responseBody);<br>        } catch (InterruptedException | ExecutionException e) {<br>            e.printStackTrace();<br>            resp.setStatus(<br>                HttpServletResponse.SC_INTERNAL_SERVER_ERROR);<br>            resp.getWriter().write(e.getMessage());<br>        }<br>    }</pre><pre>}</pre><p>To call the SimpleApp instance, you need the following information:</p><ul><li>The string of the request body.</li><li>The Map&lt;String, String&gt; object that has all request header entries.</li></ul><p>Then, call the handleRequest() method of the SimpleApp instance with these arguments. If the result of calling the method is successfully, the CompletableFuture&lt;String&gt; object is returned. This is for asynchronous like Promise in JavaScript. In the code above, the actual result is retrieved by calling the get() method.</p><p>The result is a string value of the response represents as JSON string. The SimpleServlet sends the response string with the Writer object retrieved by calling the getWriter() method.</p><h3>Deploy Your Code</h3><p>Good job! You have all necessary files. Now, you can deploy your action to Azure.</p><p>Execute the following command to deploy your action:</p><pre>$ mvn package azure-webapp:deploy</pre><p>If you see like the following output, the deployment was succeeded.</p><pre>[INFO] Scanning for projects...<br>[INFO]<br>[INFO] -----------&lt; jp.eisbahn.actions.simpleaction:simple-action &gt;------------<br>[INFO] Building simple-action Maven Webapp 1.0-SNAPSHOT<br>[INFO] --------------------------------[ war ]---------------------------------<br>[INFO]<br>...<br>[INFO] Deploying the war file simple-action.war...<br>[INFO] Successfully deployed the artifact to <a href="https://yoichirosimpleaction.azurewebsites.net/">https://&lt;APP_NAME&gt;.azurewebsites.net</a><br>[INFO] ------------------------------------------------------------------------<br>[INFO] BUILD SUCCESS<br>[INFO] ------------------------------------------------------------------------<br>[INFO] Total time:  25.064 s<br>[INFO] Finished at: 2019-01-23T15:57:41+09:00<br>[INFO] ------------------------------------------------------------------------</pre><p>You can test it by the following command:</p><pre>$ curl -v -X POST -d &quot;{}&quot; https://&lt;APP_NAME&gt;.azurewebsites.net/</pre><p>It’s Ok, if you receive like the following output:</p><pre>&lt; HTTP/1.1 500  <br>&lt; Content-Length: 55<br>&lt; X-Powered-By: ASP.NET<br>&lt; Set-Cookie: ARRAffinity=932c5351a290b46f876f6d4453f2bdc8625e8682cbfa134e04eb88e0677cb1fc;Path=/;HttpOnly;Domain=&lt;APP_NAME&gt;.azurewebsites.net<br>&lt; Date: Wed, 23 Jan 2019 07:02:34 GMT<br>&lt; <br>* Connection #0 to host &lt;APP_NAME&gt;.azurewebsites.net left intact<br>java.lang.Exception: Intent handler not found - INVALID%</pre><p>The message “Intent handler not found” was returned by the Actions on Google Java/Kotlin Client Library.</p><p>After deploying, register the URL as the fulfillment webhook URL on your Dialogflow agent. Then, invoke your action on the Actions simulator. You should get the response “Hello, Azure App Service!” from the Google Assistant.</p><h3>Conclusion</h3><p>If you’re a Java programmer, you can build your actions for Google Assistant with the Actions on Google Java/Kotlin Client Library and the Java language that you are used to. I’m happy if this article becomes useful as you when you’re interested in building actions for the Google Assistant.</p><p>Last, you can get the complete code set from the following GitHub repository:</p><p><a href="https://github.com/yoichiro/simple-action-azure-java-maven">yoichiro/simple-action-azure-java-maven</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3df7e6b1aa0b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-developer-experts/how-to-build-actions-with-java-client-library-on-azure-app-service-3df7e6b1aa0b">How to build actions with Java Client Library on Azure App Service</a> was originally published in <a href="https://medium.com/google-developer-experts">Google Developer Experts</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to build actions with Java Client Library on Google AppEngine]]></title>
            <link>https://medium.com/google-developer-experts/how-to-build-actions-with-java-client-library-on-google-appengine-2eef7a5bd402?source=rss-c23421e64eb5------2</link>
            <guid isPermaLink="false">https://medium.com/p/2eef7a5bd402</guid>
            <category><![CDATA[google-assistant]]></category>
            <category><![CDATA[actions-on-google]]></category>
            <category><![CDATA[app-engine]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Yoichiro Tanaka]]></dc:creator>
            <pubDate>Mon, 21 Jan 2019 01:12:33 GMT</pubDate>
            <atom:updated>2020-04-14T21:22:16.271Z</atom:updated>
            <content:encoded><![CDATA[<p>Last week, a new client library has been released. The name is “Actions on Google Java/Kotlin Client Library.</p><p><a href="https://github.com/actions-on-google/actions-on-google-java">actions-on-google/actions-on-google-java</a></p><p>Until now, most developers can use a client library called “Actions on Google Client Library for Node.js”. That is, we had only the way to build actions with Node.js. But, currently, we can build actions with Java programming language easily using the Java/Kotlin Client Library.</p><p>The abstract of usage was described on the following article:</p><p><a href="https://medium.com/google-developers/announcing-the-java-kotlin-client-library-for-actions-on-google-217828dead">Announcing the Java &amp; Kotlin client library for Actions on Google</a></p><p>In this article, I introduce how to build actions with the Java/Kotlin Client Library and to deploy them to the Google AppEngine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aJNCSmwM8SGl5Oka_3943g.png" /></figure><h3>Prerequisite</h3><p>Before building actions, you need to install the following:</p><ul><li>Java Development Kit Version 1.8 or higher.</li><li><a href="https://gradle.org/install/">Gradle</a> version 5.1.1 or higher.</li><li><a href="https://cloud.google.com/sdk/docs/">Google Cloud SDK</a></li><li>App Engine SDK for Java (you can install it with the following command)</li></ul><pre>gcloud components install app-engine-java</pre><ul><li>You already have your Actions on Google project and your Dialogflow agent that has already been connected to the AoG project.</li></ul><p>Also, you have a project on Google Cloud Platform, which the billing has already been enabled.</p><p>If you don’t know how to build actions, you can study it with codelabs:</p><ul><li><a href="https://codelabs.developers.google.com/codelabs/actions-1/index.html#0">Build Actions for the Google Assistant (Level 1)</a></li><li><a href="https://codelabs.developers.google.com/codelabs/actions-2/index.html#0">Build Actions for the Google Assistant (Level 2)</a></li></ul><h3>Create Project</h3><p>Let’s get started to build your action. First, create your new project with Gradle. In this article, we use “simple-fulfillment-java” as the project name and “jp.eisbahn.actions.simpleaction” as the package name (The “jp.eisbahn” is the domain I have).</p><pre>$ mkdir simple-fulfillment-appengine<br>$ cd simple-fulfillment-appengine<br>$ gradle init</pre><p>The gradle command asks you some questions. Answer them with the following:</p><ul><li>Select type of project to generate: 1 (basic)</li><li>Select build script DSL: 1 (groovy)</li><li>Project name: “simple-fulfillment-java”</li></ul><p>Some files including build.gradle file are generated.</p><h3>Edit Build File</h3><p>After creating your project, the build.gradle file is empty. Replace it with the following content:</p><pre>buildscript {<br>    repositories {<br>        jcenter()<br>        mavenCentral()<br>    }<br>    dependencies {<br>        classpath &#39;com.google.cloud.tools:appengine-gradle-plugin:1.+&#39;<br>    }<br>}</pre><pre>repositories {<br>    jcenter()<br>    mavenCentral()<br>}</pre><pre>apply plugin: &#39;java&#39;<br>apply plugin: &#39;war&#39;<br>apply plugin: &#39;com.google.cloud.tools.appengine&#39;</pre><pre>dependencies {<br>    compile &#39;com.google.appengine:appengine-api-1.0-sdk:+&#39;<br>    compile group: &#39;com.google.actions&#39;, name: &#39;actions-on-google&#39;, version: &#39;1.0.0&#39;<br>    providedCompile &#39;javax.servlet:javax.servlet-api:3.1.0&#39;<br>}</pre><pre>appengine {<br>    deploy {<br>    }<br>}</pre><pre>group = &#39;jp.eisbahn.actions.simpleaction&#39;<br>version = &#39;1.0-SNAPSHOT&#39;</pre><pre>sourceCompatibility = &#39;1.8&#39;<br>targetCompatibility = &#39;1.8&#39;</pre><h3>Create Fulfillment Code</h3><p>Next, you need to create your fulfillment code for your action. Create a source directory with the following command:</p><pre>$ mkdir -p src/main/java/jp/eisbahn/actions/simpleaction</pre><p>Then, create your fulfillment file called “SimpleApp.java” in the simpleaction directory with the following content:</p><pre>package jp.eisbahn.actions.simpleaction;</pre><pre>import com.google.actions.api.ActionRequest;<br>import com.google.actions.api.ActionResponse;<br>import com.google.actions.api.DialogflowApp;<br>import com.google.actions.api.ForIntent;<br>import com.google.actions.api.response.ResponseBuilder;</pre><pre>public class SimpleApp extends DialogflowApp {</pre><pre>    @ForIntent(&quot;Default Welcome Intent&quot;)<br>    public ActionResponse welcome(ActionRequest request) {<br>        ResponseBuilder builder = getResponseBuilder(request);<br>        builder.add(&quot;Hello, Google AppEngine!&quot;);<br>        return builder.build();<br>    }</pre><pre>}</pre><p>In the code above, the SimpleApp class extends the DialogflowApp class. That is, the class can handle requests from Dialogflow Agent. And, you can create intent handler methods using ForIntent annotation.</p><p>The first argument has information of the request. And, you can create the ActionResponse instance with the ResponseBuilder class.</p><p><a href="https://actions-on-google.github.io/actions-on-google-java/com/google/actions/api/response/ResponseBuilder.html">ResponseBuilder</a></p><p>You can know how to build responses by reading the API reference above.</p><h3>Create Servlet Code</h3><p>By the way, the SimpleApp class does not have any abilities to handle HTTP requests. Instead, you need to create a handler class to handle requests and responses. In this article, create a Java Servlet code to handle HTTP requests and response.</p><p>Create your fulfillment file called “SimpleServlet.java” in the simpleaction directory with the following content:</p><pre>package jp.eisbahn.actions.simpleaction;</pre><pre>import com.google.actions.api.App;<br>import javax.servlet.annotation.WebServlet;<br>import javax.servlet.http.HttpServlet;<br>import javax.servlet.http.HttpServletRequest;<br>import javax.servlet.http.HttpServletResponse;<br>import java.io.IOException;<br>import java.util.Collections;<br>import java.util.Map;<br>import java.util.concurrent.ExecutionException;<br>import java.util.stream.Collectors;</pre><pre>@WebServlet(name = &quot;SimpleServlet&quot;, urlPatterns = {&quot;/&quot;}, loadOnStartup = 1)<br>public class SimpleServlet extends HttpServlet {</pre><pre>    private App app = new SimpleApp();</pre><pre>    @Override<br>    protected void doPost(<br>            HttpServletRequest req, HttpServletResponse resp)<br>            throws IOException {<br>        String requestBody =<br>            req.getReader().lines().collect(Collectors.joining());<br>        Map&lt;String, String&gt; headersMap =<br>            Collections.list(req.getHeaderNames())<br>                .stream()<br>                .collect(Collectors.toMap(<br>                    name -&gt; name,<br>                    req::getHeader));<br>        try {<br>            String responseBody =<br>                app.handleRequest(requestBody, headersMap).get();<br>            resp.setContentType(&quot;application/json; charset=utf-8&quot;);<br>            resp.getWriter().write(responseBody);<br>        } catch (InterruptedException | ExecutionException e) {<br>            e.printStackTrace();<br>            resp.setStatus(<br>                HttpServletResponse.SC_INTERNAL_SERVER_ERROR);<br>            resp.getWriter().write(e.getMessage());<br>        }<br>    }</pre><pre>}</pre><p>To call the SimpleApp instance, you need the following information:</p><ul><li>The string of the request body.</li><li>The Map&lt;String, String&gt; object that has all request header entries.</li></ul><p>Then, call the handleRequest() method of the SimpleApp instance with these arguments. If the result of calling the method is successfully, the CompletableFuture&lt;String&gt; object is returned. This is for asynchronous like Promise in JavaScript. In the code above, the actual result is retrieved by calling the get() method.</p><p>The result is a string value of the response represents as JSON string. The SimpleServlet sends the response string with the Writer object retrieved by calling the getWriter() method.</p><h3>Create Configuration File for AppEngine</h3><p>Last, you need to prepare a configuration file for AppEngine. Create a new directory where you put the file by the following command:</p><pre>$ mkdir -p src/main/webapp/WEB-INF</pre><p>Then, create the following file called “appengine-web.xml” into the WEB-INF directory:</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;appengine-web-app xmlns=&quot;<a href="http://appengine.google.com/ns/1.0">http://appengine.google.com/ns/1.0</a>&quot;&gt;<br>    &lt;runtime&gt;java8&lt;/runtime&gt;<br>    &lt;threadsafe&gt;true&lt;/threadsafe&gt;<br>&lt;/appengine-web-app&gt;</pre><h3>Deploy Your Code to AppEngine</h3><p>Ok, you created all files. Now, you can deploy your code to the AppEngine. First, if other project is selected, you need to specify your target project that you want to deploy your code.</p><pre>$ gcloud config set project &lt;YOUR_PROJECT_ID&gt;</pre><p>Let’s deploy your code by the following command:</p><pre>$ gradle appengineDeploy</pre><p>If the deployment is successfully, you can test it by the following command:</p><pre>$ curl -v -X POST -d &quot;{}&quot; https://&lt;PROJECT_ID&gt;.appspot.com/</pre><p>It’s Ok, if you receive like the following output:</p><pre>&lt; HTTP/2 500 <br>&lt; x-cloud-trace-context: 4ba6987ee3351d91cd43fff194b79962;o=1<br>&lt; date: Mon, 21 Jan 2019 00:36:39 GMT<br>&lt; content-type: text/html<br>&lt; server: Google Frontend<br>&lt; content-length: 55<br>&lt; alt-svc: quic=&quot;:443&quot;; ma=2592000; v=&quot;44,43,39,35&quot;<br>&lt; <br>* Curl_http_done: called premature == 0<br>* Connection #0 to host azure-test-65d3c.appspot.com left intact<br>java.lang.Exception: Intent handler not found - INVALID%</pre><p>The message “Intent handler not found” was returned by the Actions on Google Java/Kotlin Client Library.</p><p>After deploying, register the URL as the fulfillment webhook URL on your Dialogflow agent. Then, invoke your action on the Actions simulator. You should get the response “Hello, Google AppEngine!” from the Google Assistant.</p><h3>Conclusion</h3><p>If you’re a Java programmer, you can build your actions for Google Assistant with the Actions on Google Java/Kotlin Client Library and the Java language that you are used to. I’m happy if this article becomes useful as you when you’re interested in building actions for the Google Assistant.</p><p>Last, you can get the complete code set from the following GitHub repository:</p><p><a href="https://github.com/yoichiro/simple-fulfillment-appengine">yoichiro/simple-fulfillment-appengine</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2eef7a5bd402" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-developer-experts/how-to-build-actions-with-java-client-library-on-google-appengine-2eef7a5bd402">How to build actions with Java Client Library on Google AppEngine</a> was originally published in <a href="https://medium.com/google-developer-experts">Google Developer Experts</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to use Actions on Google Client Library on Azure App Service]]></title>
            <link>https://medium.com/google-developer-experts/how-to-use-actions-on-google-client-library-on-azure-app-service-44257ea33d84?source=rss-c23421e64eb5------2</link>
            <guid isPermaLink="false">https://medium.com/p/44257ea33d84</guid>
            <category><![CDATA[actions-on-google]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[google-assistant]]></category>
            <dc:creator><![CDATA[Yoichiro Tanaka]]></dc:creator>
            <pubDate>Tue, 08 Jan 2019 03:38:16 GMT</pubDate>
            <atom:updated>2020-04-14T21:19:13.285Z</atom:updated>
            <content:encoded><![CDATA[<p>I introduced how to use <a href="https://github.com/actions-on-google/actions-on-google-nodejs">Actions on Google Client Library</a> on Azure Functions Node.js in the following story:</p><p><a href="https://medium.com/@yoichiro/how-to-use-actions-on-google-client-library-on-azure-functions-node-js-178d5ecd04e3">How to use Actions on Google Client Library on Azure Functions Node.js</a></p><p>Actually, we have another way to build your actions on Azure. It is to use <a href="https://docs.microsoft.com/en-us/azure/app-service/">Azure App Service</a>.</p><p><a href="https://docs.microsoft.com/en-us/azure/app-service/">Azure App Service documentation - Azure App Service</a></p><p>You can deploy your <a href="https://www.npmjs.com/package/express">express</a> app into the Azure App Service without any touches, basically. Actions on Google Client Library can be used with the express.</p><ul><li><a href="https://www.npmjs.com/package/express">express</a></li><li><a href="https://github.com/actions-on-google/actions-on-google-nodejs">actions-on-google/actions-on-google-nodejs</a></li></ul><p>In this story, I introduce how to use Actions on Google Client Library on Azure App Service.</p><h3>Architecture</h3><p>I assume that you want to implement your fulfillment code on Azure App Service to handle requests from Dialogflow as like the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m1fdS5FQc7zBFEgdK8XzWA.png" /></figure><h3>Prerequisite</h3><p>You need to prepare the following:</p><ul><li>You have already registered your account on Azure.</li><li>You have already installed <a href="https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest">Azure CLI</a> and signed in to the Azure.</li><li>You have already understood how to build actions for Google Assistant on Google Cloud Platform or Amazon Web Services.</li><li>You already have your Actions on Google project and your Dialogflow agent that has already been connected to the AoG project.</li></ul><p>If you don’t know how to build actions, you can study it with codelabs:</p><ul><li><a href="https://codelabs.developers.google.com/codelabs/actions-1/index.html#0">Build Actions for the Google Assistant (Level 1)</a></li><li><a href="https://codelabs.developers.google.com/codelabs/actions-2/index.html#0">Build Actions for the Google Assistant (Level 2)</a></li></ul><h3>Create Your App Service</h3><p>Let’s get started to create your App Service on Azure. If you don’t have your resource group, please create them using the following commands:</p><pre>$ az group create --name &lt;RESOURCE_GROUP_NAME&gt; --location &lt;LOCATION_NAME&gt;</pre><p>Next, create your App Service with the commands below. Here, we use a free plan.</p><pre>$ az appservice plan create --name &lt;PLAN_NAME&gt; --resource-group &lt;RESOURCE_GROUP_NAME&gt; --sku FREE<br>$ az webapp create --resource-group &lt;RESOURCE_GROUP_NAME&gt; --plan &lt;PLAN_NAME&gt; --name &lt;APP_NAME&gt;</pre><p>To work the Actions on Google Client Library, you need to prepare a Node.js environment. Please set the Node.js version to your App Service with the following command:</p><pre>$ az webapp config appsettings set --resource-group &lt;RESOURCE_GROUP_NAME&gt; --name &lt;APP_NAME&gt; --settings WEBSITE_NODE_DEFAULT_VERSION=8.11.1</pre><h3>Create Node.js Project and Install Dependencies</h3><p>You can build your actions with Actions on Google Client Library. To deploy it as the Azure App Service, you need to use express to handle HTTP requests and responses.</p><p>First, create your Node.js project with the npm command:</p><pre>$ mkdir &lt;APP_NAME&gt;<br>$ cd &lt;APP_NAME&gt;<br>$ npm init</pre><p>You will ask some questions from the command, but basically you can answer to press ENTER key for all questions. Then, install dependencies by the following command:</p><pre>$ npm install --save actions-on-google express</pre><p>The node_modules will be created and dependencies will be installed into the directory.</p><h3>Write Fulfillment Code</h3><p>Let’s get started to write your fulfillment code. Create a new file called index.js, and write the following content:</p><pre>const express = require(&#39;express&#39;);<br>const bodyParser = require(&#39;body-parser&#39;);<br>const {dialogflow} = require(&#39;actions-on-google&#39;);</pre><pre>const port = process.env.PORT || 4567;</pre><pre>const app = dialogflow();</pre><pre>app.intent(&#39;Default Welcome Intent&#39;, conv =&gt; {<br>    conv.close(&#39;Hello, Azure!&#39;);<br>});</pre><pre>const expressApp = express().use(bodyParser.json());<br>expressApp.post(&#39;/&#39;, app);</pre><pre>expressApp.listen(port);</pre><h3>Create Web Config File</h3><p>App Service has a Web server called “Microsoft Internet Information Services (IIS)”. And, your fulfillment code works on Node.js. IIS has to delegate requests to the node process. That is, you need to create a Web Config File called web.config. This is a configuration file for IIS written by XML format.</p><p>Create a new file named “web.config”, and write the following content:</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br>&lt;configuration&gt;<br>  &lt;system.webServer&gt;<br>    &lt;webSocket enabled=&quot;false&quot; /&gt;<br>    &lt;handlers&gt;<br>      &lt;add name=&quot;iisnode&quot; path=&quot;index.js&quot; verb=&quot;*&quot; modules=&quot;iisnode&quot; /&gt;<br>    &lt;/handlers&gt;<br>    &lt;rewrite&gt;<br>      &lt;rules&gt;<br>        &lt;rule name=&quot;DynamicContent&quot;&gt;<br>          &lt;conditions&gt;<br>            &lt;add input=&quot;{REQUEST_FILENAME}&quot; matchType=&quot;IsFile&quot; negate=&quot;True&quot; /&gt;<br>          &lt;/conditions&gt;<br>          &lt;action type=&quot;Rewrite&quot; url=&quot;index.js&quot; /&gt;<br>        &lt;/rule&gt;<br>      &lt;/rules&gt;<br>    &lt;/rewrite&gt;<br>    &lt;security&gt;<br>      &lt;requestFiltering&gt;<br>        &lt;hiddenSegments&gt;<br>          &lt;remove segment=&quot;bin&quot; /&gt;<br>        &lt;/hiddenSegments&gt;<br>      &lt;/requestFiltering&gt;<br>    &lt;/security&gt;<br>    &lt;httpErrors existingResponse=&quot;PassThrough&quot; /&gt;<br>  &lt;/system.webServer&gt;<br>&lt;/configuration&gt;</pre><h3>Pack, Deploy and Test</h3><p>Now you can pack your code and deploy it to the Azure App Service. First, do the following command to pack your files:</p><pre>$ zip -r files.zip .</pre><p>Then, deploy the zip file to the Azure App Service:</p><pre>$ az webapp deployment source config-zip --resource-group &lt;RESOURCE_GROUP_NAME&gt; --name &lt;APP_NAME&gt; --src &lt;ZIP_FILE_PATH&gt;</pre><p>If deployed successfully, the URL of your fulfillment webhook endpoint is below:</p><pre>https://&lt;APP_NAME&gt;.azurewebsites.net/</pre><p>Register the URL as the fulfillment webhook URL on your Dialogflow agent. Then, invoke your action on the Actions simulator.</p><h3>Conclusion</h3><p>In this story, I introduced how to use Actions on Google Client Library on Azure App Service. If you are using Azure App Service, try to build your action for Google Assistant on Azure!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=44257ea33d84" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-developer-experts/how-to-use-actions-on-google-client-library-on-azure-app-service-44257ea33d84">How to use Actions on Google Client Library on Azure App Service</a> was originally published in <a href="https://medium.com/google-developer-experts">Google Developer Experts</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>