Close Menu
    Trending
    • How to Access NASA’s Climate Data — And How It’s Powering the Fight Against Climate Change Pt. 1
    • From Training to Drift Monitoring: End-to-End Fraud Detection in Python | by Aakash Chavan Ravindranath, Ph.D | Jul, 2025
    • Using Graph Databases to Model Patient Journeys and Clinical Relationships
    • Cuba’s Energy Crisis: A Systemic Breakdown
    • AI Startup TML From Ex-OpenAI Exec Mira Murati Pays $500,000
    • STOP Building Useless ML Projects – What Actually Works
    • Credit Risk Scoring for BNPL Customers at Bati Bank | by Sumeya sirmula | Jul, 2025
    • The New Career Crisis: AI Is Breaking the Entry-Level Path for Gen Z
    AIBS News
    • Home
    • Artificial Intelligence
    • Machine Learning
    • AI Technology
    • Data Science
    • More
      • Technology
      • Business
    AIBS News
    Home»Machine Learning»Charlie: A simple and practical architecture for a WhatsApp Bot | by Márcio Oliveira | May, 2025
    Machine Learning

    Charlie: A simple and practical architecture for a WhatsApp Bot | by Márcio Oliveira | May, 2025

    Team_AIBS NewsBy Team_AIBS NewsMay 28, 2025No Comments4 Mins Read
    Share Facebook Twitter Pinterest LinkedIn Tumblr Reddit Telegram Email
    Share
    Facebook Twitter LinkedIn Pinterest Email


    Charlie: A easy and sensible WhatsApp Bot

    Many people are fascinated by the potential of AI in real-world functions. Following my earlier exploration of AI assistants with Whisper and GPT-3.5, I made a decision to sort out a extra basic problem: constructing a easy basis for WhatsApp bots.

    Removed from being a wise assistant extremely built-in with giant language fashions, Charlie was born out of sheer curiosity: how do you truly construct a bot for WhatsApp? The purpose wasn’t to create a really “clever” assistant, however moderately to design a basis that would evolve with excessive availability, scalability, and full management over system conduct. This text presents Charlie’s microservice structure as a case research for builders interested by constructing related tasks.

    Right here is the open-source repository.

    Whereas instruments like n8n excel at fast prototyping, they typically fall quick in relation to customization, efficiency optimization, and actually understanding architectural nuances. Charlie was conceived as a hands-on studying expertise, a fast dive into message queues, decoupled companies, and distributed deployments. These ideas are finest grasped by means of coding.

    Communication with WhatsApp is dealt with by way of the Evolution API. To make sure scalability and resilience, Charlie’s structure is predicated on microservices interconnected by means of a message dealer. The diagram beneath illustrates this construction:

    Charlie’s Structure

    Let’s break down the important thing parts:

    1. Evolution API: Acts as our bidirectional interface with WhatsApp, receiving and sending messages.
    2. Enqueuer Webhook: Liable for intercepting incoming messages from the Evolution API. It parses the payload and instantly queues the message into the Incoming Messages Queue (IMQ), guaranteeing decoupled reception and processing.
    3. RabbitMQ Occasion: The center of asynchronous communication.
      – Incoming Messages Queue (IMQ — FANOUT): This queue receives all uncooked messages from the Enqueuer. The FANOUT kind permits a number of customers to take heed to the identical message. Within the present setup, the Intent Parser Service is the primary client, however this provides flexibility for future parts (e.g., logging, auditing).
      – Outgoing Messages Queue (OMQ): Bot-generated responses are positioned on this queue earlier than being dispatched to customers.
    4. Intent Parser Service: The mind of Charlie. This service consumes messages from the IMQ and performs Pure Language Processing (NLP) to detect consumer intent. It at present helps: Greetings, Day by day Fortune, a Bible Verse and a Fitness center Motivation. As soon as the intent is recognized and the response generated, it’s despatched to the OMQ.
    5. Dispatcher Service: The ultimate executor. It consumes messages from the OMQ and sends them again to the consumer by way of the Evolution API.

    Bonus: Few-Shot Intent Classifier
    Underneath the intent parser service, you can see a pocket book for coaching the intent classifier utilizing a SentenceTransformer. The method consisted of fine-tuning the pre-trained sentence-transformers/paraphrase-MiniLM-L6-v2 mannequin utilizing a small set of coaching examples (simply 50 samples throughout 5 intent courses) — a method often called few-shot studying. With this small dataset, the mannequin is ready to detect consumer intent based mostly on the semantic similarity of phrases, leveraging the facility of embedding representations.

    The choice to make use of microservices and message queues is much from arbitrary. It addresses key challenges in distributed programs:

    • Excessive Availability: A failure in a single service doesn’t carry down your entire system; messages persist in queues till the service recovers.
    • Horizontal Scalability: Every service can scale independently, optimizing useful resource utilization.
    • Decoupling: Autonomous companies simplify improvement, upkeep, and deployment, enabling unbiased groups.
    • Resilience: Queues act as buffers, absorbing site visitors spikes and shielding companies from overload.

    This structure might be simply prolonged right into a extra subtle construction, incorporating load balancers, partitioning, and adapting seamlessly to your particular necessities.

    Though Charlie’s structure is microservice-based, it’s organized as a monorepo. For a studying undertaking or a foundational prototype like this, a monorepo affords a number of benefits:

    • Simplified Improvement: All companies reside in the identical repository, making it simpler to navigate, refactor, and share code.
    • Dependency Administration: Simpler administration of variations and shared dependencies.
    • Holistic Visibility: Supplies a transparent view of your entire system.

    The monorepo vs. polyrepo debate is past the scope of this submit. However right here’s the concept: create a department for every service and comply with your most popular Git move. As soon as the whole lot is completed, examined, and effectively validated, open a pull request to the primary monorepo department. Easy.

    Charlie fulfilled its goal as a studying atmosphere and prototyping floor for microservices and messaging API integration, with a contact of machine studying by means of the intent classifier. Though it’s a “toy undertaking,” the structure and ideas carried out right here function a basis for constructing scalable and resilient WhatsApp bots.

    I invite you to discover the Charlie repository on GitHub and use it as inspiration. I hope you’ve loved this text — and should the code be with you!



    Source link

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Previous ArticleTelegram announces partnership with Musk’s xAI
    Next Article The AI Hype Index: College students are hooked on ChatGPT
    Team_AIBS News
    • Website

    Related Posts

    Machine Learning

    From Training to Drift Monitoring: End-to-End Fraud Detection in Python | by Aakash Chavan Ravindranath, Ph.D | Jul, 2025

    July 1, 2025
    Machine Learning

    Credit Risk Scoring for BNPL Customers at Bati Bank | by Sumeya sirmula | Jul, 2025

    July 1, 2025
    Machine Learning

    Why PDF Extraction Still Feels LikeHack

    July 1, 2025
    Add A Comment
    Leave A Reply Cancel Reply

    Top Posts

    How to Access NASA’s Climate Data — And How It’s Powering the Fight Against Climate Change Pt. 1

    July 1, 2025

    I Tried Buying a Car Through Amazon: Here Are the Pros, Cons

    December 10, 2024

    Amazon and eBay to pay ‘fair share’ for e-waste recycling

    December 10, 2024

    Artificial Intelligence Concerns & Predictions For 2025

    December 10, 2024

    Barbara Corcoran: Entrepreneurs Must ‘Embrace Change’

    December 10, 2024
    Categories
    • AI Technology
    • Artificial Intelligence
    • Business
    • Data Science
    • Machine Learning
    • Technology
    Most Popular

    TikTok, RedNote and the Crushed Promise of the Chinese Internet

    January 20, 2025

    Unlocking the Power of Multimodal AI with Google Cloud: My Journey with Gemini and RAG | by Anveshikashukla | Apr, 2025

    April 30, 2025

    AI for Software Engineers: Evolve, Don’t Restart | by Rahul Suresh | Tech Leadership Unlocked | Jan, 2025

    January 3, 2025
    Our Picks

    How to Access NASA’s Climate Data — And How It’s Powering the Fight Against Climate Change Pt. 1

    July 1, 2025

    From Training to Drift Monitoring: End-to-End Fraud Detection in Python | by Aakash Chavan Ravindranath, Ph.D | Jul, 2025

    July 1, 2025

    Using Graph Databases to Model Patient Journeys and Clinical Relationships

    July 1, 2025
    Categories
    • AI Technology
    • Artificial Intelligence
    • Business
    • Data Science
    • Machine Learning
    • Technology
    • Privacy Policy
    • Disclaimer
    • Terms and Conditions
    • About us
    • Contact us
    Copyright © 2024 Aibsnews.comAll Rights Reserved.

    Type above and press Enter to search. Press Esc to cancel.