Open pgoldweic opened 3 years ago
sendToWatson
can't be used to clear the context, it takes contextDelta
parameter which is merged with context object stored in storage.
updateContext
method replaces entire context object, use it instead.
Ah, that's great to know @Naktibalda . Thanks for explaining that!. I'm curious though, would it still work to do the manual context clearing first (outside of Watson, just accessing botbuilder storage), and then calling watsonMiddleware.interpret() ?
I don't see any reason why it shouldn't work.
For a long time, I've been able to completely reset the bot's user context in my (botkit-based orchestration) app by performing this sequence of steps 1- saving an empty context object directly in (botkit) persistent storage and then 2- calling watsonMiddleware.interpret() on the message. However, I just noticed that this sequence failed to work properly in one occasion recently (that is, Watson continued the conversation with the user instead of starting one from scratch). Can you help me understand what could have gone wrong? (this bot is still using the older botkit/botkit-middleware-watson combo, although I'm working on a botkit4-based update,) In addition, I'd like to understand whether this sequence of steps should be expected to work with the latest botkit and watsonMiddleware code or whether I should use something else instead. I am aware of the 'sendToWatson' method, but I don't know whether it can be used to completely clear the user's context, which is the desired result (so that a new conversation can get started).