|

|  How to Integrate Google Dialogflow with Google Slides

How to Integrate Google Dialogflow with Google Slides

January 24, 2025

Learn to seamlessly integrate Google Dialogflow with Google Slides, enhancing interactivity and automation in your presentations through this comprehensive guide.

How to Connect Google Dialogflow to Google Slides: a Simple Guide

 

Setting Up Dialogflow

 

  • Create a new Dialogflow agent by logging into your Dialogflow console and clicking on "Create Agent". Fill in necessary details like agent name, timezone, and Google Project.
  •  

  • Under "Intents", create various intents which will be responsible for responding to specific user inputs. For each intent, define training phrases and the appropriate responses.
  •  

  • Enable the Dialogflow API via the Google Cloud Console to allow proper functionality of your agent.

 

Google Cloud Platform Setup

 

  • Open your project in the Google Cloud Console and ensure that Dialogflow API is enabled in the APIs & services section.
  •  

  • Navigate to IAM & Admin > Service Accounts. Create a new service account, providing it with necessary roles such as Dialogflow API Client.
  •  

  • Create and download a private key in JSON format for your service account. This key will be used to authenticate Dialogflow requests through your application.

 

Setting Up Google Slides

 

  • Go to the Google Slides API in the Google Cloud Console. Enable the API for your project to allow programmatic access to your slides.
  •  

  • Create OAuth 2.0 credentials in the Credentials page and set up OAuth consent screen as needed. Note the client ID and client secret which will be needed later.
  •  

  • Share the Google Slides presentation you want to manipulate with your service account's email to grant it access.

 

Integrating with Node.js

 

  • Initialize a Node.js project and install required packages:

     

    npm init -y
    npm install dialogflow googleapis google-auth-library
    

     

  • Write a script to authenticate using the service account JSON and manipulate Google Slides based on Dialogflow responses:

     

    const { google } = require('googleapis');
    const dialogflow = require('@google-cloud/dialogflow');
    const { GoogleAuth } = require('google-auth-library');
    const path = require('path');
    
    // Path to your service account JSON
    const serviceAccountPath = path.join(__dirname, 'service-account.json');
    
    // Set up Dialogflow session client
    const sessionClient = new dialogflow.SessionsClient({ keyFile: serviceAccountPath });
    
    // Set up Google Slides API
    const auth = new GoogleAuth({
      keyFile: serviceAccountPath,
      scopes: ['https://www.googleapis.com/auth/presentations']
    });
    
    // Function to update slides based on Dialogflow conversation
    async function updateSlides(sessionId, text) {
      const sessionPath = sessionClient.projectAgentSessionPath('YOUR_PROJECT_ID', sessionId);
      
      const request = {
        session: sessionPath,
        queryInput: {
          text: {
            text: text,
            languageCode: 'en-US',
          },
        },
      };
      
      const responses = await sessionClient.detectIntent(request);
    
      const result = responses[0].queryResult;
      if (result && result.fulfillmentText) {
        console.log(`Detected intent: ${result.fulfillmentText}`);
    
        // Auth and create slides API client
        const authClient = await auth.getClient();
        const slides = google.slides({ version: 'v1', auth: authClient });
    
        const presentationId = 'YOUR_PRESENTATION_ID';
    
        // Generate a sample request to update slides
        const requests = [
          {
            insertText: {
              objectId: 'TEXT_BOX_OBJECT_ID', // ID of textbox to update
              text: result.fulfillmentText,
              insertionIndex: 0
            }
          }
        ];
    
        await slides.presentations.batchUpdate({
          presentationId: presentationId,
          resource: { requests }
        });
      }
    }
    
    // Example to test the integration
    updateSlides('sample-session-id', 'Hello, world!');
    

     

 

Testing the Integration

 

  • Run the Node.js script to test the integration. Send different sample queries and verify that the Dialogflow intents are correctly interpreted and that the slides are updated accordingly.
  •  

  • Inspect the Google Slides to ensure that the expected changes appear as results from Dialogflow conversations.

 

Omi Necklace

The #1 Open Source AI necklace: Experiment with how you capture and manage conversations.

Build and test with your own Omi Dev Kit 2.

How to Use Google Dialogflow with Google Slides: Usecases

 

Automated Presentation Creation with Google Dialogflow and Google Slides

 

  • Integrate Google Dialogflow with Google Slides to enable voice-activated presentation creation and editing. This integration can streamline workflow, saving time and reducing the manual effort involved in creating presentations.
  •  

  • Use Dialogflow's natural language processing capabilities to parse user commands and dynamically update or create slides based on user input.

 

Setting Up Dialogflow

 

  • Create an agent in Google Dialogflow that will understand commands related to presentation creation, such as adding new slides, inserting images, or modifying text.
  •  

  • Design intents in Dialogflow for specific functions like creating a title slide, adding bullet points, or integrating graphs and charts. Train these intents with sufficient phrases to handle varied user input.

 

Integrating with Google Slides API

 

  • Set up Google Slides API credentials and connect them with Dialogflow so that commands can be translated into API calls for slide modification.
  •  

  • Develop a backend service that handles Dialogflow's webhook requests to perform operations in Google Slides, automating the presentation creation process based on user commands.

 

Using the Integration

 

  • Start by speaking to Dialogflow through the preferred interface (e.g., a website or a mobile app), issuing commands like "Create a new presentation for quarterly sales." The agent interprets this and sets up a basic template in Google Slides.
  •  

  • Continue adding individual slides or modifying content using further voice commands such as "Add a data slide with 2021 sales figures" or "Insert an image of the company logo on the first slide."
  •  

  • Enhance presentations by dynamically adding charts, videos, or live data feeds based on real-time input recognized by Dialogflow and executed via the Google Slides API.

 

Conclusion

 

  • The synergy between Google Dialogflow and Google Slides provides a highly efficient way to create and manage presentations without manual intervention. This solution is particularly useful for business professionals or educators who frequently need to generate presentations and prefer a hands-free, efficient method of doing so.

 

 

Interactive Voice-Activated Team Briefings with Google Dialogflow and Google Slides

 

  • Leverage Google Dialogflow to transform voice commands into interactive team briefings using Google Slides. This integration reduces time spent on slide creation and allows team members to focus on content delivery.
  •  

  • Utilize Dialogflow's language understanding to interpret spoken instructions, enabling the dynamic generation and updating of briefing slides based on user requests.

 

Configuring Dialogflow

 

  • Set up a Google Dialogflow agent to detect commands related to team briefings, such as adding agenda items, including slide notes, or listing action points.
  •  

  • Create intents in Dialogflow to handle specific tasks like generating overview slides, integrating feedback points, or updating deadlines. Train these intents with varied expressions to ensure robust command recognition.

 

Linking with Google Slides API

 

  • Create credentials for the Google Slides API and associate them with Dialogflow to enable conversion of spoken commands into slide editing API requests.
  •  

  • Develop a server-side application to manage Dialogflow webhook requests, which will trigger appropriate actions in Google Slides for seamless slide construction based on user voice commands.

 

Operational Usage

 

  • Initiate the interactive session by voicing commands via preferred channels such as a desktop application or smart device, e.g., "Generate a new team briefing for the marketing launch." The agent intuitively crafts a base structure in Google Slides.
  •  

  • Continue customizing the briefing by issuing commands like "Add a slide with key objectives" or "Update the timeline slide with new product launch dates."
  •  

  • Enhance engagement by incorporating media elements, such as company promotional videos or live product demos, triggered by Dialogflow and executed through the Google Slides API.

 

Final Thoughts

 

  • Integrative technology utilizing Google Dialogflow and Google Slides enables an interactive, streamlined approach to team briefings, favoring business leaders and project managers who require dynamic, rapid slide construction while focusing on effective communication.

 

Omi App

Fully Open-Source AI wearable app: build and use reminders, meeting summaries, task suggestions and more. All in one simple app.

Github →

Order Friend Dev Kit

Open-source AI wearable
Build using the power of recall

Order Now

Troubleshooting Google Dialogflow and Google Slides Integration

How to connect Dialogflow responses to Google Slides?

 

Connect Dialogflow Responses to Google Slides

 

  • First, ensure you have access to Google Cloud and that your Dialogflow agent is properly configured.
  •  

  • Use the Google Slides API and set up authentication with OAuth2. Create credentials from the Google Developer Console. You'll need client ID, client secret, and access to the Google Slides API.

 

from google.oauth2 import service_account
from googleapiclient.discovery import build

SCOPES = ['https://www.googleapis.com/auth/presentations']

def create_google_slides_service():
    creds = service_account.Credentials.from_service_account_file('path/to/credentials.json', scopes=SCOPES)
    return build('slides', 'v1', credentials=creds)

 

  • Integrate Dialogflow with Google Slides by using a webhook. You'll receive user inputs through Dialogflow and send responses to Google Slides as presentation updates.
  •  

  • The following code example demonstrates how you can add a text box to a slide:

 

def add_text_to_slide(service, presentation_id, slide_id, text):
    requests = [
        {
            'insertText': {
                'objectId': slide_id,
                'text': text
            }
        }
    ]
    body = {'requests': requests}
    service.presentations().batchUpdate(presentationId=presentation_id, body=body).execute()

 

  • Handle Dialogflow fulfillment using a webhook to map intents to slide updates. Parse the user input, execute appropriate Google Slides API calls, and send an update back to Dialogflow.
  •  

 

Why is my Dialogflow integration not updating slides?

 

Verify Permissions

 

  • Ensure the connected Google account has permission to view and edit slides. Check the Slides API is enabled in the Google Cloud Console.

 

Check Fulfillment

 

  • Go to the Dialogflow console > Fulfillment. Verify the correct webhook URL is set and enabled.
  • Ensure your webhook code processes incoming requests properly, updating slides using Google Slides API.

 

Inspect Code

 

  • Use the following code sample as a reference to update a slide via the API. Make adjustments as needed:
    const {google} = require('googleapis');
    const slides = google.slides('v1');
    
    slides.presentations.batchUpdate({
      presentationId: 'your_presentation_id',
      resource: {
        requests: [{/* Your update requests */}]
      }
    }, (err, res) => {
      if (err) return console.error('Error:', err);
      console.log('Slides updated successfully:', res.data);
    });
    

 

Test and Debug

 

  • Use a tool like ngrok to expose your localhost while testing. Monitor logs for any errors during the request/responses cycle.

 

How can I automate Google Slides with Dialogflow intents?

 

Set Up Google Slides API

 

  • Create a project in Google Cloud Platform.
  •  

  • Enable the Google Slides API.
  •  

  • Set up OAuth 2.0 credentials and download the JSON file.

 

Set Up Dialogflow Webhook

 

  • Deploy a webhook using a service like Cloud Functions or Express.js server.
  •  

  • Ensure it handles HTTP POST requests from Dialogflow.

 

Connect Dialogflow to Google Slides

 

  • Pair Dialogflow intent with the webhook to trigger actions on Google Slides.

 

const { google } = require('googleapis');
const slides = google.slides('v1');

async function createSlide(authToken) {
  const auth = new google.auth.OAuth2();
  auth.setCredentials({ access_token: authToken });

  const response = await slides.presentations.create({
    auth,
    resource: { title: 'New Presentation' },
  });

  return response.data;
}

 

Handle Intents

 

  • Use the webhook to create or modify Google Slides presentations via API calls when specific Dialogflow intents are triggered.

Don’t let questions slow you down—experience true productivity with the AI Necklace. With Omi, you can have the power of AI wherever you go—summarize ideas, get reminders, and prep for your next project effortlessly.

Order Now

Join the #1 open-source AI wearable community

Build faster and better with 3900+ community members on Omi Discord

Participate in hackathons to expand the Omi platform and win prizes

Participate in hackathons to expand the Omi platform and win prizes

Get cash bounties, free Omi devices and priority access by taking part in community activities

Join our Discord → 

OMI NECKLACE + OMI APP
First & only open-source AI wearable platform

a person looks into the phone with an app for AI Necklace, looking at notes Friend AI Wearable recorded a person looks into the phone with an app for AI Necklace, looking at notes Friend AI Wearable recorded
a person looks into the phone with an app for AI Necklace, looking at notes Friend AI Wearable recorded a person looks into the phone with an app for AI Necklace, looking at notes Friend AI Wearable recorded
online meeting with AI Wearable, showcasing how it works and helps online meeting with AI Wearable, showcasing how it works and helps
online meeting with AI Wearable, showcasing how it works and helps online meeting with AI Wearable, showcasing how it works and helps
App for Friend AI Necklace, showing notes and topics AI Necklace recorded App for Friend AI Necklace, showing notes and topics AI Necklace recorded
App for Friend AI Necklace, showing notes and topics AI Necklace recorded App for Friend AI Necklace, showing notes and topics AI Necklace recorded

OMI NECKLACE: DEV KIT
Order your Omi Dev Kit 2 now and create your use cases

Omi Dev Kit 2

Endless customization

OMI DEV KIT 2

$69.99

Make your life more fun with your AI wearable clone. It gives you thoughts, personalized feedback and becomes your second brain to discuss your thoughts and feelings. Available on iOS and Android.

Your Omi will seamlessly sync with your existing omi persona, giving you a full clone of yourself – with limitless potential for use cases:

  • Real-time conversation transcription and processing;
  • Develop your own use cases for fun and productivity;
  • Hundreds of community apps to make use of your Omi Persona and conversations.

Learn more

Omi Dev Kit 2: build at a new level

Key Specs

OMI DEV KIT

OMI DEV KIT 2

Microphone

Yes

Yes

Battery

4 days (250mAH)

2 days (250mAH)

On-board memory (works without phone)

No

Yes

Speaker

No

Yes

Programmable button

No

Yes

Estimated Delivery 

-

1 week

What people say

“Helping with MEMORY,

COMMUNICATION

with business/life partner,

capturing IDEAS, and solving for

a hearing CHALLENGE."

Nathan Sudds

“I wish I had this device

last summer

to RECORD

A CONVERSATION."

Chris Y.

“Fixed my ADHD and

helped me stay

organized."

David Nigh

OMI NECKLACE: DEV KIT
Take your brain to the next level

LATEST NEWS
Follow and be first in the know

Latest news
FOLLOW AND BE FIRST IN THE KNOW

thought to action

team@basedhardware.com

company

careers

events

invest

privacy

products

omi

omi dev kit

personas

resources

apps

bounties

affiliate

docs

github

help