🔨 Building with Voiceflow
Xây dựng AI agent hoàn chỉnh với advanced features.
Project: Support Agent
What We'll Build
Text
1Support Agent capabilities:2- Answer FAQs3- Track orders4- Handle complaints5- Escalate to human6- Knowledge base searchSetting Up Knowledge Base
Why Knowledge Base?
Text
1Instead of:2- Hard-coding every answer3- Creating endless flows4 5Use Knowledge Base:6- Upload documents7- Agent searches & answers8- Easy to update9- Scales betterAdding Knowledge
Text
1Steps:21. Go to Knowledge Base section32. Click "Add Data Source"43. Options:5 - Upload files (PDF, TXT)6 - Add URLs7 - Manual text entry84. Process documents95. Agent can now searchDocument Types
Text
1Supported:2- PDF documents3- Text files4- Web pages (URLs)5- CSV/spreadsheets6- Google Docs (via URL)Building FAQ Flow
Knowledge Base Block
Text
1Setup:21. Add "AI Knowledge" block32. Configure:4 - Question: {last_utterance}5 - Search knowledge base6 - Generate answer73. Handle no results:8 - Fallback message9 - Offer alternativesExample Flow
Text
1┌─────────┐ ┌───────────┐ ┌──────────┐2│ User │────▶│ Knowledge │────▶│ Response │3│ Question│ │ Search │ │ │4└─────────┘ └───────────┘ └──────────┘5 │6 ▼ (not found)7 ┌────────────┐8 │ Fallback: │9 │ "Let me │10 │ connect │11 │ you..." │12 └────────────┘Order Tracking Flow
Collecting Order Number
Text
1Flow:21. "What's your order number?"32. Listen block (capture entity)43. Validate format54. Call API to get status65. Display resultEntity Extraction
Text
1Listen block config:2- Custom entity: @order_number3- Pattern: alphanumeric4- Store in: {order_number}API Integration
Text
1Integration block:21. Add "Integration" block32. Select "Custom API"43. Configure:5 - URL: https://api.store.com/orders/{order_number}6 - Method: GET7 - Headers: API key84. Store response in variableDisplay Results
Text
1Parse API response:21. Set variables from response3 - {order_status}4 - {delivery_date}5 - {tracking_url}6 72. Talk block:8 "Your order #{order_number}9 Status: {order_status}10 Expected: {delivery_date}11 Track: {tracking_url}"Complaint Handling Flow
Sentiment Detection
Text
1Before routing:21. Analyze message sentiment32. Route accordingly:4 - Positive → Normal flow5 - Negative → Empathy response6 - Very negative → Human handoffEmpathy Responses
Text
1AI Response block:2"You are a customer service agent.3The customer is frustrated about: {last_utterance}4 5Respond with:61. Acknowledge their frustration72. Apologize sincerely83. Offer specific help94. Keep it brief (2-3 sentences)"Escalation Flow
Text
1When to escalate:2- User requests human3- Multiple failures4- High sentiment score5- Specific keywords6 7Escalation block:81. Collect user info92. Create support ticket103. Notify team114. Confirm to userUsing Conditions
If/Else Logic
Text
1Condition block:2If {order_status} = "delivered"3 → "Your order was delivered on {date}"4Else if {order_status} = "shipped"5 → "Your order is on the way!"6Else7 → "We're preparing your order"Multiple Conditions
Text
1Chain conditions:21. Check intent32. Check entity values43. Check variables54. Check time/dateExpression Examples
Text
1Comparisons:2- {value} = "text"3- {number} > 1004- {status} != "cancelled"5 6Logic:7- {a} AND {b}8- {a} OR {b}9- NOT {condition}10 11Contains:12- {text} contains "refund"Set Variables Block
Calculate Values
Text
1Set block uses:2- Store user input3- Calculate values4- Transform data5- Set flags6 7Examples:8- {total} = {price} * {quantity}9- {is_premium} = true10- {formatted_date} = format({date})Arrays/Lists
Text
1Working with lists:2- {items} = push({items}, "new item")3- {first} = {items}[0]4- {count} = length({items})Go-To Block
Navigate Flows
Text
1Reuse flows:21. Create sub-flow (e.g., "Collect Email")32. Use Go-To to jump to flow43. Return when complete54. Avoid duplicationTopic Jumping
Text
1Let users switch topics:2User: "Actually, I want to track an order"3 4Go-To block:5- Detect intent change6- Jump to relevant flow7- Maintain context if neededCarousels & Cards
Rich Responses
Text
1Beyond text responses:2- Image cards3- Carousels4- Buttons5- Quick replies6- LinksCarousel Setup
Text
1Display products:21. Add Carousel block32. Configure cards:4 - Image5 - Title6 - Description7 - Button83. Dynamic data from variables/APITesting Strategies
Conversation Testing
Text
1Test scenarios:21. Happy path (everything works)32. Edge cases (unusual inputs)43. Error handling (API fails)54. Intent confusion65. Multi-turn conversationsTest Checklist
Test These
Text
1☐ Welcome flow works2☐ All intents recognized3☐ Entities extracted correctly4☐ API integrations work5☐ Knowledge base returns results6☐ Fallbacks trigger properly7☐ Escalation works8☐ Variables persist9☐ Loops don't occur10☐ End conversations properlyDebugging
Common Issues
Debug Tips
Text
1Flow not progressing:2- Check connections3- Verify conditions4- Test in isolation5 6Intent mismatch:7- Add training phrases8- Check entity conflicts9- Review NLU settings10 11API errors:12- Verify URL13- Check authentication14- Test endpoint externally15 16Variables empty:17- Confirm capture18- Check scope19- Review block orderDebug Mode
Text
1In preview:21. Enable debug panel32. See current block43. View all variables54. Track flow path65. Identify issuesPublishing Agent
Channels
Text
1Deploy to:2- Web widget3- Slack4- Discord5- WhatsApp (via integration)6- Custom (API)Web Widget
Text
11. Go to Publish22. Select Web Widget33. Customize appearance44. Copy embed code55. Add to websiteBài Tập
Practice
Build Support Agent:
- Set up knowledge base with FAQs
- Create order tracking flow
- Add complaint handling
- Implement escalation
- Test all flows
- Publish web widget
Tiếp theo: Bài 4 - Botpress Deep Dive
