Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SignIn

Hands the user off to a web sign in flow. App sign in and OAuth credentials are set in the Actions Console. Retrieve the access token in subsequent intents using {@link Access#token|conv.user.access.token}.

example

// Actions SDK
const app = actionssdk()

app.intent('actions.intent.MAIN', conv => {
  conv.ask(new SignIn())
})

app.intent('actions.intent.SIGN_IN', (conv, input, signin) => {
  if (signin.status === 'OK') {
    const access = conv.user.access.token // possibly do something with access token
    conv.ask('Great, thanks for signing in! What do you want to do next?')
  } else {
    conv.ask(`I won't be able to save your data, but what do you want to do next?`)
  }
})

// Dialogflow
const app = dialogflow()

app.intent('actions.intent.MAIN', conv => {
  conv.ask(new SignIn())
})

// Create a Dialogflow intent with the `actions_intent_SIGN_IN` event
app.intent('Get Signin', (conv, params, signin) => {
  if (signin.status === 'OK') {
    const access = conv.user.access.token // possibly do something with access token
    conv.ask('Great, thanks for signing in! What do you want to do next?')
  } else {
    conv.ask(`I won't be able to save your data, but what do you want to do next?`)
  }
})
example

// Actions SDK
const app = actionssdk()

app.intent('actions.intent.MAIN', conv => {
  conv.ask(new SignIn())
})

app.intent('actions.intent.SIGN_IN', (conv, input, signin) => {
  if (signin.status === 'OK') {
    const access = conv.user.access.token // possibly do something with access token
    conv.ask('Great, thanks for signing in! What do you want to do next?')
  } else {
    conv.ask(`I won't be able to save your data, but what do you want to do next?`)
  }
})

// Dialogflow
const app = dialogflow()

app.intent('actions.intent.MAIN', conv => {
  conv.ask(new SignIn())
})

// Create a Dialogflow intent with the `actions_intent_SIGN_IN` event
app.intent('Get Signin', (conv, params, signin) => {
  if (signin.status === 'OK') {
    const access = conv.user.access.token // possibly do something with access token
    conv.ask('Great, thanks for signing in! What do you want to do next?')
  } else {
    conv.ask(`I won't be able to save your data, but what do you want to do next?`)
  }
})

Hierarchy

Constructors

constructor

  • new SignIn(context?: undefined | string): SignIn
  • Parameters

    • Optional context: undefined | string

      The optional context why the app needs to ask the user to sign in, as a prefix of a prompt for user consent, e.g. "To track your exercise", or "To check your account balance".

    Returns SignIn

Properties

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]

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.

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