Class ChatActionResponse
-
ChatActionResponse is a class used by Google Chat apps to configure how their responses are posted.
-
This class is exclusively available for Google Chat apps and not for Google Workspace add-ons.
-
Key methods include setting a dialog action, the response type, an updated widget for autocomplete, or a URL for authentication or configuration.
-
Each method returns the ChatActionResponse object for method chaining.
A class that represents the parameters that a Chat app can use to configure how its response is posted.
Only available for Google Chat apps. Not available for Google Workspace add-ons.
const card = CardService.newCardBuilder() .setHeader(CardService.newCardHeader().setTitle('Card title')) .build(); const dialog = CardService.newDialog().setBody(card); const dialogAction = CardService.newDialogAction().setDialog(dialog); const chatActionResponse = CardService.newChatActionResponse() .setResponseType(CardService.Type.DIALOG) .setDialogAction(dialogAction);
Detailed documentation
setDialogAction(dialogAction)
Sets the dialog action to an event related to a dialog.
const card = CardService.newCardBuilder() .setHeader(CardService.newCardHeader().setTitle('Card title')) .build(); const dialog = CardService.newDialog().setBody(card); const dialogAction = CardService.newDialogAction().setDialog(dialog); const chatActionResponse = CardService.newChatActionResponse() .setResponseType(CardService.Type.DIALOG) .setDialogAction(dialogAction);
Parameters
| Name | Type | Description |
|---|---|---|
dialog | Dialog | The dialog action to set. |
Return
Chat — This object, for chaining.
setResponseType(responseType)
The type of Chat app response.
const chatActionResponse = CardService.newChatActionResponse().setResponseType( CardService.Type.DIALOG, );
Parameters
| Name | Type | Description |
|---|---|---|
response | Response | The response type. |
Return
Chat — This object, for chaining.
setUrl(url)
The URL for users to authenticate or configure. Only for the REQUEST_CONFIG response
type.
const chatActionResponse = CardService.newChatActionResponse() .setResponseType(CardService.Type.REQUEST_CONFIG) .setUrl('https://www.google.com');
Parameters
| Name | Type | Description |
|---|---|---|
url | String | The URL to send. |
Return
Chat — This object, for chaining.