AppsScriptPulse

New Advanced Google Workspace Events service for Google Apps Script


To subscribe to events using Apps Script, you can now use the Advanced Google Workspace Events service.

In the May 02, 2024 Google Apps Script release notes it was announced that a new Advanced Google Workspace Events service is available to let developers use the Google Workspace Events API directly in Google Apps Script. The Google Workspace Events API is a relatively new API, which was released to developer preview in January, 2024. The Google Workspace Events API uses a subscription model to handle resource changes. When you create a subscription, you specify the target resource (such as a Google Chat space or Google Meet meeting space) and the event types that you want to subscribe to. The API then sends notifications to your specified endpoint whenever an event occurs for that resource and event type.

In the case of the new Advanced Google Workspace Events service the linked documentation includes samples for using the new service with Google Chat. It’s worth noting that the Advanced Google Workspace Events service is designed specifically on managing subscriptions to events. While it lets you to control the flow of information and manage event subscriptions in your Apps Script projects, the actual processing and handling of event data occurs separately.

The linked documentation page provides sample code as well as outlines all the prerequisites.

Source: Advanced Google Workspace Events Service

Answer questions based on Google Chat conversations with a Gemini API powered Chat app

This tutorial shows how to make a Google Chat app that answers questions based on conversations in Chat spaces with generative AI powered by Vertex AI with Gemini. The Chat app uses the Google Workspace Events API plus Pub/Sub to recognize and answer questions posted in Chat spaces in real time, even when it isn’t mentioned.

Here is another great tutorial from the Google Chat DevRel team, this time showcasing how the Google Workspace Events API and some new Google Chat UI elements can be used to turn a Chat space into a Gemini Pro powered knowledge base.

The sample solution will let you consume your Chat space message history into a Firestore database. The Chat app is an intelligent agent that can then monitor for new questions and make suggestions using Gemini to generate content based on the previous messages.

There is quite a bit of setup required as part of this tutorial, but it provides a solid foundation for quickly scaling this to your needs.  A demonstration and explanation of the sample app was given as part of the Google Chat apps and APIs: Build connected workflows for the hybrid workplace session at Google Cloud Next and a recording might be available soon!

Source: Answer questions based on Chat conversations with a Gemini AI Chat app  |  Google Chat  |  Google for Developers

“going beyond basic bots” – Tutorial: managing projects with Google Chat, Vertex AI, and Firestore  

Image credit: CC-BY Google

This tutorial shows how to make a Google Chat app that a team can use to manage projects in real time. The Chat app uses Vertex AI to help teams write user stories (which represent features of a software system from the point of view of a user for the team to develop) and persists the stories in a Firestore database.

A recent episode of Totally Unscripted delved into “going beyond basic bots”, highlighting a couple of Google Chat app tutorials from the Google Developer documentation. One example, the “project management” Chat App, is worth mentioning in a Pulse post.

While this example uses Google Cloud Functions instead of Google Apps Script, as discussed in the episode, both approaches share many similarities. Deploying the project management app involves several steps, but I believe it’s a worthwhile investment to learn how to combine different solutions for building Google Workspace integrations. For developers seeking to expand their Google Workspace Add-on capabilities, this example serves as a valuable reference.

If you’re interested in using Firestore for data management but prefer Google Apps Script, Justin Poehnelt’s post on “Using Firestore in Apps Script.” is a great resource. This post provides a basic Firestore wrapper and links to other relevant Apps Script/Firestore libraries.

Source: Manage projects with Google Chat, Vertex AI, and Firestore  |  Google for Developers

Google Apps Script now includes Google Drive API v3 support in the Advanced Services

If you closely follow the Google Workspace Apps Script Samples repo on GitHub (who doesn’t :) you might have spotted a recent commit which updates the Advanced Drive Services to v3.

The v3 of the Google Drive API has actually been around for a number of years launched on December 14, 2015. One of the reasons Google introduced version 3 was it came with performance improvements.

My impression is that the gap between the v2 and v3 has narrowed over the years with minor release updates, but there are still some areas where you can get more from the v3 API. One example reported by Kanshi Tanaike is to query Google Drive files by createdTime.

Google provide a Drive API v2 & v3 comparison guide, which highlights the main differences between the two versions of the API. To use v3 in your Apps Script project when you enable the Advanced Service for Drive you can select the version number.

Source: Drive API v2 & v3 comparison guide  |  Google Drive  |  Google for Developers

New developer documentation helps discover options to extend the Google Workspace UI

Hopefully you are already subscribed to the official Google Workspace Developer Newsletter. If not, or in case you missed the last edition the headline story highlights some new documentation to help developers understand and compare different options for extending the Google Workspace UI:

A major challenge for developers is understanding their options for extending the UI of Google Workspace: Google Workspace Add-ons, Editor Add-ons, Chat apps, Drive apps, and more! Each option has unique strengths, challenges, and limitations. Until now, there hasn’t been a central place for developers to learn what’s possible for extending the Google Workspace UI and to compare the limitations that exist in terms of coding options, UI frameworks, and which options can be published to the Google Workspace Marketplace.

The page includes a nice table included in this post as the feature image.

Source: Extend the Google Workspace UI  |  Google for Developers

New Smart Chips (including AppSheet apps) plus third-party @menu resources in the Google Workspace Editors 

There have been a number of recent updates and announcements around Smart Chips and other integrations to Google Docs, as well as Sheets and Slides. Some have just gone into the Google Workspace Developer Preview Program (DPP), whilst in the case of AppSheet smart chips for Google Docs they are generally available!

AppSheet smart chips for Google Docs

Starting with AppSheet smart chips for Google Docs if you already had the AppSheet Google Docs add-on installed you already have AppSheet smart chips enabled. More details including a link to the Workspace Marketplace Add-on are included in the related Workspace Updates post. The AppSheet smart chips are great way to integrate some of your app functionality in your Google Docs.

Preview links with smart chips in Sheets and Slides

We’ve had custom smart chip link previews for Google Docs for some time, but Google have recently added the same functionality to Sheets and Slides. If you have already developed link previews for Google Docs the good news is there isn’t much more you need to do to enable these for Sheets and Slides (mostly updating your manifest). More details are included on the updated Preview links with smart chips documentation page.

Create third-party resources from the @ menu

Finally, also gone into preview is third-party resource integration which you can use to “let users quickly create resources, such as tasks, support cases, or issues, in your service right from Google Docs. The new resource is then inserted into Google Docs as a smart chip.”. You can read more in the create third-party resources from the @ menu documentation page.

In the case of the preview features a reminder that this is your opportunity to test and give feedback to Google. Links to join and provide feedback are included in the Google Workspace Developer Preview page. Enjoy!

Tutorial: Respond to incidents with Google Chat, Vertex AI, and Apps Script

Imagen: photo looking over the shoulder of a robot looking at a screen with chat messages and hand writing notes

This tutorial shows how to make a Google Chat app that responds to incidents in real time. When responding to an incident, the app creates and populates a Chat space, facilitates incident resolution with messages, slash commands, and dialogs, and uses AI to summarize the incident response in a Google Docs document.

Paraphrasing noted Google Workspace Developer Expert, Romain Vialard, GenAI has made Google Chat apps a tangible prospect. This tutorial from the  Google Developers site is a great example of how you can use Google’s Vertex AI with Google Chat. The tutorial will help you create a Google Apps Script powered Chat app that is able to summaries the messages in a Google Chat space.

There is a lot to take away from this example, but here are some of the headlines:

  • Setting a Google Cloud Project to use the new Google Chat Advanced Service for Apps Script
  • Setup and code for making calls to Google’s Vertex AI PaLM API (LLM) from Google Apps Script
  • Using the responses from Vertex AI to generate new assets.

There is a lot more you can do from this starting point, but hopefully it gives you a great starting point.

Source: Respond to incidents with Google Chat, Vertex AI, and Apps Script  |  Google for Developers

Generally available: You can now call the Chat API from Apps Script with the Advanced Chat Service

The Advanced Chat service lets you use the Google Chat API in Apps Script. This API allows scripts to find, create, and modify Chat spaces, add or remove members to spaces, and read or post messages with text, cards, attachments, and reactions.

There have been a number of updates to the Google Chat API summarised in the linked release notes page. A recent announcement which might interest Google Apps Script developers is the generally available of a new  Advanced Chat Service. As noted in the official documentation:

The Advanced Chat service lets you use the Google Chat API in Apps Script. This API allows scripts to find, create, and modify Chat spaces, add or remove members to spaces, and read or post messages with text, cards, attachments, and reactions.

There are some perquisites to use the Advanced Chat service besides the usual turning it on before use, the main one being the requirement to use a standard Google Cloud console project rather than the default project created automatically.

Source: Google Chat developer platform release notes  |  Google for Developers

Google Meet API is available in Developer Preview

 

Image credit: Google

We’re happy to announce that the Google Meet API is now available for the members of the Developer Preview Program.

Google recently announced new Google Meet API capabilities are now available via the Google Workspace Developer Preview Program:

Launching through our Google Workspace Developer Preview Program, you can now use the Google Meet API. Specifically, among other things, you’ll be able to:

  • Programmatically create and configure Meet calls.
  • Retrieve meeting metadata, such as the meeting times and attendees.
  • Access meeting artifacts, such as transcripts and video recordings.
  • Subscribe to real time updates on meetings, such as when a participant joins or leaves.

The new API open the potential to both customise and get records from Google Meets. The source link provides an overview of the API and methods.

Source: Google Meet API overview  |  Google for Developers

[Official] Apps Script project history – New Feature overview!

We are excited to announce the general availability of project history for Apps Script! Find out how you can get started using this feature.

In Pulse we’ve previously featured the announcement that the new project history was rolling out to Google Apps Script. This feature should have finished following out and this video from the Google Workspace team covers how you can use project history in the Apps Script IDE. As well as the video there is also an update to the Google Apps Script Versions documentation page.

The key takeaway for Google Apps Script users is unlike Google Docs which can automatically save a version history of a document, Apps Script project history requires the user to use deployments (Deploy > Manage deployments) to create a version should you want to see get a highlights or code changes between the current and previous versions. This will be less of an issue if you are using Google Apps Script to  deploy web apps, Workspace Add-ons or libraries, which already use deployments, but for other situations like container bound scripts you might want to get into the habit of using the Deploy button to create a version.

Source: Apps Script project history – New Feature!