Schedule meetings from Google Chat

Coding level: Intermediate
Duration: 25 minutes
Project type: Chat app

About this solution

Schedule a meeting in Google Calendar from within a direct message (DM) or a space in Google Chat. You can set specific details for the meeting, such as subject, start time, or duration, or use the default settings for instant meeting scheduling.

Dialog interface of the Meeting Scheduler Chat app

How it works

The Chat app script uses slash commands and dialogs to get meeting details from users and schedule a Calendar event. The script includes default meeting settings that can be customized to fit your needs.

Apps Script services

This solution uses the following services:

  • Calendar Service: Creates the calendar event from the provided meeting info.
  • Base Service: Uses the Session class to get the script's time zone. Calendar uses this time zone when scheduling the event.
  • Utilities Service: Formats the date for the calendar event and encodes the event ID to help get the event URL.

Before you begin

To use this sample, you need the following prerequisites:

  • A Google Account (Google Workspace accounts might require administrator approval)
  • A web browser with access to the internet
  • A Google Cloud project with the Chat API enabled
  • A Google Cloud project with the OAuth consent screen configured

Try it

Step 1: Set up the Apps Script project

  1. Click the button below to open the Schedule meetings from Google Chat Apps Script project.
    Open the project
  2. At the left, click Overview .
  3. At the top-right, click Make a copy The icon for making a copy.
  4. In the copied project, at the left, click Project Settings The icon for project settings.
  5. Under Google Cloud Platform (GCP) Project, click Change project.
  6. Enter your Google Cloud project number and click Set project.
  7. At the top-right, click Deploy > New deployment.
  8. Enter a description for the deployment, such as version 1, and click Deploy.
  9. Copy the deployment ID for use in a later step.

Step 2: Configure the Chat API

  1. In the Google Cloud Console, go to the Chat API page.
    Go to Chat API
  2. Click Configuration.
  3. Configure the Chat API with the following information:
    • Name: Meeting Scheduler
    • Avatar URL: Add a URL that points to an image with a minimum size of 256x256 pixels.
    • Description: Quickly create meetings.
    • Functionality: Check both boxes to let users message the app directly and add it to spaces.
    • Connection settings: Click Apps Script and enter the deployment ID.
    • Slash commands: Add slash commands for /help and /schedule_Meeting by taking the following steps:
      1. Click Add slash command and configure it with the following information:
        • Name: /help
        • Command ID: 1
        • Description: Learn what this app does.
      2. Click Add slash command again and configure it with the following information:
        • Name: /schedule_Meeting
        • Command ID: 2
        • Description: Schedule a meeting.
        • Check the Opens a dialog box.
  4. Click Save.
  5. At the top of the page, under App status, update the status to Live - available to users.
  6. Click Save.

Step 3: Create a meeting

  1. Open Google Chat.
  2. Click Start a chat .
  3. Search for the app's name, Meeting Scheduler.
  4. Send an initial message, such as hello, to prompt authorization.
  5. When the app replies, click Configure and authorize the app.
  6. Send /schedule_Meeting to the app.
  7. In the dialog, add at least one invitee email address. You can update the other fields or use the default entries.
  8. Click Submit.
  9. To view the meeting, click Open Calendar event.

Contributors

This sample is maintained by Google with the help of Google Developer Experts.