Skip to content

skanda-machine/customer-support-chatbot

Repository files navigation

Customer Support NLU Pipeline

A modular, context-aware Natural Language Understanding (NLU) pipeline for customer support automation. The system accepts user utterances, classifies intents, manages multi-turn dialogue, and routes to the appropriate fulfillment handler.


Repository Structure

nlu-pipeline/
├── customer-support-agent/       # Rasa-based conversational AI bot
│   ├── config.yml                # NLU pipeline & dialogue policy config
│   ├── domain.yml                # Intents, entities, slots, responses
│   ├── credentials.yml           # Channel credentials (REST)
│   ├── endpoints.yml             # Custom action server endpoint
│   ├── requirements.txt          # Python dependencies
│   ├── setup.sh                  # One-shot environment bootstrap
│   ├── data/
│   │   ├── nlu.yml               # Training examples (intents & entities)
│   │   ├── stories.yml           # Multi-turn conversation flows
│   │   └── rules.yml             # Deterministic dialogue rules
│   └── actions/
│       └── actions.py            # Custom action handlers
│
├── customersupport-gateway/      # Scala 3 / Akka HTTP gateway service
│   ├── build.sbt                 # SBT build definition
│   ├── src/main/scala/           # HTTP routes, NLU server, utterance handler
│   └── src/test/scala/           # Unit & integration tests
│
├── customersupport-intent-toolkit/  # Scala utility for intent management
│   ├── build.sbt
│   └── src/                      # Intent training & testing utilities
│
└── fulfillment-api/              # Node.js fulfillment webhook
    └── index.js                  # Intent → fulfillment response handler

System Architecture

flowchart TD
    CLIENT["🖥️ Client / Channel\nREST · WebSocket · Voice · Chat widget"]

    subgraph GW["customersupport-gateway  (Scala 3 / Akka HTTP · :9191)"]
        AUTH["Auth & Session Manager\nauth token · correlation ID"]
        WS["WebSocket Handler"]
        KAFKA_PUB["Kafka Producer\nkafka-clients 3.6.1"]
    end

    subgraph BOT["customer-support-agent  (Rasa 3.6 · Python 3.10 · :5005)"]
        subgraph NLU["NLU Pipeline"]
            TOK["Tokenizer"]
            FEAT["Featurizers"]
            DIET["DIET Classifier"]
            FB["FallbackClassifier\nthreshold: 0.3"]
        end
        subgraph DM["Dialogue Manager"]
            RULE["RulePolicy"]
            MEMO["MemoizationPolicy"]
            TED["TEDPolicy\nmax_history: 5"]
        end
        SLOTS["Slots\nlocation · license_type"]
    end

    subgraph ACTIONS["actions/actions.py  (rasa-sdk · :5055)"]
        DMV_DB["DMV Hours DB lookup"]
        LIC["License order routing"]
    end

    FULFILLMENT["fulfillment-api\n(Node.js webhook)\nintent → fulfillment response"]

    KAFKA_DOWN["📊 Downstream Consumers\nanalytics · logging · monitoring"]

    CLIENT -->|user utterance| AUTH
    AUTH --> WS
    WS -->|HTTP POST /parse| NLU
    AUTH --> KAFKA_PUB
    KAFKA_PUB -->|Kafka topic| KAFKA_DOWN

    TOK --> FEAT --> DIET --> FB
    FB -->|intent + entities| DM
    DM --> SLOTS
    SLOTS -->|custom action call| ACTIONS
    DMV_DB --> LIC

    ACTIONS -->|intent + fulfillment params| FULFILLMENT
    FULFILLMENT -->|response| CLIENT
    BOT -->|bot reply| CLIENT
Loading

Modules

customer-support-agent — Rasa Conversational Bot

Context-aware chatbot handling DMV and license-related queries.

Layer Technology
Framework Rasa 3.6
Runtime Python 3.10
NLU DIET Classifier
Dialogue TEDPolicy + RulePolicy
Custom Actions rasa-sdk

Supported topics today:

  • DMV office hours (general, day-specific, location-specific)
  • Driver's license — new order, renewal, replacement, status check
cd customer-support-agent
./setup.sh            # installs Python 3.10 via pyenv + all deps
source venv/bin/activate
rasa train
rasa run actions &    # terminal 1 – action server on :5055
rasa shell            # terminal 2 – interactive chat

customersupport-gateway — Akka HTTP Gateway

Scala 3 service that acts as the entry point for all client connections.

Layer Technology
Language Scala 3.3.3
HTTP Akka HTTP 10.5.3
Messaging Apache Kafka 3.6.1 (kafka-clients)
NLP (optional) Stanford CoreNLP 4.5.4
Logging Logback 1.4.14
cd customersupport-gateway
sbt run               # starts HTTP + WebSocket server on :9191

Key endpoints:

POST /auth            # authenticate & start conversation session
WS   /chat            # WebSocket channel for real-time messaging

customersupport-intent-toolkit — Intent Utilities (Scala)

Standalone CLI / library for managing, testing, and exporting intents.

cd customersupport-intent-toolkit
sbt "run upd-app \"where is my license\" src/test/resources/creds.json"

# or build a fat jar
sbt assembly
java -jar target/scala-2.12/nlu-intent-toolkit-assembly-0.1.jar \
     upd "track my license" src/test/resources/creds.json

fulfillment-api — Node.js Fulfillment Webhook

Receives classified intents from the gateway and returns fulfillment data.

cd fulfillment-api
node index.js         # starts webhook server

Quick Start (full stack)

# 1. Bot – train & start
cd customer-support-agent && ./setup.sh
source venv/bin/activate && rasa train
rasa run actions &
rasa run --enable-api --cors "*" &   # Rasa REST on :5005

# 2. Gateway – compile & run
cd ../customersupport-gateway && sbt run   # :9191

# 3. Fulfillment webhook
cd ../fulfillment-api && node index.js

# 4. Send a test message
curl -X POST http://localhost:9191/auth \
  -H "Content-Type: application/json" \
  -d '{
    "authToken": "token-abc",
    "correlationID": "c494cc73-371c-4efa-845c-8727cd9b6079",
    "msgTimestamp": "2026-03-29T10:00:00.000",
    "name": "Jane Doe",
    "userID": "user-001",
    "loyalty": 1
  }'

Tech Stack Summary

Component Language Key Libraries
customer-support-agent Python 3.10 Rasa 3.6, rasa-sdk
customersupport-gateway Scala 3.3.3 Akka HTTP, Akka Streams, Kafka
customersupport-intent-toolkit Scala 2.12 sbt-assembly
fulfillment-api Node.js Express

Requirements

Tool Version
Python 3.10.x (via pyenv)
Java 11+
sbt 1.x
Node.js 16+
Apache Kafka 3.x (for gateway event streaming)

References