Adding Voice Recognition and Dialogue Voice with API.AI

I have embedded a API.AI webpage as an webobject in my Storyline2 project and have linked to my agent in API.AI and that is working well as I can ask questions and have the agent reply back, very fun!  I want to be able to trigger actions in Storyline based on the reactions from the agent and responses of the student. For this I need to import the variables from API.AI into Storyline2. The webpage/webobject has javascript functions and returns a JSON with the entity responses. I am not clear and how to get those response variables into storyline ,   add code to the webobject??  add code to storyline??  add javascript from inside storyline??  I would appreciate  if someone could help make this clear. Thanks

1 Reply