GoogleAction not defined


#1

Hi,

I am working on a dialogflow/google assistant app and im getting the following error in my console when trying to call the intent:

  Error -----------------------------------------------------------------

  Message:
  GoogleAction is not defined

  Stack:
  ReferenceError: GoogleAction is not defined
      at GoogleAction.SendHelpIntent (C:\Projects\g-starvoice\src\app.js:55:17)
      at Function.applyHandle (C:\Projects\g-starvoice\node_modules\jovo-framework\src\middleware\Handler.ts:217:43)
      at handle (C:\Projects\g-starvoice\node_modules\jovo-framework\src\middleware\Handler.ts:46:23)

   ----------------------------------------------------------------------

  Request details:
  this.$googleAction initialized
  this.$type: {"type":"INTENT"}
  this.$session.$data : {}
  this.$nlu : {"intent":{"name":"CarouselIntent"}}
  this.$inputs : {}

   ----------------------------------------------------------------------

The following is the intent that is throwing the error. How can i fix this? I can not seem to find a solution in the docs and can’t find an example where googleAction is initialised. Line 55 in the error corresponds with the first line of code in this intent: let itemOne = new GoogleAction.OptionItem();

CarouselIntent() {
		let itemOne = new GoogleAction.OptionItem();

		itemOne
			.setTitle('Option 1')
			.setDescription('Description of option 1')
			.setKey('OptionOne')
			.addSynonym('Option One');

		let carousel = new GoogleAssistant.Carousel();

		carousel.addItem(itemOne);

	    this.$googleAction.showCarousel(carousel);

		this.ask('Testing');
	}

#2

I also had some trouble with this.

const {GoogleAssistant} = require('jovo-platform-googleassistant');
let carousel = new GoogleAssistant.Carousel();

Gives me an error how this is not a valid constructor. Simply requiring the visual elements I want to use works for me.

const {List, OptionItem, BasicCard} = require('jovo-platform-googleassistant');
let itemOne = new OptionItem();
    
    itemOne
    .setTitle('Option 1')
    .setDescription('Description of option 1')
    .setKey('OptionOne')
    .addSynonym('Option One');

#3

@Marko_Arezina Thanks! That worked for me too :smile:


#4

Thanks @Marko_Arezina :+1:

Yes, we need to update the docs. This is also discussed here: Possible Bug - GoogleAssistant.BasicCard() not showing up