BBC MCP Tool v2.0 — Safe-by-Default WhatsApp Bot Builder
CORE PHILOSOPHY
v2.0 = v1 + Safety. Same tools, same BBC API, but with mandatory patterns that prevent
the silent failures, accidental deletions, and unvalidated deploys that plagued v1.
Three pillars:
- 1. VERIFY — After every mutating operation, call the corresponding
list_* to confirm - GATE — Before every destructive operation, show impact and require explicit "yes"
- RECOVER — When something fails, diagnose why and propose a fix, never just stop
TOOL REFERENCE (Quick)
| Tool | Purpose | Mutating? |
|---|
| INLINECODE1 | List all projects | No |
| INLINECODE2 |
Create project | Yes |
|
builderbot_list_flows | List flows in project | No |
|
builderbot_create_flow | Create flow with keywords | Yes |
|
builderbot_update_flow | Update flow config | Yes |
|
builderbot_delete_flow | Delete flow + all answers | Yes (DESTRUCTIVE) |
|
builderbot_list_answers | List answers in flow | No |
|
builderbot_create_answer | Add answer to flow | Yes |
|
builderbot_update_answer | Update answer content | Yes |
|
builderbot_delete_answer | Delete single answer | Yes (DESTRUCTIVE) |
|
builderbot_validate_bot | Health check before deploy | No |
|
builderbot_deploy | Deploy/status/QR/reboot/delete | Yes (some actions) |
MANDATORY PATTERNS
Pattern 1: VERIFY after every mutation
After ANY create/update/delete, call the corresponding list_* tool to confirm:
CODEBLOCK0
If verification fails: STOP, report the discrepancy, diagnose, and propose recovery.
Pattern 2: GATE before destructive actions
Before delete_flow, delete_answer, or deploy(action='delete'):
- 1. Show what will be affected (flow name, answer count, references)
- Show a clear warning: "⚠️ This cannot be undone"
- Wait for explicit user confirmation
- After execution, VERIFY the deletion
- Run
validate_bot to check for broken references
Pattern 3: RECOVER on failure
When any operation fails or verification shows a discrepancy:
- 1. Diagnose: Check limits (flow count), conflicts (duplicate keywords), permissions
- Report: Tell user exactly what went wrong
- Propose: Offer concrete fix (delete unused flow, rename keyword, retry)
- Execute: Fix with user approval, then VERIFY
FLOW CREATION RULES
create_flow parameters
CODEBLOCK1
CRITICAL RULES
- -
listenKeywords MUST be false for ALL flows EXCEPT INLINECODE20 - A new flow has 0 answers — the bot will NOT respond until you add answers
- Always add answers IMMEDIATELY after creating a flow
- Text keywords must be UNIQUE across all flows
- System events (EVENTS.) must not be mixed with text keywords
- Each EVENTS. can appear in only ONE flow
System Events Reference
| Event | Use case | Required flags |
|---|
| INLINECODE21 | Catch-all / fallback | listenKeywords: false |
| INLINECODE22 |
Voice message handler | listenKeywords: true, transcribeAudio: true |
|
EVENTS.MEDIA | Image handler | interpretImage: true |
|
EVENTS.DOCUMENT | Document handler | analyzeDocument: true |
|
EVENTS.LOCATION | Location shared | — |
|
EVENTS.ACTION | Button/list response | — |
ANSWER TYPES REFERENCE
add_text — Simple text message
CODEBLOCK2
add_chatpdf — AI-powered assistant (Pattern 2)
type: "add_chatpdf"
message: "" ← MUST be empty string
CRITICAL: NEVER mix
add_chatpdf with
add_text in the same flow.
Both fire on every message → broken double-response loop.
A flow with
add_chatpdf must contain ONLY the
add_chatpdf answer.
After creating, configure via update_answer with assistant field:
CODEBLOCK4
addimage / addvideo / adddoc / addvoice_note — Media
CODEBLOCK5
add_http — HTTP webhook/API call
type: "add_http"
message: ""
plugins: {
http: {
url: "https://api.example.com/endpoint",
method: "GET" | "POST",
headers: { "Content-Type": "application/json" }, // optional
body: { key: "value" }, // optional, for POST
rules: [] // REQUIRED — always include, even if empty
}
}
CRITICAL:
plugins.http.rules is REQUIRED. Omitting it causes backend rejection.
add_mute — Mute contact (human handoff)
type: "add_mute"
plugins: { mute: { status: true, gapTime: 60 } }
options: { gotoFlow: { flowId: "farewell-flow-uuid" } }
Mutes the INDIVIDUAL contact, not the whole bot.
gapTime = minutes until auto-unmute.
add_intent — AI semantic routing
CODEBLOCK8
Capture rule
options.capture = true → bot waits for user reply, passes it to NEXT answer.
NEVER set capture=true on the LAST answer of a flow — value is silently lost.
Redirect
options.gotoFlow = { flowId: "<target-flow-uuid>" } → redirect after this answer.
DECISION TREE: Which Pattern to Use
CODEBLOCK9
DEFAULT: Pattern 2 (AI-powered with add_chatpdf) for 80% of real cases.
Only use pure keyword → text flows for very simple, static information.
PATTERN TEMPLATES BY VERTICAL
Salon / Beauty / Services
- - WELCOME:
add_chatpdf with instructions about services, prices, availability - AI instructions must include: services list, hours, booking guidance, escalation trigger
- Escalation flow:
add_mute + human handoff - Knowledge base: scrape website with INLINECODE40
Restaurant / Food
- - WELCOME:
add_chatpdf with menu, hours, delivery info - Order flow: capture address + items via AI
- Location flow:
add_text with Google Maps link
E-commerce / Store
- - WELCOME:
add_chatpdf with catalog, pricing, shipping - Order status:
add_http to check order API - Support escalation: INLINECODE45
Content Creator / Digital Products
- - WELCOME:
add_chatpdf with product catalog, pricing - Purchase flow: redirect to payment link
- Support: AI handles FAQ, escalates complex issues
Forum / Event
- - WELCOME:
add_chatpdf with event details, schedule, registration - Registration: capture data +
add_http to registration API
COMPLETE WORKFLOW: Building a Bot
Step 1: Get or Create Project
CODEBLOCK10
Step 2: Plan Flows
Before creating anything, plan all flows and share the plan with user:
CODEBLOCK11
Step 3: Create Flows (one at a time)
For EACH flow:
CODEBLOCK12
NEVER create all flows first then add answers. Create flow → add answers → verify → next flow.
Step 4: Validate
CODEBLOCK13
Step 5: Deploy (with GATE)
CODEBLOCK14
ERROR HANDLING FRAMEWORK
Common Failures & Recovery
| Error | Diagnosis | Recovery |
|---|
| Flow created but not in list | Silent failure / API lag | Retry create, verify again |
| "Limit reached" |
50/50 flows used | List flows, find unused, offer to delete |
| Duplicate keyword | Keyword conflict | list_flows to find conflict, rename |
| Answer > 160 chars | WhatsApp truncation | Shorten message, verify |
| Deploy fails | Validation issues | Run validate_bot, fix all criticals |
| add
chatpdf + addtext in same flow | Double-response bug | Delete the add_text answer |
| capture=true on last answer | Dangling capture | Remove capture or add follow-up answer |
Batch Operations: Sequential with Verification
When creating multiple flows, ALWAYS do them sequentially:
CODEBLOCK15
NEVER batch-create all flows then batch-add answers. This hides partial failures.
FINAL REPORT FORMAT
After completing bot creation, always provide:
CODEBLOCK16
ANTI-PATTERNS (Never Do These)
- 1. ❌ Creating a flow without immediately adding answers
- ❌ Reporting success without verification (
list_*) - ❌ Deleting without showing impact and getting confirmation
- ❌ Deploying without running
validate_bot first - ❌ Mixing
add_chatpdf and add_text in the same flow - ❌ Setting
listenKeywords: true on non-VOICE_NOTE flows - ❌ Setting
capture: true on the last answer of a flow - ❌ Batch-creating all flows before adding answers
- ❌ Ignoring validation warnings about message length (>160 chars)
- ❌ Creating
add_http answers without INLINECODE56
REFERENCES
For vertical-specific templates and advanced patterns, read:
- -
references/verticals.md — Detailed bot templates per business type - INLINECODE58 — HTTP integrations, multi-flow routing, knowledge base setup
BBC MCP 工具 v2.0 — 默认安全的 WhatsApp 机器人构建器
核心理念
v2.0 = v1 + 安全性。相同的工具,相同的 BBC API,但增加了强制性模式,以防止困扰 v1 版本的静默失败、意外删除和未经验证的部署。
三大支柱:
- 1. 验证 — 每次变更操作后,调用相应的 list_* 进行确认
- 把关 — 每次破坏性操作前,展示影响范围并要求明确的是
- 恢复 — 当操作失败时,诊断原因并提出修复方案,绝不直接停止
工具参考(快速查阅)
| 工具 | 用途 | 是否变更数据 |
|---|
| builderbotlistprojects | 列出所有项目 | 否 |
| builderbotcreateproject |
创建项目 | 是 |
| builderbot
listflows | 列出项目中的流程 | 否 |
| builderbot
createflow | 创建带关键词的流程 | 是 |
| builderbot
updateflow | 更新流程配置 | 是 |
| builderbot
deleteflow | 删除流程及所有回复 | 是(破坏性) |
| builderbot
listanswers | 列出流程中的回复 | 否 |
| builderbot
createanswer | 向流程添加回复 | 是 |
| builderbot
updateanswer | 更新回复内容 | 是 |
| builderbot
deleteanswer | 删除单个回复 | 是(破坏性) |
| builderbot
validatebot | 部署前的健康检查 | 否 |
| builderbot_deploy | 部署/状态/二维码/重启/删除 | 是(部分操作) |
强制性模式
模式 1:每次变更后验证
在任何创建/更新/删除操作后,调用相应的 list_* 工具进行确认:
createflow(projectId, ...) → listflows(projectId) → 查找新创建的流程
createanswer(...) → listanswers(projectId, flowId) → 查找新创建的回复
updateanswer(...) → listanswers(projectId, flowId) → 确认内容已变更
deleteflow(...) → listflows(projectId) → 确认流程已被删除
如果验证失败:停止操作,报告差异,诊断问题,并提出恢复方案。
模式 2:破坏性操作前把关
在执行 deleteflow、deleteanswer 或 deploy(action=delete) 之前:
- 1. 展示将受影响的资源(流程名称、回复数量、引用关系)
- 显示明确警告:⚠️ 此操作不可撤销
- 等待用户明确确认
- 执行后,验证删除结果
- 运行 validate_bot 检查是否存在断开的引用
模式 3:失败时恢复
当任何操作失败或验证显示不一致时:
- 1. 诊断:检查限制(流程数量)、冲突(重复关键词)、权限
- 报告:准确告知用户问题所在
- 建议:提供具体的修复方案(删除未使用的流程、重命名关键词、重试)
- 执行:在用户批准后修复,然后验证
流程创建规则
create_flow 参数
projectId: UUID(来自 list_projects)
name: 人类可读名称(首字母大写,使用用户语言)
label: snakecaseslug(小写,无空格)
keywords: [keyword1, keyword2] 或 [EVENTS.WELCOME]
listenKeywords: false(除非是 EVENTS.VOICE_NOTE,否则始终为 false)
transcribeAudio: 仅对 EVENTS.VOICE_NOTE 为 true
interpretImage: 仅对 EVENTS.MEDIA 为 true
analyzeDocument: 仅对 EVENTS.DOCUMENT 为 true
关键规则
- - listenKeywords 必须为 false,除 EVENTS.VOICE_NOTE 外的所有流程
- 新创建的流程有 0 条回复 — 在添加回复前,机器人不会响应
- 创建流程后务必立即添加回复
- 文本关键词在所有流程中必须唯一
- 系统事件(EVENTS.)不得与文本关键词混合使用
- 每个 EVENTS. 只能出现在一个流程中
系统事件参考
| 事件 | 使用场景 | 必需标志 |
|---|
| EVENTS.WELCOME | 全捕获/后备 | listenKeywords: false |
| EVENTS.VOICE_NOTE |
语音消息处理 | listenKeywords: true, transcribeAudio: true |
| EVENTS.MEDIA | 图片处理 | interpretImage: true |
| EVENTS.DOCUMENT | 文档处理 | analyzeDocument: true |
| EVENTS.LOCATION | 位置分享 | — |
| EVENTS.ACTION | 按钮/列表响应 | — |
回复类型参考
add_text — 简单文本消息
type: add_text
message: 您的文本内容 ← WhatsApp 最多 160 字符
add_chatpdf — AI 驱动助手(模式 2)
type: add_chatpdf
message: ← 必须为空字符串
关键:切勿在同一流程中混合使用 addchatpdf 和 addtext。
两者都会在每条消息时触发 → 导致双响应的循环故障。
包含 addchatpdf 的流程必须只包含 addchatpdf 这一条回复。
创建后,通过 update_answer 配置 assistant 字段:
assistant: {
instructions: 您是[业务名称]的得力助手...,
model: gpt-5.4-nano (可选)
}
addimage / addvideo / adddoc / addvoice_note — 媒体
type: add_image
message:
options: { media: { url: https://public-url.com/image.jpg }, gotoFlow: {} }
add_http — HTTP 网络钩子/API 调用
type: add_http
message:
plugins: {
http: {
url: https://api.example.com/endpoint,
method: GET | POST,
headers: { Content-Type: application/json }, // 可选
body: { key: value }, // 可选,用于 POST
rules: [] // 必需 — 始终包含,即使为空
}
}
关键:plugins.http.rules 是必需的。省略会导致后端拒绝。
add_mute — 静默联系人(人工转接)
type: add_mute
plugins: { mute: { status: true, gapTime: 60 } }
options: { gotoFlow: { flowId: farewell-flow-uuid } }
静默的是单个联系人,而非整个机器人。gapTime = 自动取消静默前的分钟数。
add_intent — AI 语义路由
type: add_intent
plugins: {
intent: {
rules: [{
conditionRule: 用户想要与人工客服交谈,
conditionFlowId: ,
condition: ,
conditionValue:
}]
}
}
捕获规则
options.capture = true → 机器人等待用户回复,并将其传递给下一条回复。
切勿在流程的最后一条回复上设置 capture=true — 值会被静默丢弃。
重定向
options.gotoFlow = { flowId:
} → 在此回复后重定向。
决策树:使用哪种模式
用户请求 → 什么类型的业务?
├── 需要预约/排期/可用性 → 模式 2(AI)★ 推荐
├── 需要关于产品/服务的问答 → 模式 2(AI)
├── 需要订单追踪/状态查询 → 模式 2(AI)+ HTTP
├── 简单信息(营业时间、地址、菜单) → 模式 1(基于关键词)可行
├── 潜在客户生成/资格筛选 → 模式 2(AI)+ 捕获
└── 人工转接/升级 → 模式 2(AI)+ 静默
默认:80% 的实际案例使用模式 2(AI 驱动,配合 add_chatpdf)。
仅对非常简单的静态信息使用纯关键词 → 文本流程。
按行业分类的模式模板
沙龙 / 美容 / 服务
- - 欢迎:addchatpdf,包含关于服务、价格、可用性的说明
- AI 说明必须包含:服务列表、营业时间、预约指引、升级触发条件
- 升级流程:addmute + 人工转接
- 知识库: