Google Assistant

Creating your project in Actions Console

In order for us to link your Bot to Google Assistant, we'll first need you to create a project in the Google Actions Console (https://console.actions.google.com/u/0/). Log in with your Google account and remember to put the project in Portuguese - Brazil and the locality in Brazil "

With your project created, click on the "Actions SDK"

Gactions

Now, with your project created, let's prepare your PC / Mac to get Gactions commands, so we can link your Bot with your project in Google Actions.

First go to: https://developers.google.com/actions/tools/gactions-cli and download Gactions for your operating system.

To find out the version of your MAC, open the Terminal and type "uname -a

With Gactions downloaded, place it in a folder of your choice. Now we have to make it become an executable:

  • Windows: Let's use the Downloads folder as an example, gactions.exe will be there, first open the Terminal as Administrator (type cmd in the search and open the Command Prompt as administrator), now type in the console "cd DOWNLOAD FOLDER PATH". Ex: cd C:\Users\Teste\Downloads Now, we are inside the downloads folder, run the "gactions.exe init" command, this will create a .json inside the downloads folder that will not allow us to use the gactions commands.

  • Mac: Let's use the Downloads folder as an example, gactions.exe will be there, first open the Terminal (cmd + space bar and type Terminal), now type in the console ls and then cd Downloads Inside the Downloads folder execute the command "chmod + x gactions", this will make the gactions an executable binary, execute it (double clicking on the file) and return to the terminal. This will install the gactions commands on your machine. Finally, it still does not end, type: ./gactions init, this will create the file action.json

Editing Json

With json, action.json installed, open it as notepad / text so we can edit it with your project information.

Before we start editing it, we'll get the url from the Channels-> Google Actions tab of CosmoBots.

Below you have a sample json file filled in, in "URL" you will use the URL present on your Google Assistant page in CosmoBots (as explained above).

With json edited, return to the terminal and do the following:

  • Windows: At the terminal, enter the code below:

    gactions update --action_package PACKAGE_NAME.JSON --project PROJECT_ID Where in PACKAGE_NAME.JSON you will enter the name of your Json and PROJECT_ID will be the ID you were informed in Actions SKD, done in the first step.

  • Mac: At the terminal, enter the code below:

    ./gactions update --action_package PACKAGE_NAME.JSON --project PROJECT_ID Where in PACKAGE_NAME.JSON you will enter the name of your Json and PROJECT_ID will be the ID you were informed in Actions SKD, done in the first step.

Once this is done, he will ask for a token and will inform you of a Link. Enter this link, log in with the Google account where the project is and paste the token into the terminal.

By placing the Token, go back to the Google Actions Console page and enter your project, it will already be linked to your Bot.

Last updated