Building a Customer Support Bot for a Business Website: is PHP the Right Choice?

Andrei Klubnikin
DataDrivenInvestor
Published in
7 min readOct 11, 2018

--

What do we expect from a customer support department in the digital era?

First, it’s faster response time: as of now, it takes companies a little over 12 hours to address service requests, customer questions and complaints sent via a website form.

Second, it’s five-star website user experience: although mobile search is projected to generate 27.8 billion more queries than desktop this year, 90% of consumers admit they’ve had poor experience while seeking support on mobile.

Finally, it’s the “always-on” approach to customer service: the majority of customers (43% and growing) expect companies to be available 24/7.

Failure to meet these basic needs may cost your B2C company a fortune (if not drive you out of business entirely).

Web chatbots — lightweight keyword-triggered or AI-based conversational applications designed to answer questions in a human-like manner and assist users in navigating websites — can help businesses automate customer support, improve service and increase content discoverability. While Python is widely recognized as an across-the-board solution for Natural Language Processing (NLP) programming, there are cases when businesses have to turn to mature programming languages like PHP to create conversational applications. This may be required if you have a large existing PHP codebase (after all, the language powers 80% of all websites out there!) or an in-house team of skilled PHP developers.

Is PHP really suitable for chatbot development?

What Makes PHP the Go-to Technology Stack for Website Chatbots?

With its versatile open-source NLP and Machine Learning (ML) libraries such as NLTK and TextBlob, Python is today’s Swiss Army knife language for chatbot development. Provided you address an experienced software vendor, you can integrate a Python conversational program with a Drupal-, WordPress- or Laravel-based website; however, this would require special extensions like Python in PHP (PiP) and extra development hours.

You can also make do with what you have and create a PHP bot instead.

Despite everything you’ve probably heard about the language (it’s often labelled as insecure and unfit for large business-grade applications), PHP — and its latest version in particular — do in fact allow developers to design smart bots for websites and popular messaging applications.

Here are several reasons to build a customer service bot in PHP:

  • Availability of frameworks & platforms for chatbot development. There are several reliable PHP frameworks including BotMan and the Laravel-based FondBot which enable software vendors to create virtual assistants for web channels, popular mobile messengers and voice-based services. Both frameworks are designed to produce well-structured and easily maintainable code and can be either merged into an existing codebase or facilitate bot development from scratch. You can also implement a 3rd-party cloud-based AI platform (Microsoft Bot Framework, Pandorabots, Dialogflow) with baked-in language processing capabilities and out-of-the-box templates for various customer support scenarios to reduce time to market and optimize development budget.
  • Serversless approach to bot development & message processing. With PHP, you can unlock the power of 3rd-party Back-end as a Service (BaaS) and event-triggered Functions as a Service (FaaS) solutions like AWS Lambda. What does this mean for your business? First and foremost, it’s cost reduction, as you don’t need servers to run chatbot code and manage historical chat data and pay only for code execution. Second, it’s increased bot scalability — namely, the ability to handle more requests and enhance the program’s functionality without major coding.
  • Rapid development & cost efficiency. While the so-called AI-friendly languages like Python might provide better overall performance at runtime, PHP is the essential tool to get a web solution up and running in record time — and that’s what most businesses usually seek. It doesn’t make the language a start-up only solution, though. With the release of PHP 7, a version designed for continuous performance optimization through faster code execution, efficient memory usage and focus on security, developers are able to create business-grade web solutions including those with conversational interfaces. PHP enjoys great community support and, being a mature language, boasts a larger talent pool of skilled developers to choose from.

Last but not least, you can draw a lot of similarities between the workflows of PHP-based websites and chatbots: in both cases, a user’s request coming from a browser is analyzed by a web server which runs PHP code; the server than asks for information, receives it from a database and returns it to the browser where the data is visualized. If you intend to build a chatbot for Facebook Messenger or Telegram, you only have to send an HTTP request to the messaging app to wrap up the request instead of simply displaying HTML in the browser.

There are more similarities between PHP websites & chatbots than you think

That being said, web channels offer a lot more opportunities for conversational elements’ customization, thus enabling companies to create virtual customer assistants complementing their brand identity.

Closer Look at Website Customer Support Bot Functionality & Architecture

There are two types of website chatbots you can build with PHP:

  • Flow-oriented bots, which identify keywords in customer queries and allow users to choose between preset options. Keyword-triggered bots do not attempt to come off as human assistants and are designed to deal with Tier 1 questions by retrieving the data from your FAQ base.
  • Smart bots with NLP capabilities, which are specifically trained to process customer replies on the go, categorize them and generate context-based replies. It’s worth mentioning that the current level of AI development neither offers a one-size-fits-all solution for understanding customer intent nor goes beyond standard Machine Learning approaches to determining semantic relations between words in a free text.

Both AI-based and keyword-triggered chatbots have a pretty straightforward flow and architecture. They greet users and engage in a conversation; based on a user’s messages, the program provides an answer, suggests visiting a particular FAQ category or connects the customer to a human specialist. At the moment, chatbots are mostly capable of handling up to 80% of tier 1 support questions; tier 2–3 questions typically require human interference.

Basic Chatbot Architecture

How to Build a Bot: 4 Steps to Stellar Conversational Experience

Before you address a PHP development services company, you and your team should develop a clear vision for your chatbot and make sure it does deliver value to your customers:

  • Set your goals. Do not create conversational experiences for your customers simply because “chatbot” is a new buzzword and you need one just “to be there”. The decision should be based on a thorough market research and certain objective you’d like to reach — for instance, provide superior customer support or reduce customer support expenses by 20%.
  • Define your audience & their context. There’s a million ways your audience can reach out to a virtual support agent: they might be sitting at a computer at home, visiting your website on mobile or using Amazon Echo. Furthermore, your customers diverse; depending on their age and digital habits, you may adopt a different feel and tone of a chatbot and opt for certain bot UI components.
  • Outline chatbot functionality requirements. Your journey to customer support automaton should start with a detailed scenario covering the tasks your chatbot will be able to perform, the types of information it’s going to provide and a list of resources it will retrieve the data from. Furthermore, you should determine whether there will be a human specialist ready to take over once the smart program runs out of questions or encounters an unfamiliar problem.
  • Decide what type of bot you need. As we mentioned earlier, there are two major types of website chatbots. Linear bots are cheaper to build, but may not provide the level of automation you seek. Building a Machine Learning-based bot can be a weight off your employees’ shoulders — and a great opportunity to devote more time to creative work. However, such chatbots require a considerable amount of training data (including chat log history) and at least 200 hours of coding to tweak ready-made NLP tools the right way. What type of a virtual assistant should you opt for? It all depends on your initial functional requirements, the complexity of your product and your development budget.

To sum it up, building a customer support chatbot in PHP is a doable task — and it makes even more sense in the context of your existing PHP code environment than doing the whole thing in Python, Ruby or Clojure.

Does your company use a customer service bot? What technology stack is it powered by? Let us know in the comments below!

--

--

Content marketer. Tech blogger. Passionate reader. Yoga amateur. Cat dad.