AI Chatbot for Customer Service: How to Build One

Chatbot that answers from your documents + company data. Without OpenAI. On your server. We explain building step by step with Flowise or Langflow.
Build an AI Chatbot for Customer Service
An AI chatbot automatically answers repetitive customer questions — 24/7, no delays. Companies using AI chatbots reduce support tickets by 40-60% and cut initial response time from hours to seconds. Unlike traditional menu-based chatbots, AI chatbots understand questions in any phrasing and respond from a knowledge base, not pre-defined options.
How an AI Chatbot Works
Customer sends question (free text)
↓
Chatbot analyzes the question (NLP)
↓
Searches the knowledge base (RAG)
↓
Generates a custom response in natural language
↓
Sends response to customer
↓
If it can't answer → transfers to human agent
According to Gartner's 2025 report, 68% of customer service interactions in mid-sized companies will be handled by AI chatbots by 2027 — up from 34% in 2024.
Technical Options
Option 1: Langflow + Open WebUI (Self-hosted)
Best for: Companies wanting full control and data privacy
- Langflow for visual workflow building (drag & drop)
- Open WebUI as the chat interface
- Ollama for running the model locally
- Cost: competitive pricing — pricing and plans (Business package) — no per-operation fees
Option 2: n8n + Ollama (Self-hosted)
Best for: Companies wanting to integrate chatbot with internal systems
- n8n receives messages from WhatsApp or website
- Routes to Ollama model for analysis
- Takes action (reply, classify, transfer)
- Cost: competitive pricing — pricing and plans (Growth package)
Option 3: External API (OpenAI / Claude)
Best for: Projects requiring highest response quality
- More accurate and intelligent responses — especially in Arabic
- Variable cost based on usage
- Cost: 500-5,000+ SAR/month depending on message volume
Building a Customer Service Chatbot — Step by Step
Step 1: Prepare the Knowledge Base
The knowledge base is what the chatbot searches to answer questions:
- FAQ: Write the top 50-100 questions with answers
- Product info: Specs, pricing, terms
- Company policies: Returns, warranty, shipping
- Support procedures: Steps for resolving common issues
Tip: Start with the 20 most common questions — these cover 80% of customer inquiries.
Step 2: Choose Platform and Install
Using Langflow on CLOUD:
docker run -d \
--name langflow \
--restart always \
-p 7860:7860 \
-v langflow-data:/app/data \
langflowai/langflow:latest
Step 3: Build the RAG Pipeline
In Langflow:
- Add "Document Loader" — upload knowledge base files
- Add "Text Splitter" — chunks content into searchable pieces
- Add "Vector Store" (ChromaDB) — stores content for semantic search
- Add "Chat Model" (Ollama or OpenAI) — the model generating responses
- Connect components — test
Step 4: Connect Communication Channels
WhatsApp: Via WhatsApp Business API + n8n webhook Website: Add a chat widget connecting to the chatbot via API Email: n8n monitors inbox, analyzes messages, replies or transfers
Step 5: Add Smart Boundaries
- Confidence threshold: Below 70% confidence → transfer to human
- Transfer keywords: "I want to speak to an agent" → immediate transfer
- Attempt limit: 3 questions without satisfactory answer → auto-transfer
- Business hours: After hours = chatbot only. Business hours = chatbot + transfer available
Measuring Chatbot Performance
| Metric | Target |
|---|---|
| Resolution without human intervention | 60-80% |
| Response time | Under 3 seconds |
| Customer satisfaction (CSAT) | 4+ out of 5 |
| Transfer rate to human | Under 30% |
Running Cost on CLOUD
| Component | Package | Annual Price |
|---|---|---|
| Langflow + Ollama | Business (4 vCPU, 8 GB) | competitive pricing — pricing and plans |
| n8n + Ollama | Growth (2 vCPU, 4 GB) | competitive pricing — pricing and plans |
| Both combined | Enterprise (8 vCPU, 16 GB) | competitive pricing — pricing and plans |
Comparison: Off-the-shelf AI chatbot services (Intercom, Drift) start at 3,000+ SAR/month (36,000+ annually) with conversation limits. Your own server = lower fixed cost with no limits.
Get Started
Ready to run AI on your own server? Explore AI hosting solutions or configure your server with the specs you need.


