Here’s a quick tutorial to explain how to connect your Clustaar bot to Google assistant and use voice with your bots.
Disclaimer: This tutorial requires some basic technical level.
Create a Google Assistant project
Before you start creating a bot in our platform, you need to create a Google Assistant project:
- Go inside Configure a Developer Project and Account Settings to learn how to create a Google project.
- To create a project, follow the steps “Configure an Actions Console project“.
- In the same link, refer to the section “Set activity controls for your account“.
- In your activity control, check if those features are activated.
Once the project is created, we will configure some more steps and be set up in the Clustaar app.
- Go into the project that you have just created, if it’s not already done.
- Click on “Overview”.
- Click on “App information”, then click on the Edit button.
You should arrive on a new page where you will find the language of your bot.
- Fill the “Assistant app name” and “Pronounciation” with the same content.
- Click on the “Next” button.
- Scroll down until you find “Sample invocations” — this sentence will trigger your application.
- Optional: Change the sentence or add a new invocation.
- Scroll to the bottom of the page and click the Save button.
- Disclaimer: You may receive an error message because you did not fill out all the fields. You can skip this part. But if you receive this message “Could not reserve your app name”, please change it.
Find Project ID
Click on the button on the right of “Overview”, then Project settings
Then copy or write the “Project ID” somewhere. You will need it later.
Download gaction
In order to activate your new project, you will need to download gactions software according to your OS version.
Download Notepad ++ or a code editor
Download Notepad++ or use any other code editor for the next steps.
Create a JSON file
- Open Notepad++ application
- Create a new file by doing CTRL+N
- Then copy-paste the following text in the new file
{ "actions": [ { "description": "Default Welcome Intent", "name": "MAIN", "fulfillment": { "conversationName": "CONVERSATION_NAME" }, "intent": { "name": "actions.intent.MAIN", "trigger": { "queryPatterns": [ "INVOCATION_SENTENCE" ] } } } ], "conversations": { "CONVERSATION_NAME": { "name": "CONVERSATION_NAME", "url": "URL_WEBHOOKS", "fulfillmentApiVersion": 2 } }, "locale": "fr"}
- Save the file in the same folder where you put the gactions program by choosing the JSON format.
- Name the file “actions.xx.json”, where xx is your language code: “fr” for french, “en” for english. We are going to call it “actions.fr.json”.
In this file, you will have to change some fields:
- CONVERSATION_NAME: You can change it, or keep it like this.
- INVOCATION_SENTENCE: Copy and paste the first invocation that you have configured “Ok Google ….”.
- locale: Change it by using your language code.
- URL_WEBHOOKS: Before you change it, we will create a Clustaar bot and activate the Google Assistant channel.
Create your bot
Go to the Clustaar application and create a bot using the Google Assistant channel.
Activate the channel
The next step is to activate Google channel and change URL_WEBHOOKS from your file to the one given by Clustaar.
So the steps are:
- Click on Channels menu.
- Click on Google Assistant channel.
- Copy the given url and replace URL_WEBHOOKS in your actions.xx.json file.
- Copy the project ID from Google that you kept before and past it in “Project ID”.
- Click on the button Save changes.
- Click on Activate integration.
Run gactions program
Now you are able to run gactions command.
Open a command prompt in your gactions folder: cmd on Windows.
How to open command prompt in Windows
- Go into the folder where you saved actions.xx.json and gactions program.
- Click on the path of your folder (red line in the picture above).
- Windows will show you the complete path:
- Copy it.
- Go back to your command prompt type “cd”, then press space bar and CTRL+V.
- Press ENTER key.
You should have something like:
cd C:\Users\...
- Terminal on macOS and Linux (follow the windows steps).
Now we are going to run gactions program:
- Copy the line and edit it on Notepad++ or other code editor.
gactions update –action_package actions.xx.json –project project_id
Replace:
- actions.xx.json by the name of your file.
- project_id by the “Project ID” that you put in your Clustaar app.
Then:
- Paste (CTRL+V) in your command prompt.
- Press ENTER key case.
After running the command Google will ask you to open a link
- Copy the link in your browser and open it.
- It will ask you to connect to your Gmail account (Just do it :-D).
- It will ask you to authorize ASSISTANT CLI, click on Authorize button.
You should arrive in a page where Google gives you a code.
- Copy the code and paste the code in your command prompt by doing CTRL+V.
- Then press “Enter“.
- Check that Google says “Your app for the assistant for project …. was successfully updated …”.
- Go back to Google Action Console and click on Actions.
- Check if you have a row “Default Welcome Intent”.
- If you don’t, please check the previous steps.
- If you have it, just click on the Test button and you are good to go.
Complete your Clustaar bot
Go back to Clustaar application to fill your bot with a story, intents and entities.
Disclaimer: To make your bot work with Google assistant, please create a special intent that will trigger your story. To do so:
- Copy-paste your INVOCATION_SENTENCE (Ok Google ….) in the new intent and save it.
- Don’t put anything else in your intent.
- Put the intent as a trigger of your first step.
- Now you can complete your first step, and create other steps and intents in the same story.
Ok, Google !
How to try your bot:
- Use Google Action Console simulator.
- Go to Google Console Action and open your project.
- Click on the “Actions” menu on the left side, then on the TEST button.
- Press ENTER key next to your INVOCATION_SENTENCE (“Talk to assistant test”) or use the microphone by clicking on:
2. Use your Google Home device or Google Assistant application (iOS, Android) by calling your app with the invocation sentence you configured.
Now enjoy 😉!