使用 Direct Line 的 Microsoft Bot 框架中 LivePerson "Welcome Event" 的入口点

Entry Point for LivePerson "Welcome Event" in Microsoft Bot framework using Direct Line

我目前正在使用 Microsoft Bot Framework (v4) 通过 Direct Line 集成 LivePerson。

在 LivePerson Developer docs 中指出:

Ensure you have an ‘entry point’ in your bot that responds to the default ‘WELCOME’ action send by a new chat customer.

但是,这里没有关于具体如何执行此操作的代码示例。是否需要构建 LivePerson 可以调用的新 http 端点,或者这个 'event' 利用现有的“/api/messages”端点?

我想对此事件做出反应的原因是 b/c 在 LivePerson 测试聊天中直接开始与机器人聊天时,我没有看到机器人的初始欢迎消息和第一个问题。直到我输入一些东西,机器人才将其解释为对您从未见过的第一个问题的答案。在 Azure 的 WebChat 中使用模拟器和测试时,机器人按预期工作。

我正在使用自适应对话框,RootDialog 作为我的入口点。

我的猜测是 LivePerson 会使用以下有效负载向您的消息端点发送一条消息:

{
  // ...
  "type": "message",
  "text": "",
  "channelData": {
    "action": {
      "name": "WELCOME"
    }
  }
}

在您的 onMessage 事件处理程序中,您应该检查此 WELCOME 操作并显示您的欢迎消息。

答案总结在一篇博客中post我写过这个: https://www.michaelgmccarthy.com/2021/03/13/sending-a-welcome-message-in-the-v4-bot-framework-via-direct-line-and-liveperson/