Wednesday, June 19, 2019

Installing BotLibre Enterprise Bot Platform on Microsoft Azure

Azure is a cloud computing service created by Microsoft for building, testing, deploying, and managing applications and services through Microsoft-managed data centres. Azure Virtual Machines (VM) is one of several types of on-demand, scalable computing resources that Azure offers.

This guide is to work through the steps to install Bot Libre platform to the Azure VM.

Step 1. Create an Azure Virtual Machine

First go to Azure website https://signup.azure.com and sign up a new account if you do not have one yet.

Then login, and go to Azure portal site:  https://portal.azure.com/

And click the ‘Virtual machine’ button below and follow the steps to create a new VM.

From the new Virtual machines creation page, click blue ‘Create virtual machine’ button.

From the “Basics” configuration page, specify a VM name (e.g. botlibrevm) and select the region close to your location (e.g. East US)

From the same Basics configuration page, scroll down, and select Image with CentOS-based 7.5. CentOS is our recommended OS installing platform. For the size, we recommend at least 16GM RAM and 2TB hard disk in two CPUs for the production environment. For the demo purpose, we choose the basic size of 1 cpu and 2GB  RAM.

Then specify to use user/password to SSH remote access to the VM.

Then click “review + create” blue button (above) to review and create the VM, and now see the Review page before committing the VM creation operation:

It then takes about 4-5 minutes to complete the image deployment.

Azure assigns a public IP (e.g. 52.186.83.158) to the instance, and we need the IP to config the web server later on.

When the VM is ready, you can now access to it via Serial Console, or SSG remote access from  a client terminal.

Azure's Virtual Machine Serial Console provides access to a text-based console for Linux or Windows Virtual Machines on Azure. This serial connection is to COM1 serial port of the virtual machine and provides access to the virtual machine regardless of that virtual machine's network/operating system state.

You can now use Azure Serial Console to connect to the VM. (from the VM main page, search Serial Console, or scroll down the menu and find the Serial Console from “Support + troubleshooting” section.

Last, you need to configure the VM networking to allow the inbound/outbound via specific port. You must add a pair of inbound/outbound port rules to allow the access of Tomcat server, which use the port 80.

If you choose ssh from a client terminal instead of using the Serial Console, you need to add the inbound port 22.

 

After connecting to the VM instance from the terminal or Azure Serial Console, you may start to setup the Java, Ant, Tomcat, Postgres, Python and finally deploy the botlibre web app to Tomcat.

Step 2. Install Java 

>>Install the Java JDK 1.8 (latest dot release).

# sudo su root  (switch to root user)
# cd /opt
#  wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz"
# cd /opt/jdk1.8.0_131/
# alternatives --install /usr/bin/java java /opt/jdk1.8.0_131/bin/java 2
# export JAVA_HOME=/opt/jdk1.8.0_131

Step 3. Install Tomcat web server.  

You can find the latest stable version (currently it’s 8.5.41) of Apache Tomcat 8 from its official download page.

Under the "Binary Distributions" section and then the "Core" list, right mouse click and save the http link pointing to the "tar.gz" archive:

# wget http://apache.mirror.colo-serv.net/tomcat/tomcat-8/v8.5.41/bin/apache-tomcat-8.5.41.tar.gz
# tar xzf apache-tomcat-8.5.41.tar.g
# export TOMCAT_HOME=/usr/local/tomcat8
# mv apache-tomcat-8.5.41 $TOMCAT_HOME
# vi $TOMCAT_HOME/bin/setenv.sh  (create a new setenv.sh file)

> add the following JVM option to increase the max memory size in your setenv.sh export JAVA_OPTS="-server -Xmx8g"

  # vi $TOMCAT_HOME/conf/web.xml

>> insert the following XML in your web.xml to enable cors filters (required for JavaScript access)

     <filter>
           <filter-name>CorsFilter</filter-name>
           <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
           <init-param>
                  <param-name>cors.support.credentials</param-name>
                  <param-value>false</param-value>
            </init-param>
    </filter>
    <filter-mapping>
            <filter-name>CorsFilter</filter-name>
            <url-pattern>/rest/*</url-pattern>
     </filter-mapping>
     <error-page>
            <error-code>404</error-code>
            <location>/404.jsp</location>
     </error-page>

# vi $TOMCAT_HOME/conf/server.xml
>> update connector port 8080->80, 8433->433
>> add to connector, URIEncoding="UTF-8"
>> update host- <public ip> > autoDeploy=”false”


> Start tomcat web server:

# cd $TOMCAT_HOME/bin
# ./startup.sh

Go to a browser and check if the server is up and running at http://<public-ip> (e.g. http://52.186.83.158 )

 

Troubleshooting: If you do not see the server running, check the server log at $TOMCAT_HOME/logs/catalina.out

Then shutdown the server:

# cd $TOMCAT_HOME/bin/
# ./shutdown.sh

Step 4. Install PostgreSQL database

Install the PostgreSQL 9.4 database.

>> first disable yum updates in case yum uses an older version

# vi /etc/yum.repos.d/CentOS-Base.repo
>> add lines to exclude postgresql from yum
[base]
...
exclude=postgresql*
[updates]
...
exclude=postgresql*

>> install postgres database and init it

# cd /otp
# rpm -Uvh http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-centos94-9.4-3.noarch.rpm
# yum install postgresql94 postgresql94-server postgresql94-contrib

>> Switch to non-root user postgres

# su - postgres
# /usr/pgsql-9.4/bin/initdb /var/lib/pgsql/9.4/data

>>switch back to user ‘paphus’

# exit (this exit to root user, which Azure does not provide the password for root)
# su - paphus (switch to customer user)
# sudo service postgresql-9.4 start
>>[sudo] password for paphus: ****
Redirecting to /bin/systemctl start postgresql-9.4.service
# sudo service postgresql-9.4 stop . (stop database)

>> Configure restart:

# sudo chkconfig --levels 235 postgresql-9.4 on

>> Set database password:

# sudo service postgresql-9.4 start 
# sudo -u postgres psql postgres \
# \password
>> here, type postgres as the database password for user postgres, twice
\q

Step 5. Install Python server

Bot Libre uses a separate Python web server to support deep learning analytics. Python is not required for bots or NLP, only deep learning analytics such as image classification. If you do not require deep learning you can skip this step.

Run the following commands, one by one, to install Python, Pop, Tensorflow, Flask and Psycopy2.

# sudo su root ( switch to root user)
# yum update
# yum install yum-utils
# yum groupinstall development
# yum -y install https://centos7.iuscommunity.org/ius-release.rpm
# yum -y install python36u
# yum -y install python36u-pip
# yum -y install python36u-devel
# pip3.6 install tensorflow==1.7
# pip3.6 install flask
# pip3.6 install psycopg2-binary
# pip3.6 install pillow
$ pip3.6 install lxml
# pip3.6 install Cython
# pip3.6 install jupyter
# pip3.6 install matplotlib
# pip3.6 install pandas
# pip3.6 install opencv-python

Then you may copy the /python from the BotLibre install to /usr/local/python

# mv <BotLibreInstallRoot>/python /usr/local/python

>> start the python server

# nohup python3.6 /usr/local/python/app.py &

>> Verify that the Python server is up and running

# wget http://localhost:6777/
>> Connecting to localhost (localhost)|127.0.0.1|:6777... connected.
HTTP request sent, awaiting response... 200 OK

Step 6. Install BotLibre

The Bot Libre application is a Java “war” file. A war file is a zip file that contains a website and Java libraries

There are several installation steps:

  • Copy library jars to /usr/local/tomcat8/lib (from bot libre lib sub directories, do not copy botlibre-ai.jar, do not copy botlibreplatform.jar, do not overwrite any files already in tomcat lib)
  • Copy speech voice files to /usr/local/tomcat8/bin/lib (unzip speech voice zip into lib voices directory)
  • Shutdown Tomcat server: cd $TOMCAT_HOME/bin/; ./shutdown.sh
  • Deploy war file by emptying the $TOMCAT_HOME/webapps/ directory, and copying the botlibreplatform.war to $TOMCAT_HOME/webapps/ROOT.war.
  • Start Tomcat Server: cd $TOMCAT_HOME/bin/; ./startup.sh 
  • Open http://<public-ip> e.g. http://52.186.83.158/

Then you may refer to the generic BotLibre install guide to login as admin user (default password is password), and create workspace, create bot, configure bot and train bot.

Friday, May 31, 2019

Installing BotLibre Enterprise Bot Platform on Amazon Lightsail

Amazon Lightsail is a lightweight cloud website hosting framework based on the Amazon Web Services (AWS) platform. Lightsail can help to quickly jumpstart your project  with a virtual machine, SSD-based storage, data transfer, DNS management, and a static IP for an affordable price.

This guide is to work through the steps to install Bot Libre Enterprise Bot Platform to the AMS Lightsail.

Step 1. Create an Amazon Lightsail instance

Go to Amazon Lightsail website and register a new AWS account if you do not have one yet.

https://lightsail.aws.amazon.com/ls/webapp/home

then login and start to create an instance. Choose a OS Only instance using CentOS 7 Linux system:

Bot Libre requires a Tomcat Web Server, Python Server, and a database to run. To host Bot Libre system you require a dedicated server or VM with minimum 8gb of RAM.  For demonstration purpose, we are using the basic 512MB configuration as following:

After the service is being created, click ‘Connect using SSH’ to connect to it.

Lightsail assigns a public IP (e.g. 35.183.67.175) to the instance, and we need the IP to config the web server later on.

After connecting to the instance via ssh, from the terminal, you may start to setup the Java, Ant, Tomcat, Postgres, Python and finally deploy the botlibre web app to Tomcat.

$ sudo su root
$ yum install wget  (install wget tool)

Step 2 - install Java and Ant

Install the Java JDK 1.8 (latest dot release).

$ cd /opt
$ wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http://www.oracle.com; oraclelicense=accept-securebackup-cookie"
"
https://download.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/jdk-8u201-linux-x64.tar.gz"
$ tar xzf jdk-8u201-linux-x64.tar.gz
$ cd /opt/jdk1.8.0_201
$ alternatives --install /usr/bin/java java /opt/jdk1.8.0_201/bin/java 2
$ export JAVA_HOME=/opt/jdk1.8.0_201

Install ant

$ cd /opt
$ wget https://www-eu.apache.org/dist//ant/binaries/apache-ant-1.10.5-bin.tar.gz
$ tar xfv apache-ant-1.10.5-bin.tar.gz
$ export ANT_HOME=/opt/apache-ant-1.10.5
$ export PATH=$JAVA_HOME/bin:$ANT_HOME/bin:$PATH

Step 3 – Tomcat Install the Tomcat 8 web server.  

$ cd /opt
$ wget https://www-us.apache.org/dist/tomcat/tomcat-8/v8.5.39/bin/apache-tomcat-8.5.39.tar.gz
$ tar xzf apache-tomcat-8.5.39.tar.gz
$ export TOMCAT_HOME=/usr/local/tomcat8
$ mv apache-tomcat-8.5.39 $TOMCAT_HOME
$ vi $TOMCAT_HOME/bin/setenv.sh  (create a new setenv.sh file)

>> add the following JVM option to increase the max memory size in your setenv.sh export JAVA_OPTS="-server -Xmx8g"

$ vi $TOMCAT_HOME/conf/web.xml

>> insert the following XML in your web.xml to enable cors filters (required for JavaScript access)

     <filter>
     <filter-name>CorsFilter</filter-name>
        <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
        <init-param>
         <param-name>cors.support.credentials</param-name>
            <param-value>false</param-value>
        </init-param>
    </filter>
<filter-mapping>
     <filter-name>CorsFilter</filter-name>
        <url-pattern>/rest/*</url-pattern>
     </filter-mapping>
     <error-page>
        <error-code>404</error-code>
        <location>/404.jsp</location>
     </error-page>
$ vi $TOMCAT_HOME/conf/server.xml
>> update connector port 8080->80, 8433->433
>> add to connector, URIEncoding="UTF-8"
>> update host- <public ip> > autoDeploy=”false”

Start tomcat web server:

$ $TOMCAT_HOME/bin/startup.sh

Go to a browser and check if the server is up and running at http://<public-ip> (e.g. http://35.183.67.175)

Troubleshooting: If you do not see the server running, check the server log at $TOMCAT_HOME/logs/catalina.out

Then shutdown the server:

$ $TOMCAT_HOME/bin/shutdown.sh

Step 4 Install PostgreSQL database

>> install postgres database and init it
$ cd /otp
$ rpm -Uvh http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-centos94-9.4-3.noarch.rpm
$ yum install postgresql94 postgresql94-server postgresql94-contrib
$ /usr/pgsql-9.4/bin/initdb /var/lib/pgsql/9.4/data
>> Verify database starts/stops/restart:
$ service postgresql-9.4 start
$ service postgresql-9.4 stop
$ chkconfig --levels 235 postgresql-9.4 on
>> Set database password:
$ service postgresql-9.4 start
$ sudo -u postgres psql postgres
\# \password
>> enter new password “postgres” twice
\# \q  (exit)
Step 5. Install Python (Optional)

Bot Libre uses a separate Python web server to support deep learning analytics. Python is not required for bots or NLP, only deep learning analytics such as image classification. If you do not require deep learning you can skip this step.

Run the following commands to install Python, Pop, Tensorflow, Flask and Psycopy2.

$ yum update
$ yum install yum-utils
$ yum groupinstall development
$ yum -y install https://centos7.iuscommunity.org/ius-release.rpm yum -y install python36u
$ yum -y install python36u-pip
$ yum -y install python36u-devel
$ pip3.6 install tensorflow==1.7
$ pip3.6 install flask
$ pip3.6 install psycopg2
$ pip3.6 install pillow
$ pip3.6 install lxml
$ pip3.6 install Cython
$ pip3.6 install jupyter
$ pip3.6 install matplotlib
$ pip3.6 install pandas
$ pip3.6 install opencv-python

Then you may copy the /python from the BotLibre install to /usr/local/python

$ mv <BotLibreInstallRoot>/python /usr/local/python
>> start the python server
$ nohup python3.6 /usr/local/pythonn/app.py &

Step 6. Install BotLibre

The Bot Libre application is a Java “war” file. A war file is a zip file that contains a website and Java libraries.

There are several installation steps:

  • Copy library jars to /usr/local/tomcat8/lib (from bot libre lib sub directories, do not copy botlibre-ai.jar, do not copy botlibreplatform.jar, do not overwrite any files already in tomcat lib)
  • Copy speech voice files to /usr/local/tomcat8/bin/lib (unzip speech voice zip into lib voices directory)
  • Ensure war file is configured with correct database password, domain name, and this must be set in the Site.java file, and the war must be recompiled using the build.xml ant task in Eclipse)
  • Shutdown Tomcat server: $TOMCAT_HOME/bin/shutdown.sh
  • Deploy war file by emptying the $TOMCAT_HOME/webapps/ directory, and copying the botlibreplatform.war to $TOMCAT_HOME/webapps/ROOT.war.
  • Start Tomcat Server: $TOMCAT_HOME/bin/startup.sh
  • Open http://<public-ip> e.g. http://35.183.67.175/

Then you may refer to the generic BotLibre install guide to login as admin user (default password is password), and create workspace, create bot, config bot and train bot.

 

Thursday, November 1, 2018

Bot Libre 7.0 AI/NLP Engine - now on GitHub

The Bot Libre open source GitHub repository has been updated to Bot Libre 7.0.

GitHub
https://github.com/BotLibre/BotLibre/tree/master/ai-engine

SourceForge
https://sourceforge.net/projects/botlibre/files/7.0/

Many enhancements including:

  • Alexa
  • Google Home/Assistant
  • Response next and conversation flows
  • Exclusive topics
  • Synonyms
  • Compound keywords, required words
  • Regular expressions
  • Neural network
  • Many fixes, and enhancements

Thursday, September 13, 2018

Parsing natural language using Regular Expression patterns and extractors

Bot Libre 7 adds support for using Regular Expressions in patterns, templates, and scripts.

Regular Expressions, or Regex defines a pattern syntax for parsing text. Unlike AIML and Bot Libre patterns Regex patterns are character based, not word base, so can match specific types of words and word sequences such as numbers, dates, times, currency, and others.

For example, the following regex matches a number,

/\d+

and this regex would match a date,

/^(19|20)\d\d[-/.](0[1-9]|1[012])[-/.](0[1-9]|[12][0-9]|3[01])$

Bot Libre allows regex expressions to be used in AIML patterns, and in Bot Libre response patterns. Bot Libre's scripting language Self also allows regex in patterns and provides extractor functions that allow regex to be used to extract data from a user's input.

To define a regex pattern in an AIML or Bot Libre pattern just start the regex with the "/" character.

AIML defines pattern wildcards such as * and ^ which can match multiple words in a phrase, but they will match any word, and are not restricted to specific types of words. Bot Libre lets you include regex inside AIML patterns to match specific types of words.  Just like the * wildcard the word that was matched by the regex can be accessed in the template using the <star/> tag.

<category>
<pattern>my email is /.+\@.+\..+</pattern>
<template>Okay, I will email you at <star/></template>
</category>

Normally regex is used to match a specific word, but you can also use regex to match and entire phrase if it defines the entire pattern.

For this to work the entire pattern must be the regex, and the pattern can have no other words. The "()" characters in regex define a group which becomes the star variable(s).

<category>
<pattern>/(?i)what\sis\s(.*)</pattern>
<template>I have no idea what <star/> is.</template>
</category>

Patterns and regex can also be used in Bot Libre response lists similar to AIML.

Pattern("my email is /.+\@.+\..+")
Template("Okay, I will email you at {star}")

Pattern("/(?i)what\sis\s(.*)")
Template("I have no idea what {star} is.")

In a response list template you can also use Self extractor functions.

I am 22 years old
Template("I will remember that you are { var age = sentence.exec("\d+"); speaker.age = age; age } years old.")

Regex can also be used in Self patterns and functions.

state Math {
    pattern "^ /\d+ \* /\d+ ^" template "{star[1].toNumber() * star[2].toNumber()}";
    pattern "^ /\d+ / /\d+ ^" template "{star[1].toNumber() / star[2].toNumber()}";
    pattern "^ /\d+ \+ /\d+ ^" template "{star[1].toNumber() + star[2].toNumber()}";
    pattern "^ /\d+ \- /\d+ ^" template "{star[1].toNumber() - star[2].toNumber()}";
}

The following are regex functions in Self:

  • Utils.matches(text, regex) - return if the regex matches the text
    Utils.matches("12345", "\d+") == true
  • String.test(text) - return if the regex string it matches the text
    "\d".test("hello 123") == true
  • String.exec(text) - extract the subtext matching the regex string from the text
    "\d+".exec("hello 123") != "123"
  • String.match(text) - returns an array of all values matching the regex string extracted from the text
    var values = "hello 123 456".match("\d+"); values[1] == "456"

Bot Libre also defines several symbols for common regex patterns.
These include:

  • #number
  • #date
  • #email
  • #url

These symbols can be used in place of regex patterns in Self and patterns.

<category>
<pattern>my email is #email</pattern>
<template>Okay, I will email you at <star/></template>
</category>
state Email {
    pattern "^ #email ^" topic "email" template "Thank you, I will remember your email. { think { speaker.email = Utils.extract(sentence, #email); conversation.topic = null; } }";
    pattern "*" topic "email" template "Please enter a valid email.";
}

For more information on the regex syntax and example patterns see:

https://www.w3schools.com/jsref/jsref_obj_regexp.asp

https://regexr.com/

Thursday, August 30, 2018

How to Connect a Bot to Amazon Alexa

Through Bot Libre, you can now use your own bot to send and receive messages using any Amazon Alexa device. This "How To" will give you a step by step process to connect your bot with Amazon Alexa.

Step 1 - Create a Bot

First you must create a bot that you want to connect to Alexa, or you can use one of your existing bots. To create a bot, follow the instructions here: How to create your own chat bot in 10 clicks.

Step 2 - Amazon Developer Console

Click the "Sign In" button to sign into or create a new Amazon Developer account.

Once you have signed in, mouse over "Your Alexa Consoles" and select "Skills".

In the Alexa Skills Console, click the "Create Skill" button to continue.

Enter a name for your Alexa skill and select the language you will use. You will be able to add more languages later. Your skill will only work on devices set to this language, so a skill set to English(UK) won't work on a device set to English(US), for example. Make sure "Custom" is selected at the bottom, then click the "Create skill" button.

Step 3 - Create Interaction Model

Click the "Invocation" option in the left sidebar under Interaction Model.

In the "Skill Invocation Name" field, enter the name the user will use to begin interacting with your bot. The invocation name should be two or more words. Click the "Save Model" button when complete.

Click the "+ Add" button next to "Intents" in the left sidebar. Enter a name into the field, it does not matter what it is. I will enter "conversation" in my example. Press the "Create custom intent" button.

In the "Sample Utterances" field, enter some phrases that a user could say to signal their intent to speak with your bot.

Scroll down to the Intent Slots section. Enter a name for the slot and press the "+" button. It does not matter what the name is, I will use "message" in this example.

Select "AMAZON.SearchQuery" for the slot type. Press the "Save Model" button when complete. Click the "Edit Dialog" text under "Actions".

Toggle the "Is this slot required to fulfill the intent?" option to the ON position. Enter any text into the "Alexa speech prompts" field. It does not matter what is says, it will not be used, but something must be there.

Press the "Save Model" button when complete.

If you would like to add support for additional languages, click the language dropdown in the top-left, and select "Language Settings".

Click "+ Add new language" and select the language(s) you would like to add support for. You will then need to complete the Interaction Model (step 3 in this guide) for each new language you've added.

Then click the "Build Model" button and wait for it to finish.

Step 4 - Enter Endpoint

Return to the Bot Libre website and navigate to your bot's Admin page by click the gear icon on your bot's page.

Select the "Alexa" option to enter the next screen. Copy the "Alexa Skill Endpoint URL" to your clipboard.

Return to the Alexa Skills Console and click the "Endpoint" button on the left sidebar. Select the "HTTPS" option.

In the "Default Region" section, paste the "Alexa Skill Endpoint URL" into the "Enter URL" field, and select "My development endpoint has a certificate from a trusted certificate authority" in the "Select SSL certificate type" dropdown.

Click the "Save Endpoints" button at the top of the page.

Step 5 - Bot Libre Settings

Return to the Bot Libre website and navigate to your bot's Alexa settings page. You will need to enter some responses to handle Alexa's built-in intents. These will only be active until the conversation with your bot begins. After the conversation has begun, your bot will handle all responses. In the "End Conversation Phrases" box, enter some phrases/words the user can say that will cause the conversation to end.

Click the "Save" button when complete.

Step 6 - Finish

You should now be able to test your bot using the Alexa Skills Console or an Alexa device that is connected with your account. To test on the Alexa Skills Console, click the "Test" button.

You will need to enable testing for your skill by clicking the toggle that says "Test is disabled for this skill."

You will now be able to test your bot by typing into the text box or clicking on the mic icon to use your voice.

To make your Alexa Skill available to the public, you will need to complete the required information in the "Distribution" tab.

Next, click on the "Certification" tab. You will need to click the "Run" button to complete validation. When your skill has successfully passed validation, click on "Submission" in the left sidebar and then click the "Submit for review" button. You will then need to wait for Amazon to review your Alexa Skill before it is available for the public.

Your bot will now be able to send and receive messages on an Amazon Echo or any other Amazon Alexa-compatible device. If you encountered any issues, or would like help setting up your bot please email us at support@botlibre.com or upgrade to our Platinum service and we can build your bot for you.

You can now also talk to the Bot Libre Help Bot, Brain Bot, and Julie on Alexa.

say "Alexa, open Bot Libre" (lee bra) to talk with the Bot Libre Help Bot

say "Alexa, open Brain chatbot" to talk with the Brain Bot

say "Alexa, open Julie chatbot" to talk with the Julie

Thursday, August 9, 2018

How to create a bot for Google Home and Google Assistant

Through Bot Libre, you can now use your own bot to send and receive messages on Google Home or any other Google Assistant-compatible device. This "How To" will give you a step by step process to connect your bot with Google Assistant.

Step 1 - Create a Bot

First you must create a bot that you want to connect to Google Assistant, or you can use one of your existing bots. To create a bot, follow the instructions here: How to create your own chat bot in 10 clicks.

Step 2 - Create Google Assistant Action

Go to https://developers.google.com/actions/ and sign in to your Google account. Once you are signed in, click the "Go To Actions Console" button.

Click the "+ Add/import project" button to continue.

Enter a project name and select your language and country, then press "Create Project" to continue.

Next, select a category for your bot, or press "Skip" to pick later.

Step 3 - Google Assistant Action Settings

On the left sidebar, select the "Invocation" option.

From here, you can enter a "Display name" which the user will say or type to begin interacting with your bot. You can also select a voice that your bot will use on Google Assistant.

Press "Save" when finished. Next, click the "Actions" option on the left sidebar.

Click the "Add Your First Action" button. Select "Custom intent", then click the "Build" button on the bottom right.

A new tab will open for you to create a Dialogflow Agent.

Step 4 - Create Dialogflow Agent

Your project name should be filled in automatically when you enter this page. Click the "Create" button to continue.

Click the "Fulfillment" option on the left sidebar.

Click the "Webhook" toggle to enable it, then return to the Bot Libre website. 

On the Bot Libre website, navigate to your bot's Admin page by clicking the gear icon on your bot's page.

Select the "Google Assistant" link on your bot's Admin page to continue to the next screen.

Copy the "Google Assistant Webhook URL" to your clipboard and return to the Dialogflow website.

Paste the URL into the "URL" field, then scroll down and press the "Save" button.

Next, click the "Intents" option on the left sidebar.

Click on "Default Fallback Intent". Scroll to the bottom of the page and expand the Fulfillment section. Toggle "Enable webhook call for this intent" to the on position. Press the "Save" button. Repeat the same process for the "Default Welcome Intent".

Step 5 - Bot Libre Settings

You may now close the Dialogflow website and return to your bot's Admin page on the Bot Libre website.

In the "End Conversation Phrases" box, enter some phrases/words the user can say that will cause the conversation to end.

Click the "Save" button when finished.

Step 6 - Finish

You should now be able to test your bot using the Simulator available on the the Google Actions Console, or on any device associated with the Google account used to create your Google Assistant action. To test using the simulator, make sure the "Web & App Activity", "Device Information", and "Voice & Audio Activity" permissions are enabled on the Activity controls page for your Google Account.

To make your Google Assistant Action available to the public, click the "Directory information" option in the left sidebar and fill out the required information.

Next, click the "Release" option in the left sidebar. If all necessary information has been completed, you will be able to click the "Submit for Production" button to make your bot available to all Google Assistant users.

Your bot will now be able to send and receive messages on Google Home or any other Google Assistant-compatible device. If you encountered any issues, or would like help setting up your bot please email us at support@botlibre.com or upgrade to our Platinum service and we can build your bot for you.

You can now also talk to the Bot Libre Help Bot, Brain Bot, and Julie on Google Home and Google Assistant.

say "talk to Bot Libre" (lee bra) to talk with the Bot Libre Help Bot

say "talk to Brain chatbot" to talk with the Brain Bot

say "talk to Julie chatbot" to talk with the Julie