Skip to main content

$jsapi.stopSession

This method stops the current session.

Calling the $jsapi.stopSession method causes a deferred new session start:

  • The current user request and all bot reactions fall into the previous session.
  • Subsequent requests and reactions are recorded to the new session.
caution
The contents of the $session variable are cleared immediately when $jsapi.stopSession is called.

Syntax

The method is called without arguments:

$jsapi.stopSession();

Usage details

In the phone channel, a call to $jsapi.stopSession is ignored in the state triggered by the hangup event. Tovie Platform automatically ends the session when a phone call is terminated.

How to use

require: patternsEn.sc
module = sys.zb-common

theme: /

state: Goodbye
q!: * $bye *
script:
$jsapi.stopSession();
random:
a: Have a nice day.
a: Goodbye!