NB: this project is a WIP. We are actively working towards rolling up, testing, and providing examples!
This plugin makes it simple to integrate conversational memory into a Jovo app. It provides an easy to use API that manages the data required to pause, resume, and switch between multi-step linear or non-linear conversations.
npm i jovo-plugin-resume --save
The plugin adds a new object to the Jovo object, Resumer.
It can be accessed in your handler function with
This object is automatically serialized and deserialized into the jovo user data object with each request, and has the following exposed methods:
switchTo acts like an intelligent toStateIntent. For example:
When FooConversation is first started, the switchTo is functionally identical to
If the user starts FooConversation, then answers yes to the intial question, they are in the YesNoState, part of
FooConversation. Now if the user closes out of the app, and hits the startFooHandler again, switchTo will not bring them
to the FooIntent handler, but will bring them to the YesIntent handler that they left off in. All requests
(accross any session) are now automatically saved as a marker for the current conversation.
This can be controlled with the following methods:
Signals that the conversation currently in progress has reached its end.
Call this to preserve the progress of the current conversation, but stop interacting with.
Tells the resumer to not update the conversation with the current request. Use this for intents that do not progress the conversation, such as Fallback, Unhandled, Help, etc...
The way to determine if handler code is running under the context of a normal request, or from a resume, the field actionData will either be set or not set. So when a resume happens $resumer.actionData will be an object with the following fields:
where ConversationStatus is an object with the following fields:
So to write a handler function that can gracefully be resumed into: