How to use the actions-on-google.Carousel 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.

github actions-on-google / actionssdk-conversation-components-nodejs / functions / index.js View on Github external
function carousel(conv) {
  conv.ask('This is a simple response for a carousel.');
  conv.ask(new Suggestions(intentSuggestions));
  conv.ask(new Carousel({
    items: {
      // Add the first item to the carousel
      [SELECTION_KEY_GOOGLE_ASSISTANT]: {
        synonyms: [
          'Assistant',
          'Google Assistant',
        ],
        title: 'Item #1',
        description: 'Description of Item #1',
        image: new Image({
          url: IMG_URL_AOG,
          alt: 'Google Assistant logo',
        }),
      },
      // Add the second item to the carousel
      [SELECTION_KEY_GOOGLE_PAY]: {
github actions-on-google / dialogflow-conversation-components-nodejs / actions-sdk / functions / index.js View on Github external
function carousel(conv) {
  if (!conv.hasScreen) {
    conv.ask('Sorry, try this on a screen device or select the ' +
      'phone surface in the simulator.');
    return;
  }
  conv.ask('This is a simple response for a carousel.');
  conv.ask(new Suggestions(intentSuggestions));
  // Create a carousel
  conv.ask(new Carousel({
    items: {
      // Add the first item to the carousel
      [SELECTION_KEY_ONE]: {
        synonyms: [
          'synonym of title 1',
          'synonym of title 2',
          'synonym of title 3',
        ],
        title: 'Title of First Carousel Item',
        description: 'This is a description of a carousel item.',
        image: new Image({
          url: IMG_URL_AOG,
          alt: 'Image alternate text',
        }),
      },
      // Add the second item to the carousel
github dialogflow / fulfillment-actions-library-nodejs / functions / index.js View on Github external
function googleAssistantOther(agent) {
    let conv = agent.conv(); // Get Actions on Google library conversation object
    conv.ask('Please choose an item:'); // Use Actions on Google library to add responses
    conv.ask(new Carousel({
      title: 'Google Assistant',
      items: {
        'WorksWithGoogleAssistantItemKey': {
          title: 'Works With the Google Assistant',
          description: 'If you see this logo, you know it will work with the Google Assistant.',
          image: {
            url: imageUrl,
            accessibilityText: 'Works With the Google Assistant logo',
          },
        },
        'GoogleHomeItemKey': {
          title: 'Google Home',
          description: 'Google Home is a powerful speaker and voice Assistant.',
          image: {
            url: imageUrl2,
            accessibilityText: 'Google Home'
github ferdelamad / dialogflow-firebase-restaurant-bot / functions / handlers.js View on Github external
const houseSpecials = conv => {
  conv.ask("Here are our House Specials!");
  conv.ask(
    new Carousel({
      items: {
        // Add the first item to the carousel
        ["House Special One"]: {
          synonyms: ["Special One", "Deal One"],
          title: "First House Special",
          description: "This is a description of a carousel item.",
          image: new Image({
            url:
              "http://www.ingostastyfood.com/wp-content/uploads/2016/06/ingos_burger-6.22.15.jpg",
            alt: "Special one"
          })
        },
        // Add the second item to the carousel
        ["House Special Two"]: {
          synonyms: ["Special Two", "Deal Two"],
          title: "House Special Two",
github actions-on-google / codelabs-nodejs / level3-complete / functions / index.js View on Github external
const fakeColorCarousel = () => {
  const carousel = new Carousel({
    items: {
      'indigo taco': {
        title: 'Indigo Taco',
        synonyms: ['indigo', 'taco'],
        image: new Image({
          url: 'https://storage.googleapis.com/material-design/publish/material_v_12/assets/0BxFyKV4eeNjDN1JRbF9ZMHZsa1k/style-color-uiapplication-palette1.png',
          alt: 'Indigo Taco Color',
        }),
      },
      'pink unicorn': {
        title: 'Pink Unicorn',
        synonyms: ['pink', 'unicorn'],
        image: new Image({
          url: 'https://storage.googleapis.com/material-design/publish/material_v_12/assets/0BxFyKV4eeNjDbFVfTXpoaEE5Vzg/style-color-uiapplication-palette2.png',
          alt: 'Pink Unicorn Color',
        }),