Options
All
  • Public
  • Public/Protected
  • All
Menu

Class UpdatePermission

Prompts the user for permission to send proactive updates at any time.

example

// Actions SDK
const app = actionssdk()

app.intent('actions.intent.MAIN', conv => {
  conv.ask(new UpdatePermission({
    intent: 'show.image',
    arguments: [{
      name: 'image_to_show',
      textValue: 'image_type_1',
    }
  ))
})

app.intent('actions.intent.PERMISSION', conv => {
  const granted = conv.arguments.get('PERMISSION')
  if (granted) {
    conv.close(`Great, I'll send an update whenever I notice a change`)
  } else {
    // Response shows that user did not grant permission
    conv.close('Alright, just let me know whenever you need the weather!')
  }
})

app.intent('show.image', conv => {
  const arg = conv.arguments.get('image_to_show') // will be 'image_type_1'
  // do something with arg
})

// Dialogflow
const app = dialogflow()

app.intent('Default Welcome Intent', conv => {
  conv.ask(new UpdatePermission({
    intent: 'Show Image',
    arguments: [{
      name: 'image_to_show',
      textValue: 'image_type_1',
    }
  ))
})

// Create a Dialogflow intent with the `actions_intent_PERMISSION` event
app.intent('Get Permission', conv => {
  const granted = conv.arguments.get('PERMISSION')
  if (granted) {
    conv.close(`Great, I'll send an update whenever I notice a change`)
  } else {
    // Response shows that user did not grant permission
    conv.close('Alright, just let me know whenever you need the weather!')
  }
})

app.intent('Show Image', conv => {
  const arg = conv.arguments.get('image_to_show') // will be 'image_type_1'
  // do something with arg
})
example

// Actions SDK
const app = actionssdk()

app.intent('actions.intent.MAIN', conv => {
  conv.ask(new UpdatePermission({
    intent: 'show.image',
    arguments: [{
      name: 'image_to_show',
      textValue: 'image_type_1',
    }
  ))
})

app.intent('actions.intent.PERMISSION', conv => {
  const granted = conv.arguments.get('PERMISSION')
  if (granted) {
    conv.close(`Great, I'll send an update whenever I notice a change`)
  } else {
    // Response shows that user did not grant permission
    conv.close('Alright, just let me know whenever you need the weather!')
  }
})

app.intent('show.image', conv => {
  const arg = conv.arguments.get('image_to_show') // will be 'image_type_1'
  // do something with arg
})

// Dialogflow
const app = dialogflow()

app.intent('Default Welcome Intent', conv => {
  conv.ask(new UpdatePermission({
    intent: 'Show Image',
    arguments: [{
      name: 'image_to_show',
      textValue: 'image_type_1',
    }
  ))
})

// Create a Dialogflow intent with the `actions_intent_PERMISSION` event
app.intent('Get Permission', conv => {
  const granted = conv.arguments.get('PERMISSION')
  if (granted) {
    conv.close(`Great, I'll send an update whenever I notice a change`)
  } else {
    // Response shows that user did not grant permission
    conv.close('Alright, just let me know whenever you need the weather!')
  }
})

app.intent('Show Image', conv => {
  const arg = conv.arguments.get('image_to_show') // will be 'image_type_1'
  // do something with arg
})

Hierarchy

Constructors

constructor

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