Every small community or side project eventually hits the same wall: the same ten questions, asked over and over, in the chat, in the DMs, in your sleep. "How do I reset my password?" "What's the refund policy?" "Is there a mobile app?"
I wanted a bot that could absorb that repetitive load — but every solution I found had a catch:
- SaaS chat platforms charge per seat and your data sits on their servers
- LLM-based bots need API keys, cost money per message, and occasionally invent confident wrong answers
- Most open-source bots match only exact keywords and fall apart on messy real-world phrasing
So I built my own. The constraints I set:
- Python standard library only — no pip installs, no dependencies to rot
- A confidence threshold — if it's not sure, it says so and escalates to a human instead of guessing
- Non-technical maintenance — the person running the community edits one JSON file, never code
How it works
The whole thing is one file. The matching engine combines two signals:
- Keyword overlap (60%) — how many meaningful words the question shares with each FAQ entry
- Fuzzy similarity (40%) — a character-sequence similarity score, so "how do i get a refund" still matches "What's your refund policy?"
Every incoming message gets a confidence score from 0 to 1. Two thresholds decide what happens next:
confidence >= 0.55 → answer from the FAQ
0.35 - 0.55 → best guess, but flag it as uncertain
< 0.35 → escalate to a human, log the question
That middle band is the part I'm proudest of. A bot that answers "I don't know, let me get a human" is infinitely more valuable than one that confidently delivers nonsense.
The FAQ is just JSON
{
"question": "What's your refund policy?",
"variants": [
"can i get a refund",
"how do i get my money back",
"refund please"
],
"answer": "We offer refunds within 30 days of purchase. ..."
}
The community admin adds a block like this, restarts the bot, done. No code, no deploy pipeline, no developer in the loop.
Does it actually work?
I simulated a week of conversations — 77 messages covering the messy ways real people phrase things (typos, slang, half-sentences, questions nobody wrote an FAQ entry for).
Results:
- 87% resolved automatically
- 13% escalated to a human, with the full conversation log attached
- 0 confidently wrong answers — the thing I was most afraid of
It also keeps a weekly roll-up: total volume, top topics, resolution rate. After a month of logs you can see exactly which FAQ entries to write next, because the escalated questions tell you what's missing.
Try it
The full source, sample FAQ, and conversation logs are on GitHub:
👉 github.com/gu-shen/support-faq-bot
python3 bot.py
# open http://localhost:8000
It runs offline, no API keys, and the demo FAQ is included so you can poke at it immediately.
What I'd add for a real deployment
The demo is deliberately simple. For a paying client I'd extend the same architecture with:
- A connector to their real knowledge base instead of a JSON file
- Telegram / Discord / website embedding
- Per-channel settings (one instance, many channels)
- Webhook notifications when a human escalation happens
All of those are plumbing around the same matching engine — the core doesn't change.
I build custom automation like this for small businesses and communities — bots, data pipelines, reporting tools. If this bot would save you hours a week, you can hire me on Fiverr. Async, text-only, documented delivery.
Top comments (0)