简体   繁体   中英

Microsoft bot: How to log each conversation step?

I'm learning how to build a Microsoft Bot and I need to send every message (ie log the user progress through the bot) to an API.

Let's say I have these dialogs with 3 steps each:

  • /
  • /welcome
  • /onboarding
  • /finish

When a user joins the conversation (Root dialog), I need to make a POST to our API with the following data:

{ "conversationId": "8n21b2mkmdb9abi26", "dialog": "root", "step": 1 }

And then, for each following user message, I would update that conversation in our server with the dialog and step.

I tried to use the middleware hook, but it doesn't have the information of which dialog/step the user is currently in.

Any suggestion?

The middleware feature gives you access to the session object. Store the metadata you need in the session object, then access it in your logging middleware.

For a code example, check out: Microsoft/BotBuilder-Samples - Middleware and Logging with BotBuilder Node SDK

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM