iT邦幫忙

2017 iT 邦幫忙鐵人賽
DAY 8
0
Cloud

認識 Microsoft Azure 三十天系列 第 8

Azure Bot Service - Part 7 (關於 Proactive bot)

Azure Bot Service - Part 7 (關於 Proactive bot)

在之前文章中 Azure Bot Services - Part 2(設定 Azure Bot Service), 我們對Azure Bot Service做了基本設定,其中有四個模版(BasicFormLanguage understandingProactive)各有其功能,今天就讓我們來認識一下 Proactive bot

Proactive bot

一般 bot 都是被動觸發,而 Proactive bot 是由 bot 主動觸發的

基本流程圖

官方提供的流程圖

flow

程式流程圖

proactiveflow

使用到的 Azure Resource

  1. Azure Storage

用來建立 queue

  1. Azure Function App (a queueTrigger Azure Function)

當 queue 有訊息時會觸發,並且直接與 bot 溝通.

  1. Azure Bot Service

用來接收及傳送訊息

程式流程說明

  1. 使用者發訊息

  2. 驗證使用者
    1-1. 未通過

    回應未驗證

    1-2. 通知

    執行 Run methond of Run.csx

  3. 以 ActivityType 決定回應方式
    3-1. ActivityTypes.Message:

    Processes the user’s message.

    1. 透過MessageReceivedAsync of BasicProactiveEchoDialog.csx 來處理訊息

    2. 訊息不為reset

      • 2-1. 接收使用者的訊息 --> 加到 Azure Storage Queue (Azure Bot Service)
      • 2-2. queue 觸發 Azure Function --> 傳送訊息給使用者

        會同時從 queue 中移除

    3. 訊息如為reset,則使用PromptDialog

    4. PromptDialog--> Yes
      4-1. "Reset count."

      notreset

      4-2. "Did not reset count."

      reset

    3-2. ActivityTypes.ConversationUpdate:

    Welcomes the users to the conversation.

    3-3. ActivityTypes.Trigger:

    • 處理由 Azure Function 來的主動訊息

    result

    3-4. ActivityTypes.ContactRelationUpdate:

    3-5. ActivityTypes.Typing:

    3-6. ActivityTypes.DeleteUserData:

    3-7. ActivityTypes.Ping:

參考資料

  1. Proactive bot
  2. ResumptionCookie
  3. session.message.address

上一篇
Azure Bot Service - Part 6 (關於 Language understanding bot)
下一篇
Azure Bot Service - Part 8 (設定 持續性整合)
系列文
認識 Microsoft Azure 三十天31
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言