Allow Access to Live Helper Chat REST API

Currently, we use Live Helper Chat from our main corporate website, to allow customers to chat directly to our customer services team.

We are in the process of developing a mobile app and a new microsite for out customers. We want to provide chat functionality from these new platforms.

Live Helper Chat comes with a fairly comprehensive REST API, which the mobile app can use, to allow the customer to chat with customer services.

Unfortunately, out of the box, our Bitnami installation of Live Helper Chat breaks access to the REST API.

API calls require an Authorization header, Apache filters this header out. So all of our calls to the API resulted in a “Authorization header is missing!” response.

The solution is very simple, once you have spent ages working out what it is.

Adding this line

SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1

To the bitnami.conf file, within the virtual host section allows the Authorization header to be passed to the API

<VirtualHost _default_:80>
  SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1

The bitnami.conf file is here

/opt/bitnami/apache2/conf/bitnami/bitnami.conf

Fix Bitnami Query String Stripping

If you want to use the Live Helper Chat API, and you are using the Bitnami version, there is another problem which you will need to fix.

By default, the htaccess file rewrite rules will strip out any query strings from URLs, many calls to the API rely on query strings, they will not work with the default Bitnami rewrite rules.

Look for the htaccess.conf file, which should be here

/opt/bitnami/apps/livehelperchat/conf/htaccess.conf

and change this line

RewriteRule ^(.*)?$ index.php?/$1 [L]

to this

RewriteRule ^(.*)?$ index.php?/$1 [L,QSA]

Terraform / Azure VM

We have recently added new chat functionality to our companies website using an open source project called Live Helper Chat, it is an excellent piece of software which allows customers looking on our website to talk directly to our Customer Service Team.

This project was undertaken at pace, the project manager made use of the fact that there is a Bitnami Virtual Machine in Azure for Live Helper Chat that they could install with a single click directly into the production environment.

This enabled us to get the new chat functionality up and running very quickly. In the longer term it did create some challenges

  • Various configuration changes were made to the virtual machine to allow it to meet our security requirements
  • Various configuration changes were made to the application to provide the functionality we require for our customers and customer services team
  • The VM runs MySQL as well as the web application and yet our systems architecture team call for it to be high availability and resilient
  • The IG team require the database to be backed up
  • Future work is envisioned which may require changes to the configuration or code
  • The Live Helper Chat application is updated frequently and we want to keep up with the latest updates where possible

The first challenge is that we had no way of immediately replicating the production set up anywhere else short of cloning the VM into other environments. The lack of the system in any other environments means it is impossible to test any changes.

Using Terraform / Ansible to Deploy An Azure VM

We use DevOps to deploy our solutions for everything else, so I wanted a pipeline in DevOps which could do the following

  • Create an instance of the Bitnami Live Helper Chat in a designated subscription/resource group
  • Provide the network related artefacts which are normally created when you create a Bitnami VM in Azure
  • Apply the post deployment configuration to the Bitnami VM
  • Import a baseline MySQL database to provide the application with enough functionality for it to be useable, user accounts etc
  • Deploy a test website which incorporates the Live Helper Chat widget so that people can use it as they would use the production system, for testing and demonstration purposes primarily

There are a variety of tools I could have used, these are the ones I have chosen

  • Terraform to configure the Azure Resource Groups and create an instance of the VM and associated network artefacts
  • Ansible to deploy the post deployment configuration to the VM and import the baseline database
  • Azure Storage Account web hosting for the test website
  • DevOps Build/Release pipelines to orchestrate the above
  • DevOps git repository to hold all of the code for this process