AppsScriptPulse

“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!

NEW Google Chat Import Mode APIs to support message platform migration are now in developer preview

We’re excited to announce that new Google Chat Import Mode APIs are now available in the Developer Preview Program! Import Mode allows developers to import data from other messaging systems while maintaining historical timestamps for messages and spaces. Data from large channels can be copied into Chat spaces silently without notifying the user, sending emails, etc until the admin is ready to have users start using the new space in Chat.

Google are continuing to add developer features to the Google Chat platform, the latest being Import Mode APIs. Theses APIs are designed to help when transitioning from other messaging platforms to Google Chat. Google highlight the following advantages of the new Import Mode APIs:

  • Preservation of resource creation timestamps. You can set a historical time for the creation times of space and message resources, letting Chat apps retain historical context during user adoption of Google Chat.
  • End users can’t view or access spaces in import mode. To prevent user interference of a space undergoing data import, or to avoid possible user confusion as a result of viewing an in-progress data import, spaces in import mode are hidden from end users. After a space has completed import mode, you can add users to the space.
  • Chat turns off notifications during import mode, so that users can avoid unnecessary alerts about the migration. [Ref]

The new Import Mode APIs are currently in Developer Preview and if not already part of the preview program the linked page includes information on how to join.

Source: Overview of developing Google Chat apps to import user data  |  Google for Developers

Copy macros to other Google Sheets (and how to centrally create/update Apps Script code to Google Workspace editors)

 

Image credit: Google

Manually copying Google Sheets macros from one spreadsheet to another can be time consuming and error-prone. This Google Workspace Add-on automatically copies a script project and attaches it to a user-specified spreadsheet. Though this solution focuses on Sheets macros, you can use it to copy and share any container-bound script.

Are you looking for a way to centralize your codebase but deploy it to container-bound scripts? Here is a tutorial for you from the Apps Script samples on the Google Developers site, highlighted by Steve Webster, which gives an alternative approach to deploying as an add-on or sharing a container-bound template.

In the tutorial, you’ll find code that uses the Apps Script API to perform functions like getting, creating, and updating container-bound scripts. As part of the solution you’ll see how you can get the source project content using the Apps Script API, then opening a target Google Sheet to either create or update the container script.

This solution is not limited to Google Sheets only. You can use the same process to update code in other Google Workspace editors like Docs, Forms, and Slides. Usually, I would recommend maintaining and distributing your code as an add-on, however, in certain scenarios, this alternative approach could work well.

Source: Copy macros to other spreadsheets  |  Apps Script  |  Google for Developers