Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Carousel

Asks to collect user's input with a carousel.

example

// Actions SDK
const app = actionssdk()

app.intent('actions.intent.MAIN', conv => {
  conv.ask('Which of these looks good?')
  conv.ask(new Carousel({
    items: {
      [SELECTION_KEY_ONE]: {
        title: 'Number one',
        description: 'Description of number one',
        synonyms: ['synonym of KEY_ONE 1', 'synonym of KEY_ONE 2'],
      },
      [SELECTION_KEY_TWO]: {
        title: 'Number two',
        description: 'Description of number one',
        synonyms: ['synonym of KEY_TWO 1', 'synonym of KEY_TWO 2'],
      }
    }
  }))
})

app.intent('actions.intent.OPTION', (conv, input, option) => {
  if (option === SELECTION_KEY_ONE) {
    conv.close('Number one is a great choice!')
  } else {
    conv.close('Number two is also a great choice!')
  }
})

// Dialogflow
const app = dialogflow()

app.intent('Default Welcome Intent', conv => {
  conv.ask('Which of these looks good?')
  conv.ask(new Carousel({
    items: {
      [SELECTION_KEY_ONE]: {
        title: 'Number one',
        description: 'Description of number one',
        synonyms: ['synonym of KEY_ONE 1', 'synonym of KEY_ONE 2'],
      },
      [SELECTION_KEY_TWO]: {
        title: 'Number two',
        description: 'Description of number one',
        synonyms: ['synonym of KEY_TWO 1', 'synonym of KEY_TWO 2'],
      }
    }
  }))
})

// Create a Dialogflow intent with the `actions_intent_OPTION` event
app.intent('Get Option', (conv, input, option) => {
  if (option === SELECTION_KEY_ONE) {
    conv.close('Number one is a great choice!')
  } else {
    conv.close('Number two is also a great choice!')
  }
})
example

// Actions SDK
const app = actionssdk()

app.intent('actions.intent.MAIN', conv => {
  conv.ask('Which of these looks good?')
  conv.ask(new Carousel({
    items: {
      [SELECTION_KEY_ONE]: {
        title: 'Number one',
        description: 'Description of number one',
        synonyms: ['synonym of KEY_ONE 1', 'synonym of KEY_ONE 2'],
      },
      [SELECTION_KEY_TWO]: {
        title: 'Number two',
        description: 'Description of number one',
        synonyms: ['synonym of KEY_TWO 1', 'synonym of KEY_TWO 2'],
      }
    }
  }))
})

app.intent('actions.intent.OPTION', (conv, input, option) => {
  if (option === SELECTION_KEY_ONE) {
    conv.close('Number one is a great choice!')
  } else {
    conv.close('Number two is also a great choice!')
  }
})

// Dialogflow
const app = dialogflow()

app.intent('Default Welcome Intent', conv => {
  conv.ask('Which of these looks good?')
  conv.ask(new Carousel({
    items: {
      [SELECTION_KEY_ONE]: {
        title: 'Number one',
        description: 'Description of number one',
        synonyms: ['synonym of KEY_ONE 1', 'synonym of KEY_ONE 2'],
      },
      [SELECTION_KEY_TWO]: {
        title: 'Number two',
        description: 'Description of number one',
        synonyms: ['synonym of KEY_TWO 1', 'synonym of KEY_TWO 2'],
      }
    }
  }))
})

// Create a Dialogflow intent with the `actions_intent_OPTION` event
app.intent('Get Option', (conv, input, option) => {
  if (option === SELECTION_KEY_ONE) {
    conv.close('Number one is a great choice!')
  } else {
    conv.close('Number two is also a great choice!')
  }
})

Hierarchy

Implements

Constructors

constructor

Properties

inputValueData

inputValueData: ProtoAny<InputValueSpec, GoogleActionsV2OptionValueSpec>

Static Optional inputValueData

inputValueData: ApiClientObjectMap<any>

Additional configuration data required by a built-in intent. Possible values for the built-in intents: actions.intent.OPTION -> [google.actions.v2.OptionValueSpec], actions.intent.CONFIRMATION -> [google.actions.v2.ConfirmationValueSpec], actions.intent.TRANSACTION_REQUIREMENTS_CHECK -> [google.actions.v2.TransactionRequirementsCheckSpec], actions.intent.DELIVERY_ADDRESS -> [google.actions.v2.DeliveryAddressValueSpec], actions.intent.TRANSACTION_DECISION -> [google.actions.v2.TransactionDecisionValueSpec], actions.intent.PLACE -> [google.actions.v2.PlaceValueSpec], actions.intent.Link -> [google.actions.v2.LinkValueSpec]

Static Optional intent

intent: undefined | string

The built-in intent name, e.g. actions.intent.TEXT, or intents defined in the action package. If the intent specified is not a built-in intent, it is only used for speech biasing and the input provided by the Google Assistant will be the actions.intent.TEXT intent.

Static Optional parameterName

parameterName: undefined | string

Optionally, a parameter of the intent that is being requested. Only valid for requested intents. Used for speech biasing.

Generated using TypeDoc