Please refer comments in demo script
you can get and process any json path with this command agi.get_variable('RECOG_INSTANCE(0/0/your/path)')
def get_prompt(self):
"""Retrieves prompt from the data returned by bot""" prompt = agi.get_variable('RECOG_INSTANCE(0/0/textResponse/messages/0/content)')
agi.verbose('got prompt %s' % prompt)
return prompt
def check_dialog_completion(self):
"""Checks wtether the dialog is complete""" dialog_action_type = agi.get_variable('RECOG_INSTANCE(0/0/intentResult/sessionState/dialogAction/type)')
agi.verbose('got dialog_action_type %s' % dialog_action_type)
complete = False
if dialog_action_type == 'Close':
complete = True
return complete
Thanks