Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Profile

Hierarchy

  • Profile

Properties

Properties

Optional payload

payload: TokenPayload

Gets the Profile Payload object encoded in {@link Profile#token|conv.user.profile.token}. Only retrievable with "Google Sign In" linking type set up for account linking in the console.

To access just the email in the payload, you can also use {@link User#email|conv.user.email}.

example

// Dialogflow
const app = dialogflow({
  clientId: CLIENT_ID,
})

app.intent('Default Welcome Intent', conv => {
  conv.ask(new SignIn('To get your account details'))
})

// Create a Dialogflow intent with the `actions_intent_SIGN_IN` event
app.intent('Get Signin', (conv, params, signin) => {
  if (signin.status === 'OK') {
    const payload = conv.user.profile.payload
    conv.ask(`I got your account details. 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?`)
  }
})

// Actions SDK
const app = actionssdk({
  clientId: CLIENT_ID,
})

app.intent('actions.intent.MAIN', conv => {
  conv.ask(new SignIn('To get your account details'))
})

app.intent('actions.intent.SIGN_IN', (conv, input, signin) => {
  if (signin.status === 'OK') {
    const payload = conv.user.profile.payload
    conv.ask(`I got your account details. 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?`)
  }
})

Optional token

token: undefined | string

The user.idToken retrieved from account linking. Only retrievable with "Google Sign In" linking type set up for account linking in the console.

Generated using TypeDoc