×
Community Blog Getting Started with Botpress on Alibaba Cloud

Getting Started with Botpress on Alibaba Cloud

This tutorial shows how you can get started with Botpress on Alibaba Cloud and quickly create a bot from existing Botpress templates.

By Alex Muchiri.

In previous blog posts, we have looked at chatbots and how they can serve as a useful tool to several businesses nowadays. In a nutshell, a chatbot is a computer program that can mimic human conversation. Chatbots are used in a variety of places, including on Facebook pages, websites, and other communication platforms such as Slack.

It's pretty unlikely that you haven't already interacted with a chatbot at some point in time. You probably interacted with one while reaching out to Facebook's user support, while placing an order on your favourite ecommerce platform, or while engaging with your bank online. Nowadays there are chatbots for almost everything you could imagine them for.

While it sounds interesting that we can build software to take over human communications and improve the productivity of our company, it's reasonable to say that developers also do not want to spend months setting up the infrastructure for this to all work. In fact, without any assistance, building a proper chatbot would be a real headache and not at all as exciting as it may initially sound.

For a chatbot to work, you need an immense, sizeable amount of code, and you also need a a natural language unit to understand user intentions. These are the challenges that open-source chatbot frameworks have been built to resolve. They can enable developers set up the bot infrastructure in a matter of hours, rather than several months, and make it easy to launch a bot for virtually any service. Open-source bots are able to interact with backend systems using API actions, save content in databases, read and write files and carry out regular tasks such as responding to frequently asked questions.

In general, these open-source bots consist of the following core units:

  • A publicly accessible web server.
  • Data storage service.
  • Intelligent algorithm service, or more particularly, a natural language unit (NLU).
  • An SDK and tools to interface with apps and websites.

So, there's a lot to love about these open-source bots. The one we will be working with in this tutorial is called Botpress.

What Is Botpress

Botpress is an open-source chatbot platform that is available with some very impressive features. Many industry developers, agencies and organizations use Botpress to build bots that interact with their core business operations in a consistent and reliable manner. Botpress uses a very secure architecture, but coupled with features such as password secrets and on-premises deployment, Botpress is also very flexible and be configured to your exact needs. Plus, the Botpress platform is very intuitive and is loaded with features and ready to integrate using simple standard APIs.

Botpress also features a premium version with more advanced features but the open-source edition is already quite impressive. In fact, I have built amazing chatbots already with the open-source edition. Overall, the platform is professionally built to help get started with your chatbot building process.

In this tutorial, I will be showing you some of the steps needed to set up Botpress on Alibaba Cloud. This tutorial is part of a three-part tutorial series. You can find the other articles here: Creating a FAQ ChatBot That's Integrated with Facebook Messenger and Advanced Concepts in Botpress: A Crash Course.

Prerequisites

To get Botpress set up, we will be using the following items:

  • An Alibaba Cloud Elastic Compute Service (ECS) instance installed with Ubuntu 18.04, with 4 GB of RAM and at least 40 GB storage.
  • A NGINX web server installed.
  • A Certbot installed.
  • A domain. For this, you can register for a domain using Alibaba Cloud Domain Name System (DNS). Alternatively, you can just use your local IP address to get started.

Installing Botpress on Alibaba Cloud

Now let's install Botpress on an Alibaba Cloud ECS instance that is installed with Ubuntu 18.04. For this, you'll need to have access to the root user or a sudoer. On your local browser, head over to https://s3.amazonaws.com/botpress-binaries/index.html and check out for the latest Linux distribution or in your server, download the latest version. You can use this command.

wget https://s3.amazonaws.com/botpress-binaries/botpress-v12_1_3-linux-x64.zip

Next, run the command below to install the unzip file in your system.

sudo apt-get install unzip

Once it's installed, you can extract the downloaded zip file with this command:

unzip botpress-v12_1_3-linux-x64.zip

Alternatively, to extract the zip file to a different destination, run this command below:

unzip botpress-v12_1_3-linux-x64.zip -d destination_folder

Next, remove the original zip file, as we won't need it again. You can use this command:

sudo rm -r botpress-v12_1_3-linux-x64.zip

Access the unzipped files:

1

Initiate the server by running the command below.

./bp &

You should see an output like this:

19:15:49.747 Launcher ========================================
                                  Botpress Server
                                   Version 12.1.3
                                  OS linux ubuntu
                      ========================================
19:15:49.750 Launcher App Data Dir: "/home/alex/botpress"
19:15:51.156 Launcher Using 9 modules
                      ⦿ MODULES_ROOT/analytics
                      ⦿ MODULES_ROOT/basic-skills
                      ⦿ MODULES_ROOT/builtin
                      ⊝ MODULES_ROOT/channel-messenger (disabled)
                      ⊝ MODULES_ROOT/channel-slack (disabled)
                      ⊝ MODULES_ROOT/channel-teams (disabled)
                      ⊝ MODULES_ROOT/channel-telegram (disabled)
                      ⦿ MODULES_ROOT/channel-web
                      ⦿ MODULES_ROOT/code-editor
                      ⦿ MODULES_ROOT/extensions
                      ⊝ MODULES_ROOT/history (disabled)
                      ⊝ MODULES_ROOT/hitl (disabled)
                      ⦿ MODULES_ROOT/nlu
                      ⦿ MODULES_ROOT/qna
                      ⦿ MODULES_ROOT/testing
19:15:52.395 Server Loaded 9 modules
19:15:52.440 CMS Loaded 7 content types
19:15:52.791 HTTP Configured port 3000 is already in use. Using next port available: 3001
19:15:52.791 HTTP External URL is not configured. Using default value of http://localhost:3001. Some features may not work proprely
19:15:52.847 Server Started in 1689ms
19:15:52.847 Launcher Botpress is ready at http://localhost:3000

Confirm that everything is running correctly by running the command below:

netstat -tulpn | grep LISTEN

The output should look like this:

tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      722/nginx: master p
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      535/systemd-resolve
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      756/sshd
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      722/nginx: master p
tcp6       0      0 :::3000                 :::*                    LISTEN      13838/./bp

You should see a list of running processes, which should include Botpress on the port of 3000. What we should do next, as part of the initial setup, is set up NGINX to run Botpress as a proxy. Ensure you have a domain pointed to your server for the next steps.

Run the commands below to install NGINX if it is not installed already:

sudo apt-get update
sudo apt-get install nginx

Check the available configurations for your firewall with this command:

sudo ufw app list

The output will be as follows:

Output
Available applications:
  Nginx Full
  Nginx HTTP
  Nginx HTTPS
  OpenSSH

Next, enable NGINX with the following command:

sudo ufw allow 'Nginx HTTP'

Then, confirm the setting by running the command below:

sudo ufw status

With it installed, we'll need to also create a config file for our Botpress server. To do this, run the command below:

cd /etc/nginx/sites-available

Create a new file by running the following command.

sudo nano kodeec.website

Copy the following in the file and save it.

server {
    # listen on port 80 (http)
    listen 80;
    server_name kodeec.website 47.254.153.30 www.kodeec.website;

    location / {
        include proxy_params;
        proxy_pass http://127.0.0.1:3000;
    }
}

Enable the configuration with the following command.

sudo ln -s /etc/nginx/sites-available/kodeec.website /etc/nginx/sites-enabled/

Now you should be able to access 'kodeec.website' on your browser but it is still unsecure.

To install SSL encryption for your website, we can use Let's Encrypt.

To get started with this, install the dependencies with the following commands:

sudo apt-get install software-properties-common
sudo add-apt-repository universe
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get install certbot python-certbot-nginx

Once everything's installed and running, run the command below:

sudo certbot --nginx

Follow the prompt to generate a certificate for your domain as shown below:

2

Finally, run the commands below to enable HTTPS encryption and reload NGINX.

sudo ufw allow https
sudo systemctl reload nginx

After doing that, you should be able to access 'https://kodeec.website' on your browser. We have successfully installed and secured Botpress on an ECS server.

Getting started Using Botpress

The first step after installing Botpress is to create an admin user. You will be able to login after creating a new user:

3

The workspace is displayed upon logon. It lists your existing bots and gives you the ability to create new bots and a menu of several items.

4

When creating a new bot, you have the option of choosing from three options: empty bot, small talk or welcome bot. The small talk and welcome bots are pre-existing templates that can help you get a conversational bot up and running quickly. But it will not do much before some good customization.

5

Now we need to create a simple bot using the small talk template, I will call it Simple. Select simple to access the visual flow editor and chat emulator like so:

6

The quick tour guide is provided to help locate most of what you will need.

7

The latest edition of Botpress provides a clean interface to create choices, call APIs, add new nodes and create slots. During the bot building process, the API calls enable the bot to interact with your existing backend systems. This is the interface from which you will manage all post-deployment refinements such as adding new services and improving the conversational experience. For instance, you can start conversing with your Simple bot right away using the Chat emulator located at the bottom right corner of the interface.

8

The Botpress engine we have installed supports multiple messaging channels and we will be exploring those in this series. Note that this engine uses an NLU engine to synthesize user input as can be demonstrated from the small talk bot we created from an existing template.

Let's consider some of the pros and cons of Botpress.

Pros
  • You can run Botpress fully on your internal infrastructure.
  • Botpress is an open-source platform, which you can expand on by building more features.
  • Botpress does not rely on any external dependencies.
  • Botpress offers good flexibility and security for user data.
  • Botpress is easy to use and developer friendly.

Cons

  • Botpress is rather complex and hard to use for non-technical people.
  • Botpress is well supported, but its support is still somewhat limited especially when compared with some of its commercial counterparts.
  • Botpress may require costly expertise for deployment, as well as training and maintenance, and so in the end it is not completely free of charge.

Conclusion

Botpress is one of the leading open-source bot frameworks in the market today. It is generally well supported as evidenced by the numerous releases to support the framework. Organizations and developers that do not want to outsource their data to third-parties will find it very useful. What we have seen in this tutorial is how you can get the system up and running and create a simple bot from existing templates.

Do you have an Alibaba Cloud account? Sign up for an account and try over 40 products for free. This offer is worth up to $1300. Get Started with Alibaba Cloud to learn more.

The views expressed herein are for reference only and don't necessarily represent the official views of Alibaba Cloud.

1 0 0
Share on

Alibaba Clouder

2,605 posts | 747 followers

You may also like

Comments

marcmercier July 16, 2020 at 5:03 pm

Hi Alex, I just posted your tutorial here: https://forum.botpress.com/t/tutorials-resources-by-the-community/3026. Can you share your username on the Botpress Forum so I can tag you in the post? Thanks, Marc