商務 Bot 案例Commerce bot scenario

注意

本主題適用於 SDK v3 版本。This topic applies to SDK v3 release. 您可以在這裡找到最新版本 (v4) 的 SDK 文件。You can find the documentation for the latest version of the SDK v4 here.

商務 Bot 案例說明 Bot 如何取代傳統電子郵件和電話互動等常見的旅館接待服務。The Commerce bot scenario describes a bot that replaces the traditional e-mail and phone call interactions that people typically have with a hotel's concierge service. Bot 會利用認知服務,以更順暢地處理客戶的文字和語音要求,並搭配蒐集來自與後端服務整合的內容。The bot takes advantage of Cognitive Services to better process customer requests via text and voice with context gathered from integration with backend services.

應用程式 Bot 圖表

以下是作為旅館接待的商務 Bot 邏輯流程:Here is the logic flow of a Commerce bot that functions as a concierge for a hotel:

  1. 客戶可使用旅館的行動應用程式。The customer uses the hotel mobile app.
  2. 使用者透過 Azure AD B2C 進行驗證。Using Azure AD B2C, the user authenticates.
  3. 使用者透過自訂應用程式 Bot 來要求資訊。Using the custom Application Bot, user requests information.
  4. 認知服務可協助處理自然語言要求。Cognitive Services helps process the natural language request.
  5. 回應會由能利用自然對話修正問題的客戶進行檢閱。Response is reviewed by customer who can refine the question using natural conversation.
  6. 若使用者滿意該結果,應用程式 Bot 就會更新客戶的預約。After the user is happy with the results, the Application Bot updates the customer’s reservation.
  7. Application Insights 會收集執行階段遙測,以協助開發 Bot 效能和使用量。Application insights gathers runtime telemetry to help development with bot performance and usage.

範例 BotSample bot

範例商務 Bot 的設計訴求是打造虛構的旅館接待服務。The sample Commerce bot is designed around a fictitious hotel concierge service. 在透過鏈結的成員服務行動應用程式向旅館驗證 Azure AD B2C 後,客戶可存取以 C# 撰寫的 Bot。Written in C#, customers access the Bot once they've authenticated Azure AD B2C with a hotel via the chain's member services mobile app. 鏈結會將預約儲存在 SQL Database 中。The chain stores reservations in a SQL Database. 客戶可以使用自然的問句,如「住宿期間租一間泳池小屋的費用多少」。A customer can use natural phrase questions like "How much to rent a pool cabana for my stay". Bot 因此會擁有來賓住在哪間旅館和住宿期間的相關內容。The Bot in turn has context about what hotel and the duration of the guest's stay. 此外,Language Understanding (LUIS) 服務可讓 Bot 從簡單的詞語如「泳池小屋」等輕鬆取得內容。In addition, Language Understanding (LUIS) Service makes it easy for the bot to get context from even a simple phrase like "pool cabana". Bot 會提供答案,然後為來賓預訂小屋,並提供天數和小屋類型的選擇。The Bot provides the answer and then can offer to book a cabana for the guest, providing choices around the number of days and type of cabana. 在 Bot 擁有所有必要資料後,即會依要求進行預訂。Once the Bot has all the necessary data, it books the request. 來賓也可以使用語音進行相同的要求。The guest can also use their voice to make the same request.

您可以從常見的 Bot Framework 案例範例下載或複製此範例 Bot 的原始程式碼。You can download or clone the source code for this sample bot from Samples for Common Bot Framework Scenarios.

您將使用的元件Components you'll use

商務 Bot 會使用下列元件:The Commerce bot uses the following components:

  • 用以驗證的 Azure ADAzure AD for Authentication
  • 認知服務:LUISCognitive Services: LUIS
  • Application InsightsApplication Insights

Azure Active Directory (Azure AD)Azure Active Directory (Azure AD)

Azure Active Directory (Azure AD) 是 Microsoft 的多租用戶雲端型目錄和身分識別管理服務。Azure Active Directory (Azure AD) is Microsoft’s multi-tenant cloud based directory and identity management service. 身為 Bot 開發人員,Azure AD 可讓您專注於建置 Bot,快速而簡單地整合數百萬個全球各地組織所使用的世界級身分識別管理解決方案。As a Bot developer, Azure AD lets you focus on building your Bot by making it fast and simple to integrate with a world class identity management solution used by millions of organizations around the world. Azure AD 支援 B2C 連接器,可讓您使用外部識別碼 (例如 Google、Facebook 或 Microsoft 帳戶) 來識別個人。Azure AD supports a B2C connector allowing you to identify individuals using external IDs such as Google, Facebook, or a Microsoft Account. Azure AD 讓您不必管理使用者的認證,改而專注於 Bot 的解決方案,了解您可以將 Bot 使用者與應用程式所公開的正確資料相互關聯。Azure AD removes the responsibility from you having to manage the user's credentials and instead focus your Bot's solution knowing you can correlate the user of the Bot with the correct data exposed by your application.

認知服務:LUISCognitive Services: LUIS

作為認知服務系列技術之一員,Language Understanding (LUIS) 會為您的應用程式帶來機器學習的強大功能。As a member of the Cognitive Services family of technologies, Language Understanding (LUIS) brings the power of machine learning to your apps. 目前,LUIS 支援數種語言,可讓 Bot 了解人想要什麼。Currently, LUIS supports several languages that enables your Bot to understand what a person wants. 與 LUIS 整合時,您可表達意圖並定義 Bot 能了解的實體。When integrating with LUIS, you express intent and define the entities your Bot understands. 然後使用範例語句進行訓練,教導 Bot 了解這些意圖和實體。You then teach your Bot to understand those intents and entities by training it with example utterances. 您可以使用片語清單和 RegEx 功能調校整合,針對特定的對話需求讓 Bot 盡可能順暢。You have the ability to tweak your integration using phrase lists and regex features so that your Bot is as fluid as possible for your particular conversation needs.

Application InsightsApplication Insights

Application Insights 可協助您透過應用程式效能管理和立即分析,取得可操作的見解。Application Insights helps you get actionable insights through application performance management (APM) and instant analytics. 根據預設,您可以取得豐富的效能監視、強大的警示與便於取用的儀表板,以協助確保您的 Bot 可供使用,並如預期般執行。Out of the box you get rich performance monitoring, powerful alerting, and easy-to-consume dashboards to help ensure your Bot is available and performing as you expect. 您可以快速查看是否遇到問題,然後執行根本原因分析以找出問題,並加以修正。You can quickly see if you have a problem, then perform a root cause analysis to find and fix the issue.

後續步驟Next steps

接下來,深入了解 Cortana 技能 Bot 案例。Next, learn about the Cortana Skill bot scenario.