Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DateTime

Asks user for a timezone-agnostic date and time.

example

// Actions SDK
const app = actionssdk()

app.intent('actions.intent.MAIN', conv => {
  conv.ask(new DateTime({
    prompts: {
      initial: 'When do you want to come in?',
      date: 'Which date works best for you?',
      time: 'What time of day works best for you?',
    }
  }))
})

app.intent('actions.intent.DATETIME', (conv, input, datetime) => {
  const { month, day } = datetime.date
  const { hours, minutes } = datetime.time
  conv.close(new SimpleResponse({
    speech: 'Great see you at your appointment!',
    text: `Great, we will see you on ${month}/${day} at ${hours} ${minutes || ''}`
  }))
})

// Dialogflow
const app = dialogflow()

app.intent('Default Welcome Intent', conv => {
  conv.ask(new DateTime({
    prompts: {
      initial: 'When do you want to come in?',
      date: 'Which date works best for you?',
      time: 'What time of day works best for you?',
    }
  }))
})

// Create a Dialogflow intent with the `actions_intent_DATETIME` event
app.intent('Get Datetime', (conv, params, datetime) => {
  const { month, day } = datetime.date
  const { hours, minutes } = datetime.time
  conv.close(new SimpleResponse({
    speech: 'Great see you at your appointment!',
    text: `Great, we will see you on ${month}/${day} at ${hours} ${minutes || ''}`
  }))
})
example

// Actions SDK
const app = actionssdk()

app.intent('actions.intent.MAIN', conv => {
  conv.ask(new DateTime({
    prompts: {
      initial: 'When do you want to come in?',
      date: 'Which date works best for you?',
      time: 'What time of day works best for you?',
    }
  }))
})

app.intent('actions.intent.DATETIME', (conv, input, datetime) => {
  const { month, day } = datetime.date
  const { hours, minutes } = datetime.time
  conv.close(new SimpleResponse({
    speech: 'Great see you at your appointment!',
    text: `Great, we will see you on ${month}/${day} at ${hours} ${minutes || ''}`
  }))
})

// Dialogflow
const app = dialogflow()

app.intent('Default Welcome Intent', conv => {
  conv.ask(new DateTime({
    prompts: {
      initial: 'When do you want to come in?',
      date: 'Which date works best for you?',
      time: 'What time of day works best for you?',
    }
  }))
})

// Create a Dialogflow intent with the `actions_intent_DATETIME` event
app.intent('Get Datetime', (conv, params, datetime) => {
  const { month, day } = datetime.date
  const { hours, minutes } = datetime.time
  conv.close(new SimpleResponse({
    speech: 'Great see you at your appointment!',
    text: `Great, we will see you on ${month}/${day} at ${hours} ${minutes || ''}`
  }))
})

Hierarchy

Constructors

constructor

  • Parameters

    Returns DateTime

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