Smart Bot for Customer Service via WhatsApp

Context

Logic Solution aimed to enhance initial customer engagement through an agile, direct, and automated channel. The goal was to automate the first contact with users via WhatsApp, providing contextualized responses and facilitating appointment scheduling with company staff.

Objectives

  • Create a chatbot connected to WhatsApp capable of understanding and naturally responding to queries.
  • Provide enriched responses using internal company information through a RAG-based architecture.
  • Consult calendars to automatically manage appointment booking.
  • Ensure the system was scalable, modular, and deployable on Google Cloud.

Requirements

  • Direct integration with WhatsApp Business API.
  • Response capability using an LLM model.
  • Access to specific internal information (documentation).
  • Synchronization with Google Calendar or similar to check availability and create events.
  • Initially deployable architecture on Google Cloud Platform.
  • Reasonable costs, maintainability, and ease of deployment.

Implementation

The project was initially deployed on Google Cloud, with clearly defined components to ensure scalability, easy maintenance, and a smooth user experience.

The bot engine was developed using Cloud Functions and Firebase, utilizing GPT-4 mini via API to deliver contextual responses in natural language. This combination offered fast response times and the flexibility to scale as needed.

To enhance the model’s responses, a Retrieval-Augmented Generation (RAG) architecture was implemented. Relevant documents were stored in Cloud Storage, organized and versioned according to different business contexts. An automated system based on Pub/Sub detected new or modified files and generated the necessary embeddings to keep the knowledge base up to date and aligned with company content.

Additionally, the system was integrated with a predefined user’s calendar, adding a practical layer of utility. Thanks to the Microsoft Azure API, the bot was able to communicate directly with the user’s calendar services, avoiding manual intermediaries and delays.

This allowed it to check availability in real time, directly suggest convenient time slots to the client based on the calendar, handle confirmation based on replies, and finally create the appointment in the responsible person’s calendar. The entire process was executed smoothly, closing the loop between query and action with no need for human intervention.

This functionality represented a major step forward in automating business processes, removing the need for human intervention during the early stages of customer interaction.

Once successfully validated in the Google Cloud Platform environment, the entire system was replicated on AWS. The functional architecture remained equivalent, with components adapted to AWS services such as Lambda, S3, EventBridge, and DynamoDB, ensuring system portability and adaptability across cloud environments.

Conclusions

The system met all functional goals: it provided a fast and smooth user experience on WhatsApp, with contextualized responses and the ability to book appointments automatically.

However, as the system stabilized, it became clear that the complexity and cost associated with the RAG infrastructure were not justified given the simplicity and low volume of documents used to answer queries.

Still, the decision to implement a RAG setup proved highly valuable from a technical perspective: it was a real opportunity to deploy and operate a RAG system in a production environment, providing practical insight into its challenges, latency, maintenance, and costs.

Potential Improvements

  • More refined monitoring and quality control mechanisms to detect incorrectly answered questions.
  • Ability to extend the system to other channels (Telegram, Teams, web) via a modular multichannel architecture.
  • CRM integration to automatically log interactions and feed follow-up commercial actions.
  • Fix the style (bold, links…) of the text you generate.
  • It should feel like you’re talking to a person.

Leave a comment

Your email address will not be published. Required fields are marked *