How to use the actions-on-google.NewSurface function in actions-on-google

To help you get started, we’ve selected a few actions-on-google examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github actions-on-google / dialogflow-name-psychic-nodejs / functions / index.js View on Github external
const showLocationOnScreen = (conv) => {
  const capability = 'actions.capability.SCREEN_OUTPUT';
  if (conv.surface.capabilities.has(capability) ||
    !conv.available.surfaces.capabilities.has(capability)) {
    return conv.close(...responses.sayLocation(userData(conv).location));
  }
  conv.ask(new NewSurface({
    context: responses.newSurfaceContext,
    notification: responses.notificationText,
    capabilities: capability,
  }));
};
github PinkyJie / google-actions-github-bot / functions / src / actions.ts View on Github external
function handleSignIn(conv: CONV_TYPE) {
    const hasScreen = conv.surface.capabilities.has(SIGN_SURFACE_CAPABILITY);
    if (hasScreen) {
        return conv.ask(new SignIn());
    }
    const screenAvailable = conv.available.surfaces.capabilities.has(
        SIGN_SURFACE_CAPABILITY
    );
    if (screenAvailable) {
        return conv.ask(
            new NewSurface({
                context: PROMPTS.SIGN_IN_ASK_FOR_TRANSFER,
                notification: 'Link Github to star a repository',
                capabilities: SIGN_SURFACE_CAPABILITY,
            })
        );
    } else {
        conv.contexts.set(
            CONTEXTS.FETCH_TRENDING_FOLLOWUP,
            DEFAULT_CONTEXT_LIFE_SPAN
        );
        return conv.ask(PROMPTS.SIGN_IN_NOT_SUPPORTED);
    }
}
github actions-on-google / actions-on-google-nodejs / samples / js / app / name-psychic / functions / index.js View on Github external
const showLocationOnScreen = conv => {
  const capability = 'actions.capability.SCREEN_OUTPUT'
  if (conv.surface.capabilities.has(capability) ||
    !conv.available.surfaces.capabilities.has(capability)) {
    return conv.close(...responses.sayLocation(conv.user.storage.location))
  }
  conv.ask(new NewSurface({
    context: responses.newSurfaceContext,
    notification: responses.notificationText,
    capabilities: capability,
  }))
}
github actions-on-google / actions-on-google-nodejs / samples / ts / app / name-psychic / functions / src / index.tsx View on Github external
const showLocationOnScreen = (conv: DialogflowConversation) => {
  const capability: SurfaceCapability = 'actions.capability.SCREEN_OUTPUT'
  if (conv.surface.capabilities.has(capability) ||
    !conv.available.surfaces.capabilities.has(capability)) {
    return conv.close(...responses.sayLocation(conv.user.storage.location))
  }
  conv.ask(new NewSurface({
    context: responses.newSurfaceContext,
    notification: responses.notificationText,
    capabilities: capability,
  }))
}