Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Here is a sample demonstrating a function that asks a user whether they are satisfied with the support and saves the reply.

Code Block
"""AuthenticateAnonymous callback module."""

from common.Callback import Callback
from utils import logger

log = logger.getPackageLogger('callback')

# Sample callback, can be used in an Intent with a response type "Callback"
# and callback name is my2
#
class HelloWorld(Callback):
    _isRealAction = True

    def DoAction(self, dialog, sentence):
        log.debug("Begin callback my2")
        response = dialog.UserAsk("Tell us how you are satisfied with out JSM support?")
        dialog.AddKeyword('callback_last_feedback', response.text)
        dialog.UserPost("Saved your last feedback:%s" %(response.text))

        return ""

...