Class Dialog

  • Dialog helps you create interactive dialogs within Google Chat apps for displaying information or gathering input.

  • It's exclusively for Google Chat apps and not available for Google Workspace Add-ons.

  • The core functionality involves setting a card, built using CardService, as the body of the dialog to present content to the user.

  • setBody() method is key to setting the card within the dialog and supports chaining for further configurations.

Dialog

For details, see Open interactive dialogs in the Google Chat documentation.

A builder for Dialog objects.

Only available for Google Chat apps. Not available for Google Workspace add-ons.

constcard=CardService.newCardBuilder()
.setHeader(CardService.newCardHeader().setTitle('Card title'))
.build();
// Sets the card of the dialog.
constdialog=CardService.newDialog().setBody(card);

Methods

MethodReturn typeBrief description
setBody(card) Dialog Sets the card of the Dialog.

Detailed documentation

setBody(card)

Sets the card of the Dialog.

constcard=CardService.newCardBuilder()
.setHeader(CardService.newCardHeader().setTitle('Card title'))
.build();
// Sets the card of the dialog.
constdialog=CardService.newDialog().setBody(card);

Parameters

NameTypeDescription
cardCard The Card to use.

Return

Dialog — This object, for chaining.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年01月30日 UTC.