Anatomy of Chat apps - Advanced interaction

Anatomy of Chat apps - Advanced interaction

Advanced Interaction Elements in Google Chat Apps

Overview of Advanced Interaction Elements

  • Chanel, a Developer Advocate at Google, introduces four advanced interaction elements for Google Chat apps: slash commands, dialogs, preview links, and message attachments.
  • Slash commands allow users to interact with app features; for example, typing /help can display available commands and their descriptions.

Slash Commands

  • In the Google Cloud Console, developers can configure slash commands by defining a name, unique identifier, and description.
  • When invoked, an additional field is attached to the message indicating the selected command ID and its annotation for easier handling within the app.

Dialogs

  • Dialogs are useful for collecting structured information or configuring settings; they can be created using the Card Builder tool.
  • Sequential dialogs help users complete multi-step processes. The event received from Google Chat indicates whether a dialog was opened or canceled.

Handling Dialog Events

  • Upon form submission in a dialog, a CARD_CLICKED event is sent with relevant data. The app must process this data accordingly.
  • If required fields are missing (e.g., "name"), the app returns an error; otherwise, it acknowledges receipt and closes the dialog.

Link Previewing

  • Users often share links in chat; link previewing allows apps to attach cards that provide additional information about these links.
  • Cards include interactive elements like buttons and can be updated based on user interactions after sending messages containing links.

Configuring Link Previews

  • Developers can enable link previews in the Chat API configuration page by registering specific URL patterns.
  • When users click buttons on preview cards (e.g., "Assign to me"), apps update these cards dynamically based on user actions.

Message Attachments

  • Users can send attachments such as files from Google Drive. The JSON representation of attachments includes details about their source type (e.g., UPLOADED_CONTENT).
  • For Google Drive files, attachment references include file IDs necessary for retrieval via the Media API.

Conclusion & Further Learning

Video description

In this video, we are going to show you the different advanced interaction elements you can use when creating Google Chat apps. Chapters: 00:00 - Intro 00:35 - Slash commands 01:46 - Dialogs 03:38 - Preview links 05:59 - Message attachments Watch more videos from this series: Anatomy of Google Chat Apps - Architecture: https://youtu.be/kcwxYcwBxig Anatomy of Google Chat Apps - Basic Interaction: https://youtu.be/6q_96tyXwOc Check out the Google Chat for Developers documentation: https://goo.gle/docs-chat #GoogleChat #GoogleWorkspace #ChatApps