A no-AI FAQ chatbot for your website. It reads your questions & answers from a Google Sheet and returns the most probable answer using fuzzy keyword matching (handles typos and synonyms). When it doesn't know an answer, it asks the customer for their phone number and details, which are saved for your team to follow up.
Rendering mermaid diagram...
- main.ts — HTTP entry point. Serves the chat UI and exposes
/api/chat,/api/lead, and/admin. - faq.ts — loads the sheet (CSV) and does the keyword matching. No AI.
- leads.ts — saves & lists captured leads in this val's SQLite database.
- index.html — the chat widget shown to your website visitors.
- admin.html — table of captured leads (search + CSV download).
First row must be headers. Columns (header names are matched case-insensitively):
| Question | Answer | Keywords (optional) |
|---|---|---|
| What are your opening hours? | We're open 9am–6pm Mon–Fri. | timing hours open close |
| Do you offer refunds? | Yes, within 30 days. | money back return |
The optional Keywords column improves matching — add synonyms customers might use that don't appear in the question itself.
In Google Sheets: File → Share → Publish to web, choose the tab, select Comma-separated values (.csv), and copy the link. Then set it as an env var:
👉 Add SHEET_CSV_URL here: https://www.val.town/x/microshieldmagics/customer-care-bot/environment-variables?key=SHEET_CSV_URL
Set a password so only you can view captured leads:
👉 Add ADMIN_KEY here: https://www.val.town/x/microshieldmagics/customer-care-bot/environment-variables?key=ADMIN_KEY
Then open the leads page at /admin?key=YOUR_KEY. If you don't set ADMIN_KEY,
/admin is open to anyone with the link.
- Web table: visit
/admin(or/admin?key=...) — search and "Download CSV". - Raw JSON:
/admin?format=json(same auth rules).
Add an iframe pointing at the val's URL:
<iframe src="https://YOUR-VAL-URL/" style="border:0;width:440px;height:720px"></iframe>
In faq.ts, CONFIDENCE_THRESHOLD controls how confident a match must be
before the bot answers (vs. asking for details). Raise it to be stricter (fewer
wrong answers, more "leave your details"); lower it to answer more often.