Resumer

Plugin published by Comcast | 91 downloads

A plugin for resuming conversations

Jovo Resumer Plugin

Build Status

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.

Install

npm i jovo-plugin-resume --save

API

The plugin adds a new object to the Jovo object, Resumer. It can be accessed in your handler function with this.$resumer This object is automatically serialized and deserialized into the jovo user data object with each request, and has the following exposed methods:

switchTo(conversationName: string, startIntent: string)

switchTo acts like an intelligent toStateIntent. For example:

When FooConversation is first started, the switchTo is functionally identical to toStateIntent("FooConversation", "FooIntent") 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:

endCurrent()

Signals that the conversation currently in progress has reached its end.

pauseCurrent()

Call this to preserve the progress of the current conversation, but stop interacting with.

ignore()

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...

Handling a Resume

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:

Code Examples

Join Our Newsletter

Be the first to get our free tutorials, courses, and other resources for voice app developers.