Options
All
  • Public
  • Public/Protected
  • All
Menu

Class NewSurface

Requests the user to switch to another surface during the conversation. Works only for en-* locales.

example

// Actions SDK
const app = actionssdk()

const imageResponses = [
  `Here's an image of Google`,
  new Image({
    url: 'https://storage.googleapis.com/gweb-uniblog-publish-prod/images/' +
      'Search_GSA.2e16d0ba.fill-300x300.png',
    alt: 'Google Logo',
  })
]

app.intent('actions.intent.MAIN', conv => {
  const capability = 'actions.capability.SCREEN_OUTPUT'
  if (conv.surface.capabilities.has(capability)) {
    conv.close(...imageResponses)
  } else {
    conv.ask(new NewSurface({
      capabilities: capability,
      context: 'To show you an image',
      notification: 'Check out this image',
    }))
  }
})

app.intent('actions.intent.NEW_SURFACE', (conv, input, newSurface) => {
  if (newSurface.status === 'OK') {
    conv.close(...imageResponses)
  } else {
    conv.close(`Ok, I understand. You don't want to see pictures. Bye`)
  }
})

// Dialogflow
const app = dialogflow()

const imageResponses = [
  `Here's an image of Google`,
  new Image({
    url: 'https://storage.googleapis.com/gweb-uniblog-publish-prod/images/' +
      'Search_GSA.2e16d0ba.fill-300x300.png',
    alt: 'Google Logo',
  })
]

app.intent('Default Welcome Intent', conv => {
  const capability = 'actions.capability.SCREEN_OUTPUT'
  if (conv.surface.capabilities.has(capability)) {
    conv.close(...imageResponses)
  } else {
    conv.ask(new NewSurface({
      capabilities: capability,
      context: 'To show you an image',
      notification: 'Check out this image',
    }))
  }
})

// Create a Dialogflow intent with the `actions_intent_NEW_SURFACE` event
app.intent('Get New Surface', (conv, input, newSurface) => {
  if (newSurface.status === 'OK') {
    conv.close(...imageResponses)
  } else {
    conv.close(`Ok, I understand. You don't want to see pictures. Bye`)
  }
})
example

// Actions SDK
const app = actionssdk()

const imageResponses = [
  `Here's an image of Google`,
  new Image({
    url: 'https://storage.googleapis.com/gweb-uniblog-publish-prod/images/' +
      'Search_GSA.2e16d0ba.fill-300x300.png',
    alt: 'Google Logo',
  })
]

app.intent('actions.intent.MAIN', conv => {
  const capability = 'actions.capability.SCREEN_OUTPUT'
  if (conv.surface.capabilities.has(capability)) {
    conv.close(...imageResponses)
  } else {
    conv.ask(new NewSurface({
      capabilities: capability,
      context: 'To show you an image',
      notification: 'Check out this image',
    }))
  }
})

app.intent('actions.intent.NEW_SURFACE', (conv, input, newSurface) => {
  if (newSurface.status === 'OK') {
    conv.close(...imageResponses)
  } else {
    conv.close(`Ok, I understand. You don't want to see pictures. Bye`)
  }
})

// Dialogflow
const app = dialogflow()

const imageResponses = [
  `Here's an image of Google`,
  new Image({
    url: 'https://storage.googleapis.com/gweb-uniblog-publish-prod/images/' +
      'Search_GSA.2e16d0ba.fill-300x300.png',
    alt: 'Google Logo',
  })
]

app.intent('Default Welcome Intent', conv => {
  const capability = 'actions.capability.SCREEN_OUTPUT'
  if (conv.surface.capabilities.has(capability)) {
    conv.close(...imageResponses)
  } else {
    conv.ask(new NewSurface({
      capabilities: capability,
      context: 'To show you an image',
      notification: 'Check out this image',
    }))
  }
})

// Create a Dialogflow intent with the `actions_intent_NEW_SURFACE` event
app.intent('Get New Surface', (conv, input, newSurface) => {
  if (newSurface.status === 'OK') {
    conv.close(...imageResponses)
  } else {
    conv.close(`Ok, I understand. You don't want to see pictures. Bye`)
  }
})

Hierarchy

Constructors

constructor

  • Parameters

    Returns NewSurface

Properties

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