You can support us by downloading this article as PDF from the Link below. Download the guide as PDF

Chatwoot is a customer support tool for real-time messaging channels. This can help businesses provide good customer support to their clients via social media channels.

This means that you can integrate your social media chat e.g Facebook, Twitter, email, WhatsApp e.t.c to one central place. This will effectively help you have eyes on all your platforms and respond to customer requests in real-time.

Chatwoot is an open-source alternative to commercial software solutions like Intercom, Zendesk e.t.c.

Chatwoot Features

  • Live chat – It offers a simple chat software for your business, You can embed the widget to your website for live chat.
  • Integrations – Chatwoot provides the flexibility of integrating with collaboration tools like Slack. You can get all your Chatwoot conversation delivered to slack so you won’t need to leave slack workspace to reply to your messages.
  • Shared inbox – You can have a shared inbox for your team for collaboration. This makes handling multi-channel tickets easy.

Shared inbox allows you to:

  1. Collaborate with your team using private notes
  2. Use slash commands to answer frequently asked questions.
  3. Auto-assign tickets to teammates for faster response.

Installation of Chatwoot on Ubuntu 20.04

We shall be covering how to install a self-hosted Chatwoot live-chat server on Ubuntu 20.04 with Let’s Encrypt.

Before we jump installation, take note of the below requirements:

  1. Ubuntu 20.04 LTS server with all packages upgraded.
  2. Nginx server Installation
  3. Certbot for Let’s Encrypt
  4. FQDN – Fully Qualified Domain Name

Use the following steps to install a fully functional Chatwoot server on your Ubuntu 20.04 host.

Step 1 – Download installation script

In your terminal, run the following to download the script that will be used to install chatwoot.

wget https://raw.githubusercontent.com/chatwoot/chatwoot/develop/deployment/setup_20.04.sh -O setup.sh

Step 2 – Install Chatwoot on Ubuntu 20.04

Make the downloaded script executable and run it as sudo.

chmod 755 setup.sh
sudo ./setup.sh

The setup will download and install the required packages for Chatwoot.

On successful install, you will see the output as the one below:

....
Woot! Woot!! Chatwoot server installation is complete
The server will be accessible at http://<server-ip>:3000
To configure a domain and SSL certificate, follow the guide at https://www.chatwoot.com/docs/deployment/deploy-chatwoot-in-linux-vm

The service can be accessed directly on:

http://<server-ip>:3000

Step 3 – Install Nginx Web Server

Chatwoot can be accessed via http://<server-ip>:3000. You should configure firewall to allow the port 3000.

In this setup, we need to install Nginx and use it as a reverse proxy for Chatwoot.

We’ll also setup Let’s Encrypt on the nginx Virtualhost.

Install nginx on Ubuntu:

sudo apt update
sudo apt install nginx

Configure nginx.

Unlink the default nginx configuration:

sudo unlink /etc/nginx/sites-enabled/default

Create virtualhost

cd /etc/nginx/sites-available
sudo nano chatwoot.conf

Add the following configuration in the conf file:

server {
  server_name <yourdomain.com>;

  # Point upstream to Chatwoot App Server
  set $upstream 127.0.0.1:3000;

  # Nginx strips out underscore in headers by default
  # Chatwoot relies on underscore in headers for API
  # Make sure that the config is turned on.
  underscores_in_headers on;
  location /.well-known {
    alias /var/www/ssl-proof/chatwoot/.well-known;
  }

  location / {
    proxy_pass_header Authorization;
    proxy_pass http://$upstream;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-Ssl on; # Optional

    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    proxy_http_version 1.1;
    proxy_set_header Connection “”;
    proxy_buffering off;

    client_max_body_size 0;
    proxy_read_timeout 36000s;
    proxy_redirect off;
  }
  listen 80;
}

Link the configuration file to /etc/nginx/sites-enabled:

sudo ln -s /etc/nginx/sites-available/chatwoot.conf /etc/nginx/sites-enabled/chatwoot.conf

Verify that your Nginx configuration is okay then restart nginx service.

$ sudo nginx -t
$ sudo systemctl reload nginx

Step 4 – Configure Let’s Encrypt SSL for Chatwoot

Add certbot repository.

sudo add-apt-repository ppa:certbot/certbot

Install certbot for Nginx

sudo apt update
sudo apt install python-certbot-nginx

Run Let’s Encrypt

sudo mkdir -p /var/www/ssl-proof/chatwoot/.well-known
sudo certbot --webroot -w /var/www/ssl-proof/chatwoot/ -d yourdomain.com -i nginx

You can now access your Chatwoot live server from https://yourdomain.com.

Configure Chatwoot Environment

You need to configure chatwoot environment to have a properly functioning system.

  1. Login as Chatwoot user
# Login as chatwoot user

sudo -i -u chatwoot
cd chatwoot

2. Configure Facebook Channel

You need to create a Facebook app in their developer portal.

You then need to fill the following details in the .env file

##edit the .env file
nano .env

FB_VERIFY_TOKEN=
FB_APP_SECRET=
FB_APP_ID=

3. Configure Email

In the .env file, add SMTP details in the following fields:

MAILER_SENDER_EMAIL=
SMTP_ADDRESS=
SMTP_USERNAME=
SMTP_PASSWORD=

4. Configure storage

You can configure Chatwoot to use cloud storage e.g Amazon s3 as opposed to using the default local storage. This can be changed in the following field in the .env file

ACTIVE_STORAGE_SERVICE='local'

Restart chatwoot service after any update/change in .env file

sudo systemctl restart chatwoot.target

How To Upgrade Chatwoot

Use the steps below to upgrade to a newer version of Chatwoot

# Login as Chatwoot user
sudo -i -u chatwoot

# Navigate to the Chatwoot directory
cd chatwoot

# Pull the latest version of the master branch
git checkout master && git pull

# Update dependencies
bundle
yarn

# Recompile the assets
rake assets:precompile RAILS_ENV=production

# Migrate the database schema
RAILS_ENV=production bundle exec rake db:migrate

# Restart the chatwoot server
systemctl restart chatwoot.target

Conclusion

We have installed and configured Chatwoot live chat server on a self hosted Ubuntu 20.04 host.

Live chat can be very handy in a service industry as it increases efficiency in customer response.

Install Openfire XMPP Chat Server on Ubuntu

How To Install Rocket.Chat Server on Debian / Ubuntu

Install Zulip Chat Server on Ubuntu / Debian

You can support us by downloading this article as PDF from the Link below. Download the guide as PDF