WhatsApp FAQ Bot
Build a searchable knowledge base from markdown files. Match incoming questions to the best FAQ answer using fuzzy text matching.
Quick Start
CODEBLOCK0
Commands
| Command | Args | Description |
|---|
| INLINECODE0 | | Create a new empty knowledge base |
| INLINECODE1 |
-q QUESTION -a ANSWER [-t TAGS] | Add a single FAQ entry |
|
import |
<file.md> | Import FAQs from markdown (H2 = question, body = answer) |
|
search |
<query> [--top N] [--threshold T] | Find best matching answer(s) |
|
list |
[--tag TAG] | List all FAQ entries |
|
remove |
<id> | Remove a FAQ entry |
|
export |
[--format md\|json] [-o FILE] | Export knowledge base |
|
stats | | Show knowledge base statistics |
Markdown Import Format
CODEBLOCK1
Each H2 heading becomes a question, the body below becomes the answer.
Search Scoring
- - Uses TF-IDF-like fuzzy matching on question text
- Returns confidence score (0.0 to 1.0)
- Default threshold: 0.3 (adjustable with
--threshold) - Returns top 3 matches by default (adjustable with
--top)
Integration with OpenClaw
This skill is designed to work as a WhatsApp FAQ bot. When a user asks a question, the agent can use the search command to find the best match and respond automatically. Configure it in your cron or agent system prompt.
WhatsApp 常见问题解答机器人
从Markdown文件构建可搜索的知识库。使用模糊文本匹配将传入的问题与最佳常见问题解答答案进行匹配。
快速开始
bash
初始化一个新的常见问题知识库
python scripts/faqbot.py init
交互式添加常见问题条目
python scripts/faqbot.py add -q 你们的营业时间是? -a 我们周一至周五,欧洲中部时间上午9点至下午6点营业。
从Markdown文件导入常见问题
python scripts/faqbot.py import faq-source.md
搜索最佳匹配答案
python scripts/faqbot.py search 你们什么时候营业
列出所有常见问题条目
python scripts/faqbot.py list
将所有常见问题导出为Markdown
python scripts/faqbot.py export --format md -o faqs-export.md
导出为JSON
python scripts/faqbot.py export --format json -o faqs.json
按ID删除常见问题条目
python scripts/faqbot.py remove 3
获取知识库统计信息
python scripts/faqbot.py stats
命令
-q 问题 -a 答案 [-t 标签] | 添加单个常见问题条目 |
| import | <文件.md> | 从Markdown导入常见问题(H2 = 问题,正文 = 答案) |
| search | <查询> [--top N] [--threshold T] | 查找最佳匹配答案 |
| list | [--tag 标签] | 列出所有常见问题条目 |
| remove |
| 删除常见问题条目 |
| export | [--format md\|json] [-o 文件] | 导出知识库 |
| stats | | 显示知识库统计信息 |
Markdown导入格式
markdown
你们的营业时间是?
我们周一至周五,欧洲中部时间上午9点至下午6点营业。
周末仅通过电子邮件提供支持。
如何重置密码?
前往设置 > 账户 > 重置密码。
您将收到一封包含重置链接的电子邮件。
你们接受哪些支付方式?
我们接受:
- - 信用卡/借记卡(Visa、Mastercard)
- PayPal
- 银行转账(仅限欧盟)
每个H2标题成为一个问题,下方的正文成为答案。
搜索评分
- - 对问题文本使用类似TF-IDF的模糊匹配
- 返回置信度分数(0.0到1.0)
- 默认阈值:0.3(可通过--threshold调整)
- 默认返回前3个匹配结果(可通过--top调整)
与OpenClaw集成
此技能旨在作为WhatsApp常见问题解答机器人使用。当用户提问时,代理可以使用search命令查找最佳匹配并自动回复。在您的cron或代理系统提示中进行配置。