Card Service

Card Service

This service allows scripts to configure and build card and widget components and behaviors for a UI. The UI structures you build with this service are automatically available in both desktop and mobile devices, so you don't need to develop separate UIs for both.

Classes

NameBrief description
ActionAn action that enables interactivity within UI elements.
ActionResponseThe response object that may be returned from a callback function (e.g., a form response handler) to perform one or more actions on the client.
ActionResponseBuilderA builder for ActionResponse objects.
ActionStatusA class that represents the status for a request to either invoke or submit a dialog.
AttachmentRepresents an attachment created by an add-on.
AuthorizationActionAn authorization action that will send the user to the AuthorizationUrl when clicked.
AuthorizationExceptionAn error that can be returned to trigger an authorization card to be shown to the user.
BorderStyleA class that represents a complete border style that can be applied to widgets.
BorderTypeAn enum that represents the border types that can be applied to widgets.
ButtonA base class for all buttons.
ButtonSetHolds a set of Button objects that are displayed in a row.
CalendarEventActionResponseRepresents a response that makes changes to the calendar event that the user is currently editing in reaction to an action taken in the UI, such as a button click.
CalendarEventActionResponseBuilderA builder for CalendarEventActionResponse objects.
CardA context card that represents a single view in the UI.
CardActionA clickable menu item that is added to the card header menu.
CardBuilderA builder for Card objects.
CardHeaderThe header of a Card.
CardSectionA card section holds groups of widgets and provides visual separation between them.
CardServiceCardService provides the ability to create generic cards used across different Google extensibility products, such as Google Workspace Add-ons.
CardWithIdA builder for CardWithId objects.
ChatActionResponseA class that represents the parameters that a Chat app can use to configure how its response is posted.
ChatClientDataSourceFor a SelectionInput widget that uses a multiselect menu, a data source from Google Chat.
ChatResponseThe response object for a card message in Google Chat.
ChatResponseBuilderA builder for ChatResponse objects.
ChatSpaceDataSourceA data source that populates Google Chat spaces as selection items for a multiselect menu.
CommonDataSourceA data source shared by all Google Workspace applications.
ComposeActionResponseThe response object that may be returned from a callback method for compose action in a Gmail add-on.
ComposeActionResponseBuilderA builder for ComposeActionResponse objects.
ComposedEmailTypeAn enum value that specifies whether the composed email is a standalone or reply draft.
ContentTypeAn enum value that specifies the content type of the content generated by a UpdateDraftActionResponse.
DatePickerAn input field that allows inputing a date.
DateTimePickerAn input field that allows users to input a date and time.
DecoratedTextA widget that displays text with optional decorations.
DialogFor details, see Open interactive dialogs in the Google Chat documentation.
DialogActionA builder for DialogAction objects.
DisplayStyleAn enum that defines the display style of card.
DividerA horizontal divider.
DriveItemsSelectedActionResponseRepresents a response that makes changes to Drive while Drive items are selected and in reaction to an action taken in the UI, such as a button click.
DriveItemsSelectedActionResponseBuilderA builder for DriveItemsSelectedActionResponse objects.
EditorFileScopeActionResponseMakes changes to an Editor, such as Google Docs, Sheets, or Slides in reaction to an action taken in the UI.
EditorFileScopeActionResponseBuilderA builder for EditorFileScopeActionResponse objects.
FixedFooterThe fixed footer shown at the bottom of a Card.
GridAn organized grid to display a collection of grid items.
GridItemThe items users interact with within a grid widget.
GridItemLayoutAn enum that defines the image and text style of a GridItem.
HorizontalAlignmentAn enum that specifies the horizontal alignment of a widget.
HorizontalSizeStyleAn enum that sets how widgets fill the space of a column.
HostAppDataSourceFor a SelectionInput widget that uses a multiselect menu, a data source from a Google Workspace application.
IconPredefined icons that can be used in various UI objects, such as ImageButton or DecoratedText widgets.
IconImageA predefined icon, a material design icon, or an icon from a URL with a customizable crop style.
ImageA widget that shows a single image.
ImageButtonA ImageButton with an image displayed on it.
ImageComponentAn image component that can be added to grid items.
ImageCropStyleA class that represents a crop style that can be applied to image components.
ImageCropTypeAn enum that represents the crop styles applied to image components.
ImageStyleAn enum that defines an image cropping style.
InteractionAn enum type that specifies what to do in response to an interaction with a user, such as a user clicking a button in a card message.
KeyValueThis class is deprecated.
LinkPreviewCard action that displays a link preview card and smart chip in the host app.
LoadIndicatorAn enum type that specifies the type of loading or progress indicator to display while an Action is being processed.
NavigationA helper object that controls card navigation.
NotificationA notification shown to the user as a response to interacting with a UI element.
OnCloseAn enum that specifies what to do when a URL opened through an OpenLink is closed.
OpenAsAn enum that specifies how to open a URL.
OpenLinkRepresents an action to open a link with some options.
PlatformDataSourceFor a SelectionInput widget that uses a multiselect menu, a data source from Google Workspace.
ResponseTypeAn enum that represents the type of Chat app response.
SelectionInputAn input field that allows choosing between a set of predefined options.
SelectionInputTypeThe format of the items that users can select.
StatusAn enum that represents the status code.
SuggestionsAutocomplete suggestions to supplement a TextInput widget.
SuggestionsResponseA response object that can be returned from a suggestions callback function.
SuggestionsResponseBuilderA builder for SuggestionsResponse objects.
SwitchA UI element that supports being toggled on or off.
SwitchControlTypeType of a Switch widget control.
TextButtonA TextButton with a text label.
TextButtonStyleAn enum that specifies the style for TextButton.
TextInputA input field widget that accepts text input.
TextParagraphA widget that displays text and supports basic HTML formatting.
TimePickerAn input field that allows users to input a time.
UniversalActionResponseThe response object that may be returned from a method that creates universal action.
UniversalActionResponseBuilderA builder for the UniversalActionResponse objects.
UpdateDraftActionResponseRepresents an action that updates the email draft that the user is currently editing.
UpdateDraftActionResponseBuilderA builder for UpdateDraftActionResponse objects.
UpdateDraftBccRecipientsActionUpdates the Bcc recipients of an email draft.
UpdateDraftBodyActionUpdates the email draft body.
UpdateDraftBodyTypeAn enum value that specifies the type of an UpdateDraftBodyAction.
UpdateDraftCcRecipientsActionUpdates the Cc recipients of an email draft.
UpdateDraftSubjectActionUpdates the subject line of an email draft.
UpdateDraftToRecipientsActionUpdates the To recipients of an email draft.
UpdatedWidgetThe response of the updated widget.
VerticalAlignmentAn enum that sets the vertical alignment of widgets in a column.
WidgetBase class for all widgets that can be added to a Card.
WrapStyleAn enum that sets the wrapping style for content within a column.

Action

Methods

MethodReturn typeBrief description
setFunctionName(functionName)ActionSets the name of the callback function to be called.
setInteraction(interaction)ActionSets the interaction with a user, only required when opening a dialog.
setLoadIndicator(loadIndicator)ActionSets the loading indicator that displays while the action is in progress.
setParameters(parameters)ActionAllows custom parameters to be passed to the callback function.
setPersistValues(persistValues)ActionIndicates whether form values are determined by the client's values or the server's values after an action response updates the form's Card.

ActionResponse

Methods

MethodReturn typeBrief description
printJson()StringPrints the JSON representation of this object.

ActionResponseBuilder

Methods

MethodReturn typeBrief description
build()ActionResponseBuilds the current action response and validates it.
setNavigation(navigation)ActionResponseBuilderSets the response to a Navigation action.
setNotification(notification)ActionResponseBuilderSets the notification to display when the action is activated.
setOpenLink(openLink)ActionResponseBuilderSets the URL to navigate to when the action is activated.
setStateChanged(stateChanged)ActionResponseBuilderSets a flag to indicate that this action changed the existing data state.

ActionStatus

Methods

MethodReturn typeBrief description
setStatusCode(statusCode)ActionStatusRepresents the status for a request to either open or submit a dialog.
setUserFacingMessage(message)ActionStatusThe message to send users about the status of their request.

Attachment

Methods

MethodReturn typeBrief description
setIconUrl(iconUrl)AttachmentSets the icon URL for the attachment.
setMimeType(mimeType)AttachmentSets the MIME type for the attachment.
setResourceUrl(resourceUrl)AttachmentSets the resource URL for the attachment.
setTitle(title)AttachmentSets the title for the attachment.

AuthorizationAction

Methods

MethodReturn typeBrief description
setAuthorizationUrl(authorizationUrl)AuthorizationActionSets the authorization URL that user is taken to from the authorization prompt.

AuthorizationException

Methods

MethodReturn typeBrief description
printJson()StringPrints the JSON representation of this object.
setAuthorizationUrl(authUrl)AuthorizationExceptionSets the authorization URL that user is taken to from the authorization prompt.
setCustomUiCallback(callback)AuthorizationExceptionThe name of a function to call to generate a custom authorization prompt.
setResourceDisplayName(name)AuthorizationExceptionSets the name that is displayed to the user when asking for authorization.
throwException()voidTriggers this exception to be thrown.

BorderStyle

Methods

MethodReturn typeBrief description
setCornerRadius(radius)BorderStyleSets the corner radius of the border, for example 8.
setStrokeColor(color)BorderStyleSets the color of the border.
setType(type)BorderStyleSets the type of the border.

BorderType

Properties

PropertyTypeDescription
NO_BORDEREnumNo border style.
STROKEEnumStroke border style.

Button

Methods

MethodReturn typeBrief description
setAuthorizationAction(action)ButtonSets an authorization action that opens a URL to the authorization flow when the object is clicked.
setComposeAction(action, composedEmailType)ButtonSets an action that composes a draft email when the object is clicked.
setOnClickAction(action)ButtonSets an action that executes when the object is clicked.
setOnClickOpenLinkAction(action)ButtonSets an action that opens a URL in a tab when the object is clicked.
setOpenLink(openLink)ButtonSets a URL to be opened when the object is clicked.

ButtonSet

Methods

MethodReturn typeBrief description
addButton(button)ButtonSetAdds a button.

CalendarEventActionResponse

Methods

MethodReturn typeBrief description
printJson()StringPrints the JSON representation of this object.

CalendarEventActionResponseBuilder

Methods

MethodReturn typeBrief description
addAttachments(attachments)CalendarEventActionResponseBuilderSpecifies that the response should add the attachments to the Calendar event when the associated UI action is taken.
addAttendees(emails)CalendarEventActionResponseBuilderSpecifies that the response should add the indicated attendees to the Calendar event when the associated UI action is taken.
build()CalendarEventActionResponseBuilds the current Calendar event action response and validates it.
setConferenceData(conferenceData)CalendarEventActionResponseBuilderSpecifies that the response should set the indicated conference data to the Calendar event when the associated UI action is taken.

Card

Methods

MethodReturn typeBrief description
printJson()StringPrints the JSON representation of this object.

CardAction

Methods

MethodReturn typeBrief description
setAuthorizationAction(action)CardActionSets an authorization action that opens a URL to the authorization flow when the object is clicked.
setComposeAction(action, composedEmailType)CardActionSets an action that composes a draft email when the object is clicked.
setOnClickAction(action)CardActionSets an action that executes when the object is clicked.
setOnClickOpenLinkAction(action)CardActionSets an action that opens a URL in a tab when the object is clicked.
setOpenLink(openLink)CardActionSets a URL to be opened when the object is clicked.
setText(text)CardActionSets the menu text for this action.

CardBuilder

Methods

MethodReturn typeBrief description
addCardAction(cardAction)CardBuilderAdds a CardAction to this Card.
addSection(section)CardBuilderAdds a section to this card.
build()CardBuilds the current card and validates it.
setDisplayStyle(displayStyle)CardBuilderSets the display style for this card.
setFixedFooter(fixedFooter)CardBuilderSets a fixed footer for this card.
setHeader(cardHeader)CardBuilderSets the header for this card.
setName(name)CardBuilderSets the name for this card.
setPeekCardHeader(peekCardHeader)CardBuilderSets the peek card header.

CardHeader

Methods

MethodReturn typeBrief description
setImageAltText(imageAltText)CardHeaderSets the alternative text for the header image.
setImageStyle(imageStyle)CardHeaderSets the cropping of the icon in the card header.
setImageUrl(imageUrl)CardHeaderSets the image to use in the header by providing its URL or data string.
setSubtitle(subtitle)CardHeaderSets the subtitle of the card header.
setTitle(title)CardHeaderSets the title of the card header.

CardSection

Methods

MethodReturn typeBrief description
addWidget(widget)CardSectionAdds the given widget to this section.
setCollapsible(collapsible)CardSectionSets whether the section can be collapsed.
setHeader(header)CardSectionSets the header of the section.
setNumUncollapsibleWidgets(numUncollapsibleWidgets)CardSectionSets the number of widgets that are still shown when this section is collapsed.

CardService

Properties

PropertyTypeDescription
BorderTypeBorderTypeThe BorderType enumeration.
ComposedEmailTypeComposedEmailTypeThe ComposedEmailType enumeration.
ContentTypeContentTypeThe ContentType enumeration.
GridItemLayoutGridItemLayoutThe GridItemLayout enumeration.
HorizontalAlignmentHorizontalAlignmentThe HorizontalAlignment enumeration.
IconIconThe Icon enumeration.
ImageCropTypeImageCropTypeThe ImageCropType enumeration.
ImageStyleImageStyleThe ImageStyle enumeration.
LoadIndicatorLoadIndicatorThe LoadIndicator enumeration.
OnCloseOnCloseThe OnClose enumeration.
OpenAsOpenAsThe OpenAs enumeration.
SelectionInputTypeSelectionInputTypeThe SelectionInputType enumeration.
TextButtonStyleTextButtonStyleThe TextButtonStyle enumeration.
UpdateDraftBodyTypeUpdateDraftBodyTypeThe UpdateDraftBodyType enumeration.

Methods

MethodReturn typeBrief description
newAction()ActionCreates a new Action.
newActionResponseBuilder()ActionResponseBuilderCreates a new ActionResponseBuilder.
newActionStatus()ActionStatusCreates a new ActionStatus.
newAttachment()AttachmentCreates a new Attachment.
newAuthorizationAction()AuthorizationActionCreates a new AuthorizationAction.
newAuthorizationException()AuthorizationExceptionCreates a new AuthorizationException.
newBorderStyle()BorderStyleCreates a new BorderStyle.
newButtonSet()ButtonSetCreates a new ButtonSet.
newCalendarEventActionResponseBuilder()CalendarEventActionResponseBuilderCreates a new CalendarEventActionResponseBuilder.
newCardAction()CardActionCreates a new CardAction.
newCardBuilder()CardBuilderCreates a new CardBuilder.
newCardHeader()CardHeaderCreates a new CardHeader.
newCardSection()CardSectionCreates a new CardSection.
newCardWithId()CardWithIdCreates a new CardWithId.
newChatActionResponse()ChatActionResponseCreates a new ChatActionResponse.
newChatResponseBuilder()ChatResponseBuilderCreates a new ChatResponseBuilder.
newColumn()ColumnCreates a new Column.
newColumns()ColumnsCreates a new set of Columns.
newComposeActionResponseBuilder()ComposeActionResponseBuilderCreates a new ComposeActionResponseBuilder.
newDatePicker()DatePickerCreates a new DatePicker.
newDateTimePicker()DateTimePickerCreates a new DateTimePicker.
newDecoratedText()DecoratedTextCreates a new DecoratedText.
newDialog()DialogCreates a new Dialog.
newDialogAction()DialogActionCreates a new DialogAction.
newDivider()DividerCreates a new Divider.
newDriveItemsSelectedActionResponseBuilder()DriveItemsSelectedActionResponseBuilderCreates a new DriveItemsSelectedActionResponseBuilder.
newEditorFileScopeActionResponseBuilder()EditorFileScopeActionResponseBuilderCreates a new EditorFileScopeActionResponseBuilder.
newFixedFooter()FixedFooterCreates a new FixedFooter.
newGrid()GridCreates a new Grid.
newGridItem()GridItemCreates a new GridItem.
newIconImage()IconImageCreates a new IconImage.
newImage()ImageCreates a new Image.
newImageButton()ImageButtonCreates a new ImageButton.
newImageComponent()ImageComponentCreates a new ImageComponent.
newImageCropStyle()ImageCropStyleCreates a new ImageCropStyle.
newKeyValue()KeyValueCreates a new KeyValue.
newLinkPreview()LinkPreviewCreates a new LinkPreview.
newNavigation()NavigationCreates a new Navigation.
newNotification()NotificationCreates a new Notification.
newOpenLink()OpenLinkCreates a new OpenLink.
newSelectionInput()SelectionInputCreates a new SelectionInput.
newSuggestions()SuggestionsCreates a new Suggestions.
newSuggestionsResponseBuilder()SuggestionsResponseBuilderCreates a new SuggestionsResponseBuilder.
newSwitch()SwitchCreates a new Switch.
newTextButton()TextButtonCreates a new TextButton.
newTextInput()TextInputCreates a new TextInput.
newTextParagraph()TextParagraphCreates a new TextParagraph.
newTimePicker()TimePickerCreates a new TimePicker.
newUniversalActionResponseBuilder()UniversalActionResponseBuilderCreates a new UniversalActionResponseBuilder.
newUpdateDraftActionResponseBuilder()UpdateDraftActionResponseBuilderCreates a new UpdateDraftActionResponseBuilder.
newUpdateDraftBccRecipientsAction()UpdateDraftBccRecipientsActionCreates a new UpdateDraftBccRecipientsAction;
newUpdateDraftBodyAction()UpdateDraftBodyActionCreates a new UpdateDraftBodyAction.
newUpdateDraftCcRecipientsAction()UpdateDraftCcRecipientsActionCreates a new UpdateDraftCcRecipientsAction.
newUpdateDraftSubjectAction()UpdateDraftSubjectActionCreates a new UpdateDraftSubjectAction.
newUpdateDraftToRecipientsAction()UpdateDraftToRecipientsActionCreates a new UpdateDraftToRecipientsAction.

CardWithId

Methods

MethodReturn typeBrief description
setCard(card)CardWithIdSets the card of the cardWithId.
setCardId(id)CardWithIdSets the unique card ID of the cardWithId.

ChatActionResponse

Methods

MethodReturn typeBrief description
setDialogAction(dialogAction)ChatActionResponseSets the dialog action to an event related to a dialog.
setResponseType(responseType)ChatActionResponseThe type of Chat app response.
setUpdatedWidget(updatedWidget)ChatActionResponseSets the updated widget, used to provide autocomplete options for a widget.
setUrl(url)ChatActionResponseThe URL for users to authenticate or configure.

ChatClientDataSource

Methods

MethodReturn typeBrief description
setSpaceDataSource(spaceDataSource)ChatClientDataSourceA data source that populates Google Chat spaces as selection items for a multiselect menu.

ChatResponse

Methods

MethodReturn typeBrief description
printJson()StringPrints the JSON representation of this object.

ChatResponseBuilder

Methods

MethodReturn typeBrief description
addCardsV2(cardWithId)ChatResponseBuilderSets the card field of the message.
build()ChatResponseBuilds the current action response and validates it.
setActionResponse(actionResponse)ChatResponseBuilderSets the action response field of the message.
setText(text)ChatResponseBuilderSets the text of the Chat message.

ChatSpaceDataSource

Methods

MethodReturn typeBrief description
setDefaultToCurrentSpace(defaultToCurrentSpace)ChatSpaceDataSourceIf set to true, the multi select menu selects the current Google Chat space as an item by default.

Column

Columns

Methods

MethodReturn typeBrief description
addColumn(column)ColumnsAdds a Column to the Columns widget.
setWrapStyle(wrapStyle)ColumnsSets the wrap style of the columns, controls how the column resizes based on screen width.

CommonDataSource

Properties

PropertyTypeDescription
UNKNOWNEnumDefault value.
USEREnumGoogle Workspace users.

ComposeActionResponse

Methods

MethodReturn typeBrief description
printJson()StringPrints the JSON representation of this object.

ComposeActionResponseBuilder

Methods

MethodReturn typeBrief description
build()ComposeActionResponseBuilds the current compose action response and validates it.
setGmailDraft(draft)ComposeActionResponseBuilderSets the draft GmailMessage created using GmailMessage.createDraftReply(body) or similar functions.

ComposedEmailType

Properties

PropertyTypeDescription
REPLY_AS_DRAFTEnumA draft that is a reply to another message.
STANDALONE_DRAFTEnumA draft that is a standalone message.

ContentType

Properties

PropertyTypeDescription
TEXTEnumIndicates that the generated content is plain text.
MUTABLE_HTMLEnumIndicates that the generated content is formatted as HTML.
IMMUTABLE_HTMLEnumIndicates that the generated content is formatted as HTML, but this content cannot be edited after it is generated.

DatePicker

Methods

MethodReturn typeBrief description
setFieldName(fieldName)DatePickerSets the field name that identifies this picker in the event object that is generated when there is a UI interaction.
setOnChangeAction(action)DatePickerSets an Action that the script performs whenever the picker input changes.
setTitle(title)DatePickerSets the title displayed above the input field.
setValueInMsSinceEpoch(valueMsEpoch)DatePickerSets the prefilled value to be set in the input field.
setValueInMsSinceEpoch(valueMsEpoch)DatePickerSets the prefilled value to be set in the input field.

DateTimePicker

Methods

MethodReturn typeBrief description
setFieldName(fieldName)DateTimePickerSets the field name that identifies this picker in the event object that is generated when there is a UI interaction.
setOnChangeAction(action)DateTimePickerSets an Action that the script performs whenever the picker input changes.
setTimeZoneOffsetInMins(timeZoneOffsetMins)DateTimePickerSets the number of minutes that the time zone should be offset from UTC.
setTitle(title)DateTimePickerSets the title displayed above the input field.
setValueInMsSinceEpoch(valueMsEpoch)DateTimePickerSets the prefilled value to be set in the input field.
setValueInMsSinceEpoch(valueMsEpoch)DateTimePickerSets the prefilled value to be set in the input field.

DecoratedText

Methods

MethodReturn typeBrief description
setAuthorizationAction(action)DecoratedTextSets an authorization action that opens a URL to the authorization flow when the object is clicked.
setBottomLabel(text)DecoratedTextSets the label text to be used as the key and is displayed below the text content.
setButton(button)DecoratedTextSets the Button that is displayed to the right of the text.
setComposeAction(action, composedEmailType)DecoratedTextSets an action that composes a draft email when the object is clicked.
setEndIcon(endIcon)DecoratedTextSets the optional IconImage that is displayed to the right of the content.
setOnClickAction(action)DecoratedTextSets an action that executes when the object is clicked.
setOnClickOpenLinkAction(action)DecoratedTextSets an action that opens a URL in a tab when the object is clicked.
setOpenLink(openLink)DecoratedTextSets a URL to be opened when the object is clicked.
setStartIcon(startIcon)DecoratedTextSets the optional IconImage to display before the text content.
setSwitchControl(switchToSet)DecoratedTextSets the Switch that is displayed to the right of the content.
setText(text)DecoratedTextSets the text to be used as the value.
setTopLabel(text)DecoratedTextSets the label text to be used as the key and is displayed above the text content.
setWrapText(wrapText)DecoratedTextSets whether the value text should be displayed on a single line or multiple lines.

Dialog

Methods

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

DialogAction

Methods

MethodReturn typeBrief description
setActionStatus(actionStatus)DialogActionSets the action status of DialogAction.
setDialog(dialog)DialogActionSets the dialog of the DialogAction.

DisplayStyle

Properties

PropertyTypeDescription
PEEKEnumShow the card header at the bottom of add-on content over existing content.
REPLACEEnumShow the card by replacing existing content.

Divider

DriveItemsSelectedActionResponse

Methods

MethodReturn typeBrief description
printJson()StringPrints the JSON representation of this object.

DriveItemsSelectedActionResponseBuilder

Methods

MethodReturn typeBrief description
build()DriveItemsSelectedActionResponseBuilds the current Drive action response.
requestFileScope(itemId)DriveItemsSelectedActionResponseBuilderSpecifies that the response requests file scope for the contextually-relevant item in Drive.

EditorFileScopeActionResponse

Methods

MethodReturn typeBrief description
printJson()StringPrints the JSON representation of this object.

EditorFileScopeActionResponseBuilder

Methods

MethodReturn typeBrief description
build()EditorFileScopeActionResponseBuilds the current Editor action response.
requestFileScopeForActiveDocument()EditorFileScopeActionResponseBuilderRequests the drive.file scope for the current active Editor document.

FixedFooter

Methods

MethodReturn typeBrief description
setPrimaryButton(button)FixedFooterSet the primary button in the fixed footer.
setSecondaryButton(button)FixedFooterSet the secondary button in the fixed footer.

Grid

Methods

MethodReturn typeBrief description
addItem(gridItem)GridAdds a new grid item to the grid.
setAuthorizationAction(action)GridSets an authorization action that opens a URL to the authorization flow when the object is clicked.
setBorderStyle(borderStyle)GridSets the border style applied to each grid item.
setComposeAction(action, composedEmailType)GridSets an action that composes a draft email when the object is clicked.
setNumColumns(numColumns)GridThe number of columns to display in the grid.
setOnClickAction(action)GridSets an action that executes when the object is clicked.
setOnClickOpenLinkAction(action)GridSets an action that opens a URL in a tab when the object is clicked.
setOpenLink(openLink)GridSets a URL to be opened when the object is clicked.
setTitle(title)GridSets the title text of the grid.

GridItem

Methods

MethodReturn typeBrief description
setIdentifier(id)GridItemSets the identifier for the grid item.
setImage(image)GridItemSets the image for this grid item.
setLayout(layout)GridItemSets the layout of text and image for the grid item.
setSubtitle(subtitle)GridItemSets the subtitle of the grid item.
setTextAlignment(alignment)GridItemSets the horizontal alignment of the grid item.
setTitle(title)GridItemSets the title text of the grid item.

GridItemLayout

Properties

PropertyTypeDescription
TEXT_BELOWEnumThe title and subtitle are shown below the grid item's image.
TEXT_ABOVEEnumThe title and subtitle are shown above the grid item's image.

HorizontalAlignment

Properties

PropertyTypeDescription
STARTEnumAlign the widget to the start of the sentence side.
CENTEREnumAlign the widget to the center.
ENDEnumAlign the widget to the end of the sentence side.

HorizontalSizeStyle

Properties

PropertyTypeDescription
FILL_AVAILABLE_SPACEEnumSizes the Widget to fill the available horizontal space of a Column.
FILL_MINIMUM_SPACEEnumResizes the Widget to fill the least amount of horizontal space in a Column.

HostAppDataSource

Methods

MethodReturn typeBrief description
setChatDataSource(chatClientDataSource)HostAppDataSourceSets the data source from Google Chat.

Icon

Properties

PropertyTypeDescription
NONEEnumNo icon.
AIRPLANEEnumAirplane flight icon
BOOKMARKEnumBookmark icon
BUSEnumBus icon
CAREnumCar icon
CLOCKEnumClock icon
CONFIRMATION_NUMBER_ICONEnumConfirmation number icon
DOLLAREnumDollar icon
DESCRIPTIONEnumDescription icon
EMAILEnumEmail icon
EVENT_PERFORMEREnumEmail icon
EVENT_SEATEnumEvent seat icon
FLIGHT_ARRIVALEnumFlight arrival icon
FLIGHT_DEPARTUREEnumFlight departure icon
HOTELEnumHotel icon
HOTEL_ROOM_TYPEEnumHotel icon
INVITEEnumInvite icon
MAP_PINEnumMap pin icon
MEMBERSHIPEnumMembershipt icon
MULTIPLE_PEOPLEEnumMultiple people icon
OFFEREnumOffer icon
PERSONEnumPerson icon
PHONEEnumPhone icon
RESTAURANT_ICONEnumRestaurant icon
SHOPPING_CARTEnumShopping cart icon
STAREnumStar icon
STOREEnumStore icon
TICKETEnumTicket icon
TRAINEnumTrain icon
VIDEO_CAMERAEnumVideo camera icon
VIDEO_PLAYEnumVideo play icon

IconImage

Methods

MethodReturn typeBrief description
setAltText(altText)IconImageSets the alternative text of the URL which is used for accessibility.
setIcon(icon)IconImageSets the predefined icon if the URL is not set.
setIconUrl(url)IconImageSets the URL of the icon if the icon is not set.
setImageCropType(imageCropType)IconImageSets the crop style for the image.

Image

Methods

MethodReturn typeBrief description
setAltText(altText)ImageSets the alternative text of the image for accessibility.
setAuthorizationAction(action)ImageSets an authorization action that opens a URL to the authorization flow when the object is clicked.
setComposeAction(action, composedEmailType)ImageSets an action that composes a draft email when the object is clicked.
setImageUrl(url)ImageSets the image to use by providing its URL or data string.
setOnClickAction(action)ImageSets an action that executes when the object is clicked.
setOnClickOpenLinkAction(action)ImageSets an action that opens a URL in a tab when the object is clicked.
setOpenLink(openLink)ImageSets a URL to be opened when the object is clicked.

ImageButton

Methods

MethodReturn typeBrief description
setAltText(altText)ImageButtonSets the alternative text of the button for accessibility.
setAuthorizationAction(action)ImageButtonSets an authorization action that opens a URL to the authorization flow when the object is clicked.
setComposeAction(action, composedEmailType)ImageButtonSets an action that composes a draft email when the object is clicked.
setIcon(icon)ImageButtonSets a predefined Icon to display on the button.
setIconUrl(url)ImageButtonSets the URL of an image to use as this button's icon.
setOnClickAction(action)ImageButtonSets an action that executes when the object is clicked.
setOnClickOpenLinkAction(action)ImageButtonSets an action that opens a URL in a tab when the object is clicked.
setOpenLink(openLink)ImageButtonSets a URL to be opened when the object is clicked.

ImageComponent

Methods

MethodReturn typeBrief description
setAltText(altText)ImageComponentSets the alternative text of the image.
setBorderStyle(borderStyle)ImageComponentSets the border style applied to the image.
setCropStyle(imageCropStyle)ImageComponentSets the crop style for the image.
setImageUrl(url)ImageComponentSets the URL of the image.

ImageCropStyle

Methods

MethodReturn typeBrief description
setAspectRatio(ratio)ImageCropStyleSets the aspect ratio to use if the crop type is RECTANGLE_CUSTOM.
setImageCropType(type)ImageCropStyleSets the crop type for the image.

ImageCropType

Properties

PropertyTypeDescription
SQUAREEnumSquare shape crop style.
CIRCLEEnumCircle shape crop style.
RECTANGLE_CUSTOMEnumRectangle shape crop style with custom ratio.
RECTANGLE_4_3EnumRectangle shape crop style with 4:3 ratio.

ImageStyle

Properties

PropertyTypeDescription
SQUAREEnumNo cropping.
CIRCLEEnumCrop to a circle shape.

Interaction

Properties

PropertyTypeDescription
INTERACTION_UNSPECIFIEDEnumDefault value.
OPEN_DIALOGEnumOpens a dialog, a card-based interface that Chat apps use to interact with users.

KeyValue

Methods

MethodReturn typeBrief description
setAuthorizationAction(action)KeyValueSets an authorization action that opens a URL to the authorization flow when the object is clicked.
setComposeAction(action, composedEmailType)KeyValueSets an action that composes a draft email when the object is clicked.
setOnClickAction(action)KeyValueSets an action that executes when the object is clicked.
setOnClickOpenLinkAction(action)KeyValueSets an action that opens a URL in a tab when the object is clicked.
setOpenLink(openLink)KeyValueSets a URL to be opened when the object is clicked.

LinkPreview

Methods

MethodReturn typeBrief description
printJson()StringPrints the JSON representation of this object.
setLinkPreviewTitle(title)LinkPreviewSets the title that displays in the link preview above the preview card.
setPreviewCard(previewCard)LinkPreviewSets the card that displays information about a link from a third-party or non-Google service.
setTitle(title)LinkPreviewSets the title that displays in the smart chip for the link preview.

LoadIndicator

Properties

PropertyTypeDescription
SPINNEREnumUse a spinner indicator.
NONEEnumDo not use an indicator.

Methods

MethodReturn typeBrief description
popCard()NavigationPops a card from the navigation stack.
popToNamedCard(cardName)NavigationPops to the specified card by its card name.
popToRoot()NavigationPops the card stack to the root card.
printJson()StringPrints the JSON representation of this object.
pushCard(card)NavigationPushes the given card onto the stack.
updateCard(card)NavigationDoes an in-place replacement of the current card.

Notification

Methods

MethodReturn typeBrief description
setText(text)NotificationSets the text to show in the notification.

OnClose

Properties

PropertyTypeDescription
NOTHINGEnumDo nothing on close.
RELOADEnumReloads the add-on on when the window closes.

OpenAs

Properties

PropertyTypeDescription
FULL_SIZEEnumOpen in a full window or tab.
OVERLAYEnumOpen as an overlay such as a pop-up.

Methods

MethodReturn typeBrief description
setOnClose(onClose)OpenLinkSets the behavior of the URL action when the URL window or tab is closed.
setOpenAs(openAs)OpenLinkSets the behavior of URL when it is opened.
setUrl(url)OpenLinkSets the URL to be opened.

PlatformDataSource

Methods

MethodReturn typeBrief description
setCommonDataSource(commonDataSource)PlatformDataSourceSets the data source from Google Workspace.
setHostAppDataSource(hostAppDataSource)PlatformDataSourceUsed to populate spaces in multiselect menu.

ResponseType

Properties

PropertyTypeDescription
TYPE_UNSPECIFIEDEnumDefault type that's handled as NEW_MESSAGE.
NEW_MESSAGEEnumPost as a new message in the topic.
UPDATE_MESSAGEEnumUpdate the Chat app's message.
UPDATE_USER_MESSAGE_CARDSEnumUpdate the cards on a user's message.
REQUEST_CONFIGEnumPrivately ask the user for additional authentication or configuration.
DIALOGEnumPresents a dialog.
UPDATE_WIDGETEnumWidget text autocomplete options query.

SelectionInput

Methods

MethodReturn typeBrief description
addItem(text, value, selected)SelectionInputAdds a new item that can be selected.
addMultiSelectItem(text, value, selected, startIconUri, bottomText)SelectionInputAdds a new item that can be selected, for multi-select menus.
setExternalDataSource(action)SelectionInputSets external data source, such as a relational data base.
setFieldName(fieldName)SelectionInputSets the key that identifies this selection input in the event object that is generated when there is a UI interaction.
setMultiSelectMaxSelectedItems(maxSelectedItems)SelectionInputSets the maximum number of items that a user can select.
setMultiSelectMinQueryLength(queryLength)SelectionInputSets the number of text characters that a user inputs before the app queries autocomplete and displays suggested items on the card.
setOnChangeAction(action)SelectionInputSets an Action to be performed whenever the selection input changes.
setPlatformDataSource(platformDataSource)SelectionInputSets a data source from Google Workspace.
setTitle(title)SelectionInputSets the title to be shown ahead of the input field.
setType(type)SelectionInputSets the type of this input.

SelectionInputType

Properties

PropertyTypeDescription
CHECK_BOXEnumCheckbox input style.
RADIO_BUTTONEnumRadio button input style.
DROPDOWNEnumDropdown menu selection input style.
SWITCHEnumA set of switches.
MULTI_SELECTEnumA multiselect menu for static or dynamic data.

Status

Properties

PropertyTypeDescription
OKEnumHTTP Mapping: 200 OK
CANCELLEDEnumHTTP Mapping: 499 Client Closed Request
UNKNOWNEnumUnknown error.
INVALID_ARGUMENTEnumThe client specified an invalid argument.
DEADLINE_EXCEEDEDEnumHTTP Mapping: 504 Gateway Timeout
NOT_FOUNDEnumHTTP Mapping: 404 Not Found
ALREADY_EXISTSEnumThe entity that a client attempted to create already exists.
PERMISSION_DENIEDEnumHTTP Mapping: 403 Forbidden
UNAUTHENTICATEDEnumHTTP Mapping: 401 Unauthorized
RESOURCE_EXHAUSTEDEnumHTTP Mapping: 429 Too Many Requests
FAILED_PRECONDITIONEnumThe operation was rejected because the system is not in a state required for the operation's execution.
ABORTEDEnumThe operation was aborted, typically due to a concurrency issue such as a sequencer check failure or transaction abort.
OUT_OF_RANGEEnumThe operation was attempted past the valid range.
UNIMPLEMENTEDEnumHTTP Mapping: 501 Not Implemented
INTERNALEnumInternal errors.
UNAVAILABLEEnumHTTP Mapping: 503 Service Unavailable
DATA_LOSSEnumUnrecoverable data loss or corruption.

Suggestions

Methods

MethodReturn typeBrief description
addSuggestion(suggestion)SuggestionsAdd a text suggestion.
addSuggestions(suggestions)SuggestionsAdd a list of text suggestions.

SuggestionsResponse

Methods

MethodReturn typeBrief description
printJson()StringPrints the JSON representation of this object.

SuggestionsResponseBuilder

Methods

MethodReturn typeBrief description
build()SuggestionsResponseBuilds the current suggestions response and validates it.
setSuggestions(suggestions)SuggestionsResponseBuilderSets the suggestions used in auto complete in text fields.

Switch

Methods

MethodReturn typeBrief description
setControlType(controlType)SwitchSets the control type of the switch.
setFieldName(fieldName)SwitchSets the key that identifies this switch in the event object that is generated when there is a UI interaction.
setOnChangeAction(action)SwitchSets the action to take when the switch is toggled.
setSelected(selected)SwitchSets whether this switch should start as selected or unselected.
setValue(value)SwitchSets the value that is sent as the form input when this switch is toggled on.

SwitchControlType

Properties

PropertyTypeDescription
SWITCHEnumToggle-styled control for a switch widget.
CHECK_BOXEnumCheckbox-styled control for a switch widget.

TextButton

Methods

MethodReturn typeBrief description
setAltText(altText)TextButtonSets the alternative text of the button for accessibility.
setAuthorizationAction(action)TextButtonSets an authorization action that opens a URL to the authorization flow when the object is clicked.
setBackgroundColor(backgroundColor)TextButtonSets the background color for TextButtonStyle.FILLED button.
setComposeAction(action, composedEmailType)TextButtonSets an action that composes a draft email when the object is clicked.
setDisabled(disabled)TextButtonSets whether the button is disabled.
setOnClickAction(action)TextButtonSets an action that executes when the object is clicked.
setOnClickOpenLinkAction(action)TextButtonSets an action that opens a URL in a tab when the object is clicked.
setOpenLink(openLink)TextButtonSets a URL to be opened when the object is clicked.
setText(text)TextButtonSets the text that displays on the button.
setTextButtonStyle(textButtonStyle)TextButtonSets the button style.

TextButtonStyle

Properties

PropertyTypeDescription
OUTLINEDEnumNormal text button with clear background.
FILLEDEnumText button with colored background.

TextInput

Methods

MethodReturn typeBrief description
setFieldName(fieldName)TextInputSets the key that identifies this text input in the event object that is generated when there is a UI interaction.
setHint(hint)TextInputSets a hint for the text input.
setMultiline(multiline)TextInputSets whether the input text shows on one line or multiple lines.
setOnChangeAction(action)TextInputSets an action to be performed whenever the text input changes.
setSuggestions(suggestions)TextInputSets the suggestions for autocompletion in the text field.
setSuggestionsAction(suggestionsAction)TextInputSets the callback action to fetch suggestions based on user input for autocompletion.
setTitle(title)TextInputSets the title to be shown above the input field.
setValue(value)TextInputSets the pre-filled value to be set in the input field.

TextParagraph

Methods

MethodReturn typeBrief description
setText(text)TextParagraphSets the text of the paragraph.

TimePicker

Methods

MethodReturn typeBrief description
setFieldName(fieldName)TimePickerSets the field name that identifies this picker in the event object that is generated when there is a UI interaction.
setHours(hours)TimePickerSets the prefilled hours value to set in the input field.
setMinutes(minutes)TimePickerSets the prefilled minutes value to set in the input field.
setOnChangeAction(action)TimePickerSets an Action that the script performs whenever the picker input changes.
setTitle(title)TimePickerSets the title displayed above the input field.

UniversalActionResponse

Methods

MethodReturn typeBrief description
printJson()StringPrints the JSON representation of this object.

UniversalActionResponseBuilder

Methods

MethodReturn typeBrief description
build()UniversalActionResponseBuilds the current universal action response and validates it.
displayAddOnCards(cardObjects)UniversalActionResponseBuilderDisplays the add-on with the specified cards.
setOpenLink(openLink)UniversalActionResponseBuilderSets the URL to open when the universal action is selected.

UpdateDraftActionResponse

Methods

MethodReturn typeBrief description
printJson()StringPrints the JSON representation of this object.

UpdateDraftActionResponseBuilder

Methods

MethodReturn typeBrief description
build()UpdateDraftActionResponseBuilds the current update draft action response and validates it.
setUpdateDraftBccRecipientsAction(updateDraftBccRecipientsAction)UpdateDraftActionResponseBuilderSets an action that updates the email Bcc recipients of a draft.
setUpdateDraftBodyAction(updateDraftBodyAction)UpdateDraftActionResponseBuilderSet an action that updates the email body of a draft.
setUpdateDraftCcRecipientsAction(updateDraftCcRecipientsAction)UpdateDraftActionResponseBuilderSets an action that updates the Cc recipients of a draft.
setUpdateDraftSubjectAction(updateDraftSubjectAction)UpdateDraftActionResponseBuilderSets an action that updates the subject line of a draft.
setUpdateDraftToRecipientsAction(updateDraftToRecipientsAction)UpdateDraftActionResponseBuilderSets an action that updates the To recipients of a draft.

UpdateDraftBccRecipientsAction

Methods

MethodReturn typeBrief description
addUpdateBccRecipients(bccRecipientEmails)UpdateDraftBccRecipientsActionUpdates the Bcc recipients of an email draft.

UpdateDraftBodyAction

Methods

MethodReturn typeBrief description
addUpdateContent(content, contentType)UpdateDraftBodyActionAdds the specified content to the draft body.
setUpdateType(updateType)UpdateDraftBodyActionSets the UpdateDraftBodyType of this update action on the draft body.

UpdateDraftBodyType

Properties

PropertyTypeDescription
IN_PLACE_INSERTEnumDefault.
INSERT_AT_STARTEnumUpdate actions insert content at the start of message body.
INSERT_AT_ENDEnumUpdate actions insert content at the end of the message body.

UpdateDraftCcRecipientsAction

Methods

MethodReturn typeBrief description
addUpdateCcRecipients(ccRecipientEmails)UpdateDraftCcRecipientsActionUpdates the Cc recipients of an email draft.

UpdateDraftSubjectAction

Methods

MethodReturn typeBrief description
addUpdateSubject(subject)UpdateDraftSubjectActionUpdates the subject line of an email draft.

UpdateDraftToRecipientsAction

Methods

MethodReturn typeBrief description
addUpdateToRecipients(toRecipientEmails)UpdateDraftToRecipientsActionUpdates the To recipients of an email draft.

UpdatedWidget

Methods

MethodReturn typeBrief description
addItem(text, value, selected, startIconUri, bottomText)UpdatedWidgetAdds a new item that can be selected.

VerticalAlignment

Properties

PropertyTypeDescription
CENTEREnumVertically places the content at the center of the container.
TOPEnumVertically places the content at the top of the container.
BOTTOMEnumVertically places the content at the bottom of the container.

Widget

WrapStyle

Properties

PropertyTypeDescription
NOWRAPEnumNo wrapping.
WRAPEnumWraps the content for any widgets in a column.