How to use the actions-on-google.Permission 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 / codelabs-nodejs / level2-complete / functions / index.js View on Github external
app.intent('Default Welcome Intent', (conv) => {
  // Asks the user's permission to know their name, for personalization.
  conv.ask(new Permission({
    context: 'Hi there, to get to know you better',
    permissions: 'NAME',
  }));
});
github actions-on-google / codelabs-nodejs / level3-complete / functions / index.js View on Github external
app.intent('Default Welcome Intent', (conv) => {
  const name = conv.user.storage.userName;
  if (!name) {
    // Asks the user's permission to know their name, for personalization.
    conv.ask(new Permission({
      context: 'Hi there, to get to know you better',
      permissions: 'NAME',
    }));
  } else {
    conv.ask(`Hi again, ${name}. What's your favorite color?`);
  }
});
github actions-on-google / dialogflow-name-psychic-nodejs / functions / index.js View on Github external
app.intent('Default Welcome Intent', (conv) => {
  // userData(conv) = {}
  // Uncomment above to delete the cached permissions on each request
  // to force the app to request new permissions from the user

  // Location permissions only work for verified users
  if (conv.user.verification === 'VERIFIED') {
    conv.ask(responses.greetUser);
  } else {
    conv.ask(new Permission({
      context: responses.permissionReason,
      permissions: 'NAME',
    }));
  }
});
github actions-on-google / actions-on-google-nodejs / samples / js / app / name-psychic / functions / index.js View on Github external
app.intent('request_name_permission', conv => {
  conv.data.requestedPermission = 'NAME'
  if (!conv.user.storage.name) {
    return conv.ask(new Permission({
      context: responses.permissionReason,
      permissions: conv.data.requestedPermission,
    }))
  }
  conv.close(responses.sayName(conv.user.storage.name))
})
github actions-on-google / actions-on-google-nodejs / samples / ts / app / name-psychic / functions / src / index.tsx View on Github external
app.intent('request_name_permission', conv => {
  conv.data.requestedPermission = 'NAME'
  if (!conv.user.storage.name) {
    return conv.ask(new Permission({
      context: responses.permissionReason,
      permissions: conv.data.requestedPermission,
    }))
  }
  conv.close(responses.sayName(conv.user.storage.name))
})
github alvarowolfx / codelab-actions-on-google / 03-pizza-bot / functions / index.js View on Github external
order.name = user.displayName;
      order.address = user.address;
      order.location = user.location;
      return saveOrder(order).then(() => {
        return closeOrder(assistant, order);
      });
    } else {
      assistant.contexts.set(CTX_ORDER_PIZZA, 5, { order });
      if (order.address) {
        assistant.ask(new Permission({
          context: 'To complete your order we need you name',
          permissions: ['NAME']
        }));
      } else {
        assistant.ask(
          new Permission({
            context: 'To complete your order we need you name and your location',
            permissions: ['DEVICE_PRECISE_LOCATION', 'NAME']
          })
        );
      }
    }
  });
}