{
    "componentChunkName": "component---src-templates-doc-page-js",
    "path": "/docs/en/channels/google_assistant/jaicf/",
    "result": {"data":{"site":{"siteMetadata":{"title":"Gatsby-doc-engine"}},"markdownRemark":{"id":"74d39c7a-aa8f-5c97-8f73-97162820a11e","excerpt":"Connecting Google Assistant to JAICF project To create an Action and connect the JAICF project to it, please follow these steps: Prepare the project. Create a…","html":"<h1>Connecting Google Assistant to JAICF project</h1>\n<hr>\n<p>To create an <em>Action</em> and connect the JAICF project to it, please follow these steps:</p>\n<ol>\n<li><a href=\"#Prepare-the-project\">Prepare the project</a>.</li>\n<li><a href=\"#Create-a-channel\">Create a Google Assistant channel</a>.</li>\n<li><a href=\"#Action-Package\">Download Action Package</a>.</li>\n<li><a href=\"#Register-Action-in-the-Actions-Console\">Register your Action в Actions Console</a>.</li>\n<li><a href=\"#Create-an-activation-phrase\">Create an activation phrase</a>.</li>\n<li><a href=\"#Copy-Project-ID\">Copy Project ID</a>.</li>\n<li><a href=\"#Download-gactions\">Download gactions</a>.</li>\n<li><a href=\"#Upload-the-Action-Package-into-your-project\">Upload the Action Package into your project</a>.</li>\n<li><a href=\"#Get-permission-to-use\">Get permission to use</a>.</li>\n<li><a href=\"#Testing\">Test your bot in the Actions Console simulator</a>.</li>\n</ol>\n<p class='tip'>Please note that this integration with Google Assistant is only active for projects created with <a href=https://developers.google.com/assistant/conversational/df-asdk/actions-sdk/gactions-cli target=\"_blank\" rel=\"noopener noreferrer\">legacy Actions SDK</a>. For projects created using <a href=https://developers.google.com/assistant/conversational/overview target=\"_blank\" rel=\"noopener noreferrer\">Conversational Actions</a>, use the <a href=/1.10.3/docs/en/channels/dialogflow/dialogflow  >Dialogflow channel</a>.</p>\n</br>\n<h4>Prepare the project</h4>\n<p>Before connecting the channel, prepare the JAICF project in advance:</p>\n<ol>\n<li>Specify the following in the dependencies of <code class=\"language-text\">build.gradle.kts</code> file:</li>\n</ol>\n<div class=\"gatsby-highlight\" data-language=\"kotlin\"><pre class=\"language-kotlin\"><code class=\"language-kotlin\">dependencies <span class=\"token punctuation\">{</span>\n   <span class=\"token comment\">// ...</span>\n    <span class=\"token function\">implementation</span><span class=\"token punctuation\">(</span><span class=\"token string-literal singleline\"><span class=\"token string\">\"com.justai.jaicf:jaicp:</span><span class=\"token interpolation\"><span class=\"token interpolation-punctuation punctuation\">$</span><span class=\"token expression\">jaicf</span></span><span class=\"token string\">\"</span></span><span class=\"token punctuation\">)</span>\n    <span class=\"token function\">implementation</span><span class=\"token punctuation\">(</span><span class=\"token string-literal singleline\"><span class=\"token string\">\"com.justai.jaicf:google-actions:</span><span class=\"token interpolation\"><span class=\"token interpolation-punctuation punctuation\">$</span><span class=\"token expression\">jaicf</span></span><span class=\"token string\">\"</span></span><span class=\"token punctuation\">)</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n</br>\n<ol start=\"2\">\n<li>Configure depending on the <a href=\"/1.10.3/docs/en/platform_ux/jaicf/project_jaicf\">connection method to the platform</a>:</li>\n</ol>\n<ul>\n<li>\n<p><code class=\"language-text\">long polling</code> — the bot will connect to the Just AI server when interacting with the platform. Simple solution, suitable for local development and debugging.</p>\n<p>For this method, specify the channel <code class=\"language-text\">ActionsFulfillment.ActionsFulfillmentSDK</code> in the <code class=\"language-text\">JaicpPoller.kt</code> file:</p>\n</li>\n</ul>\n<div class=\"gatsby-highlight\" data-language=\"kotlin\"><pre class=\"language-kotlin\"><code class=\"language-kotlin\"><span class=\"token keyword\">package</span> com<span class=\"token punctuation\">.</span>justai<span class=\"token punctuation\">.</span>jaicf<span class=\"token punctuation\">.</span>template<span class=\"token punctuation\">.</span>connections\n\n<span class=\"token keyword\">fun</span> <span class=\"token function\">main</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token function\">JaicpPollingConnector</span><span class=\"token punctuation\">(</span>\n        templateBot<span class=\"token punctuation\">,</span>\n        accessToken<span class=\"token punctuation\">,</span>\n        channels <span class=\"token operator\">=</span> <span class=\"token function\">listOf</span><span class=\"token punctuation\">(</span>\n            ChatApiChannel<span class=\"token punctuation\">,</span>\n            ChatWidgetChannel<span class=\"token punctuation\">,</span>\n            TelephonyChannel<span class=\"token punctuation\">,</span>\n            ActionsFulfillment<span class=\"token punctuation\">.</span>ActionsFulfillmentSDK\n        <span class=\"token punctuation\">)</span>\n    <span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">runBlocking</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n</br>\n<ul>\n<li>\n<p><code class=\"language-text\">webhook</code> — the bot will receive messages from the platform using the specified link. Must be configured to connect <a href=\"/1.10.3/docs/en/platform_ux/create-project\">JAICP Cloud</a>.</p>\n<p>For this method, specify the channel <code class=\"language-text\">ActionsFulfillment.ActionsFulfillmentSDK</code> in the <code class=\"language-text\">JaicpServer.kt</code> file:</p>\n</li>\n</ul>\n<div class=\"gatsby-highlight\" data-language=\"kotlin\"><pre class=\"language-kotlin\"><code class=\"language-kotlin\"><span class=\"token keyword\">package</span> com<span class=\"token punctuation\">.</span>justai<span class=\"token punctuation\">.</span>jaicf<span class=\"token punctuation\">.</span>template<span class=\"token punctuation\">.</span>connections\n\n<span class=\"token keyword\">fun</span> <span class=\"token function\">main</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token function\">JaicpServer</span><span class=\"token punctuation\">(</span>\n        botApi <span class=\"token operator\">=</span> templateBot<span class=\"token punctuation\">,</span>\n        accessToken <span class=\"token operator\">=</span> accessToken<span class=\"token punctuation\">,</span>\n        channels <span class=\"token operator\">=</span> <span class=\"token function\">listOf</span><span class=\"token punctuation\">(</span>\n            ChatApiChannel<span class=\"token punctuation\">,</span>\n            ChatWidgetChannel<span class=\"token punctuation\">,</span>\n            TelephonyChannel<span class=\"token punctuation\">,</span>\n            ActionsFulfillment<span class=\"token punctuation\">.</span>ActionsFulfillmentSDK\n        <span class=\"token punctuation\">)</span>\n    <span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">start</span><span class=\"token punctuation\">(</span>wait <span class=\"token operator\">=</span> <span class=\"token boolean\">true</span><span class=\"token punctuation\">)</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n</br>\n<h4>Create a channel</h4>\n<p>Go to the JAICF project on JAICP. Go to the <em>Channels</em> tab on the side panel, then click <em>Incoming</em> > <em>Create channel</em>. In the <em>Voice Assistans</em> section, choose <em>Google Assistant</em>.</p>\n<p>Fill in the fields:</p>\n<ul>\n<li><em>Channel name</em> — here you can change the channel name.</li>\n<li><em>Web app URL</em> — specify the link to <a href=\"/1.10.3/docs/en/channels/google_assistant/interactive_canvas\">Interactive Canvas</a> web application if needed.</li>\n<li><em>Triggers</em> — here you can add the phrases that will be associated with your action. If the user says one of these phrases, Google Assistant will suggest activating your action.</li>\n</ul>\n<p>Click <em>Create</em>.</p>\n</br>\n<h4>Action Package</h4>\n<p>Download the JSON from your Action Package. To do that, click the link <em>Download action.json</em> under the name of the newly added channel.</p>\n</br>\n<h4>Register Action in the Actions Console</h4>\n<p>Proceed to <a href=\"https://console.actions.google.com/\" target=\"_blank\" rel=\"noopener noreferrer\">Action Console</a> and create a new project. To do that, click <em>Add/import Project</em>. Set the name of the project, the language and your country. Choose a category from the suggested options.</p>\n</br>\n<h4>Create an activation phrase</h4>\n<p>Go to <em>Setup</em> > <em>Invocation</em> on the control panel. In the <em>Display name</em> field set the activation phrase for your bot's <em>Action</em>.</p>\n<p>Here you can also choose the voice that the bot will use to talk to users. Save the changes</p>\n</br>\n<h4>Copy Project ID</h4>\n<p>Go to <em>Project settings</em> > copy <em>Project ID</em>.</p>\n</br>\n<h4>Download gactions</h4>\n<p>Download the <a href=\"https://developers.google.com/actions/tools/gactions-cli\" target=\"_blank\" rel=\"noopener noreferrer\">gactions</a> software for your OS.</p>\n</br>\n<h4>Upload the Action Package into your project</h4>\n<p>Open the Command Prompt (for Windows) or terminal (Mac OS, Linux). Proceed to the folder containing your gations and the JSON-file for the Action Package. Run this command:</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">gactions update --action_package PACKAGE_NAME --project PROJECT_ID</code></pre></div>\n<ul>\n<li>Use the name of the JSON-file instead of <code class=\"language-text\">PACKAGE_NAME</code>.</li>\n<li>Use your <em>Project ID</em> that you have copied previously instead of <code class=\"language-text\">PROJECT_ID</code>.</li>\n</ul>\n<p>Click <code class=\"language-text\">Enter</code>.</p>\n</br>\n<h4>Get permission to use</h4>\n<p>You will receive a URL from gactions that you need to open in any browser. Copy the URL and then paste it into your browser.</p>\n<p class='warn'>If this is not the first time you have performed these actions, then you are already logged in and the authorization URL may not be issued.</p>\n<p>A page will open in the browser asking you to select an account and grant permission to manage projects. Select the account where you created the project in the Actions Console, click <em>Allow</em>.</p>\n<p>You will see an authorization code that you need to copy and paste back into the console/terminal and then press <code class=\"language-text\">Enter</code>.</p>\n</br>\n<h4>Testing</h4>\n<p>Now you can test the Action using the device supporting Google Assistant in the same account that you used to create the project. You can also test your bot in the Action Console simulator.</p>\n<p>Before testing, check the permissions for the activity controls in your Google Assistant. To do that, proceed to your Google account > <em>Privacy &#x26; personalization</em> > <em>Manage your data &#x26; personalization</em> > <em>Activity controls</em>.</p>\n<p>The following settings should be turned on:</p>\n<ul>\n<li>Web &#x26; App Activity;</li>\n<li>Device Information;</li>\n<li>Voice &#x26; Audio Activity.</li>\n</ul>","frontmatter":{"title":"","description":null},"headings":[{"value":"Connecting Google Assistant to JAICF project"}]}},"pageContext":{"slug":"/docs/en/channels/google_assistant/jaicf/","previous":{"fields":{"slug":"/docs/en/channels/iDigital/whatsapp/"},"frontmatter":{"title":"","description":null}},"next":{"fields":{"slug":"/docs/en/channels/google_assistant/interactive_canvas/"},"frontmatter":{"title":"","description":null}}}},
    "staticQueryHashes": ["1209419333"]}