Class HostAppDataSource

  • HostAppDataSource is used for populating selection items in a multiselect menu within a Google Chat app.

  • It leverages a data source from Google Chat, configured using ChatClientDataSource and ChatSpaceDataSource.

  • This functionality is exclusive to Google Chat apps and is not available for Google Workspace Add-ons.

  • The key method is setChatDataSource(), used for setting the Google Chat data source.

HostAppDataSource

For a SelectionInput widget that uses a multiselect menu, a data source from a Google Workspace application. The data source populates selection items for the multiselect menu.

const chatSpaceDataSource =
    CardService.newChatSpaceDataSource().setDefaultToCurrentSpace(true);

const chatClientDataSource =
    CardService.newChatClientDataSource().setSpaceDataSource(
        chatSpaceDataSource);

const hostAppDataSource =
    CardService.newHostAppDataSource().setChatDataSource(chatClientDataSource);

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

Methods

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

Detailed documentation

setChatDataSource(chatClientDataSource)

Sets the data source from Google Chat.

const chatSpaceDataSource =
    CardService.newChatSpaceDataSource().setDefaultToCurrentSpace(true);

const chatClientDataSource =
    CardService.newChatClientDataSource().setSpaceDataSource(
        chatSpaceDataSource);

const hostAppDataSource =
    CardService.newHostAppDataSource().setChatDataSource(chatClientDataSource);
Only available for Google Chat apps. Not available for Google Workspace add-ons.

Parameters

NameTypeDescription
chatClientDataSourceChatClientDataSourceThe data source to be set.

Return

HostAppDataSource — This object, for chaining.