How to use the actions-on-google.Suggestions 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 / dialogflow-conversation-components-nodejs / actions-sdk / functions / index.js View on Github external
function list(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 list.');
  conv.ask(new Suggestions(intentSuggestions));
  // Create a list
  conv.ask(new List({
    title: 'List Title',
    items: {
      // Add the first item to the list
      [SELECTION_KEY_ONE]: {
        synonyms: [
          'synonym of title 1',
          'synonym of title 2',
          'synonym of title 3',
        ],
        title: 'Title of First List Item',
        description: 'This is a description of a list item.',
        image: new Image({
          url: IMG_URL_AOG,
          alt: 'Image alternate text',
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',
        }),
github actions-on-google / actionssdk-conversation-components-nodejs / functions / index.js View on Github external
function list(conv) {
  conv.ask('This is a simple response for a list.');
  conv.ask(new Suggestions(intentSuggestions));
  conv.ask(new List({
    title: 'List Title',
    items: {
      // Add the first item to the list
      [SELECTION_KEY_GOOGLE_ASSISTANT]: {
        synonyms: [
          'Assistant',
          'Google Assistant',
        ],
        title: 'Item #1',
        description: 'Description of Item #1',
        image: new Image({
          url: 'https://www.gstatic.com/images/branding/product/2x/assistant_48dp.png',
          alt: 'Google Assistant logo',
        }),
      },
github actions-on-google / actionssdk-conversation-components-nodejs / functions / index.js View on Github external
function basicCard(conv) {
  conv.ask('This is the first simple response for a basic card.');
  conv.ask(new Suggestions(intentSuggestions));
  conv.ask(new BasicCard({
    text: `This is a basic card.  Text in a basic card can include "quotes" and
    most other unicode characters including emoji 📱.  Basic cards also support
    some markdown formatting like *emphasis* or _italics_, **strong** or
    __bold__, and ***bold itallic*** or ___strong emphasis___ as well as other
    things like line  \nbreaks`, // Note the two spaces before '\n' required for
                                // a line break to be rendered in the card.
    subtitle: 'This is a subtitle',
    title: 'Title: this is a title',
    buttons: new Button({
      title: 'This is a button',
      url: 'https://assistant.google.com/',
    }),
    image: new Image({
      url: IMG_URL_AOG,
      alt: 'Image alternate text',
github PinkyJie / google-actions-github-bot / functions / src / actions.ts View on Github external
// if next one is the last one
    if (data.currentIndex === repositories.length - 1) {
        conv.ask(
            wrapWithSpeak([
                getRepoParagraph(nextRepo, period),
                getRandomMessage(PROMPTS.REPOSITORY_LAST_ONE),
                getRandomMessage(PROMPTS.GOODBYE),
            ])
        );
    } else {
        conv.contexts.set(
            CONTEXTS.FETCH_TRENDING_FOLLOWUP,
            DEFAULT_CONTEXT_LIFE_SPAN
        );
        conv.ask(
            new Suggestions(
                getRandomMessage(PROMPTS.REPOSITORY_NEXT_BUTTON),
                getRandomMessage(PROMPTS.REPOSITORY_STAR_BUTTON),
                getRandomMessage(PROMPTS.REPOSITORY_GOODBYE_BUTTON)
            ),
            cardItem
        );
        const askForStarOrForNext = Math.random() > 0.5;
        conv.ask(
            wrapWithSpeak([
                getRepoParagraph(nextRepo, period),
                askForStarOrForNext
                    ? getRandomMessage(PROMPTS.ASK_FOR_NEXT_REPOSITORIES)
                    : getRandomMessage(PROMPTS.ASK_FOR_STAR_REPOSITORY),
            ])
        );
    }
github actions-on-google / actionssdk-updates-nodejs / functions / aog-webhook.js View on Github external
return getCategories().then((categories) => {
    categories.push(RANDOM_CATEGORY);
    categories.push(RECENT_TIP);
    conv.ask(
      'Please select a category',
      new Suggestions(categories));
  });
}
github alvarowolfx / codelab-actions-on-google / 02-cryptocoin-bot / snippets / 04.js View on Github external
function welcomeHandler(assistant) {
  assistant.ask('Welcome to CryptoCurrency Bot. Do you like to know the price for which cryptocurrency ?')  
  assistant.ask(new Suggestions(SUGGESTIONS));
}
github actions-on-google / dialogflow-conversation-components-nodejs / actions-sdk / functions / index.js View on Github external
function suggestions(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 suggestions.');
  conv.ask(new Suggestions('Suggestion Chips'));
  conv.ask(new Suggestions(intentSuggestions));
  conv.ask(new LinkOutSuggestion({
    name: 'Suggestion Link',
    url: 'https://assistant.google.com/',
  }));
}
github actions-on-google / actionssdk-conversation-components-nodejs / functions / index.js View on Github external
function handleMedia(conv) {
  const mediaStatus = conv.arguments.get('MEDIA_STATUS');
  let response = 'Unknown media status received.';
  if (mediaStatus && mediaStatus.status === 'FINISHED') {
    response = 'Hope you enjoyed the tunes!';
  }
  conv.ask(response);
  conv.ask(new Suggestions(intentSuggestions));
}
github nish17 / scheduler / functions / index.js View on Github external
function requireDataFile(conv) {
  if (conv.user.storage.class)
    data = require(`./data/${conv.user.storage.class}.json`);
  if (data === undefined) {
    conv.ask(
      new SimpleResponse({
        speech: "Please select your Department first. ",
        text: "Please select your Department first. "
      }),
      new Suggestions([`Show Department List`])
    );
  }
}