Reference documentation and code samples for the Google Apps Chat V1 Client class Action.
An action that describes the behavior when the form is submitted.
For example, you can invoke an Apps Script script to handle the form.
If the action is triggered, the form values are sent to the server.
Google Workspace Add-ons and Chat
apps:
Generated from protobuf message google.apps.card.v1.Action
Namespace
Google \ Apps \ Card \ V1
Methods
__construct
Constructor.
Parameters
Name
Description
data
array
Optional. Data for populating the Message object.
↳ function
string
A custom function to invoke when the containing element is clicked or othrwise activated. For example usage, see Read form data.
Specifies the loading indicator that the action displays while making the call to the action.
↳ persist_values
bool
Indicates whether form values persist after the action. The default value is false. If true, form values remain after the action is triggered. To let the user make changes while the action is being processed, set LoadIndicator to NONE. For card messages in Chat apps, you must also set the action's ResponseType to UPDATE_MESSAGE and use the same card_id from the card that contained the action. If false, the form values are cleared when the action is triggered. To prevent the user from making changes while the action is being processed, set LoadIndicator to SPINNER.
↳ interaction
int
Optional. Required when opening a dialog. What to do in response to an interaction with a user, such as a user clicking a button in a card message. If unspecified, the app responds by executing an action—like opening a link or running a function—as normal. By specifying an interaction, the app can respond in special interactive ways. For example, by setting interaction to OPEN_DIALOG, the app can open a dialog. When specified, a loading indicator isn't shown. If specified for an add-on, the entire card is stripped and nothing is shown in the client. Google Chat apps:
getFunction
A custom function to invoke when the containing element is
clicked or othrwise activated.
Specifies the loading indicator that the action displays while
making the call to the action.
Returns
Type
Description
int
setLoadIndicator
Specifies the loading indicator that the action displays while
making the call to the action.
Parameter
Name
Description
var
int
Returns
Type
Description
$this
getPersistValues
Indicates whether form values persist after the action. The default value
is false.
If true, form values remain after the action is triggered. To let the
user make changes while the action is being processed, set
LoadIndicator
to NONE. For card
messages
in Chat apps, you must also set the action's
ResponseType
to UPDATE_MESSAGE and use the same
card_id
from the card that contained the action.
If false, the form values are cleared when the action is triggered.
To prevent the user from making changes while the action is being
processed, set
LoadIndicator
to SPINNER.
Returns
Type
Description
bool
setPersistValues
Indicates whether form values persist after the action. The default value
is false.
If true, form values remain after the action is triggered. To let the
user make changes while the action is being processed, set
LoadIndicator
to NONE. For card
messages
in Chat apps, you must also set the action's
ResponseType
to UPDATE_MESSAGE and use the same
card_id
from the card that contained the action.
If false, the form values are cleared when the action is triggered.
To prevent the user from making changes while the action is being
processed, set
LoadIndicator
to SPINNER.
What to do in response to an interaction with a user, such as a user
clicking a button in a card message.
If unspecified, the app responds by executing an action—like opening a
link or running a function—as normal.
By specifying an interaction, the app can respond in special interactive
ways. For example, by setting interaction to OPEN_DIALOG, the app can
open a dialog. When
specified, a loading indicator isn't shown. If specified for
an add-on, the entire card is stripped and nothing is shown in the client.
Google Chat apps:
What to do in response to an interaction with a user, such as a user
clicking a button in a card message.
If unspecified, the app responds by executing an action—like opening a
link or running a function—as normal.
By specifying an interaction, the app can respond in special interactive
ways. For example, by setting interaction to OPEN_DIALOG, the app can
open a dialog. When
specified, a loading indicator isn't shown. If specified for
an add-on, the entire card is stripped and nothing is shown in the client.
Google Chat apps:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Google Apps Chat V1 Client - Class Action (0.12.0)\n\nVersion latestkeyboard_arrow_down\n\n- [0.12.0 (latest)](/php/docs/reference/apps-chat/latest/Card.V1.Action)\n- [0.11.2](/php/docs/reference/apps-chat/0.11.2/Card.V1.Action)\n- [0.10.0](/php/docs/reference/apps-chat/0.10.0/Card.V1.Action)\n- [0.9.0](/php/docs/reference/apps-chat/0.9.0/Card.V1.Action)\n- [0.8.1](/php/docs/reference/apps-chat/0.8.1/Card.V1.Action)\n- [0.7.2](/php/docs/reference/apps-chat/0.7.2/Card.V1.Action)\n- [0.6.1](/php/docs/reference/apps-chat/0.6.1/Card.V1.Action)\n- [0.5.0](/php/docs/reference/apps-chat/0.5.0/Card.V1.Action)\n- [0.4.0](/php/docs/reference/apps-chat/0.4.0/Card.V1.Action)\n- [0.3.0](/php/docs/reference/apps-chat/0.3.0/Card.V1.Action)\n- [0.2.0](/php/docs/reference/apps-chat/0.2.0/Card.V1.Action)\n- [0.1.4](/php/docs/reference/apps-chat/0.1.4/Card.V1.Action) \nReference documentation and code samples for the Google Apps Chat V1 Client class Action.\n\nAn action that describes the behavior when the form is submitted.\n\nFor example, you can invoke an Apps Script script to handle the form.\nIf the action is triggered, the form values are sent to the server.\n[Google Workspace Add-ons and Chat\napps](https://developers.google.com/workspace/extend):\n\nGenerated from protobuf message `google.apps.card.v1.Action`\n\nNamespace\n---------\n\nGoogle \\\\ Apps \\\\ Card \\\\ V1\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getFunction\n\nA custom function to invoke when the containing element is\nclicked or othrwise activated.\n\nFor example usage, see [Read form\ndata](https://developers.google.com/workspace/chat/read-form-data).\n\n### setFunction\n\nA custom function to invoke when the containing element is\nclicked or othrwise activated.\n\nFor example usage, see [Read form\ndata](https://developers.google.com/workspace/chat/read-form-data).\n\n### getParameters\n\nList of action parameters.\n\n### setParameters\n\nList of action parameters.\n\n### getLoadIndicator\n\nSpecifies the loading indicator that the action displays while\nmaking the call to the action.\n\n### setLoadIndicator\n\nSpecifies the loading indicator that the action displays while\nmaking the call to the action.\n\n### getPersistValues\n\nIndicates whether form values persist after the action. The default value\nis `false`.\n\nIf `true`, form values remain after the action is triggered. To let the\nuser make changes while the action is being processed, set\n[`LoadIndicator`](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator)\nto `NONE`. For [card\nmessages](https://developers.google.com/workspace/chat/api/guides/v1/messages/create#create)\nin Chat apps, you must also set the action's\n[`ResponseType`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages#responsetype)\nto `UPDATE_MESSAGE` and use the same\n[`card_id`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages#CardWithId)\nfrom the card that contained the action.\nIf `false`, the form values are cleared when the action is triggered.\nTo prevent the user from making changes while the action is being\nprocessed, set\n[`LoadIndicator`](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator)\nto `SPINNER`.\n\n### setPersistValues\n\nIndicates whether form values persist after the action. The default value\nis `false`.\n\nIf `true`, form values remain after the action is triggered. To let the\nuser make changes while the action is being processed, set\n[`LoadIndicator`](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator)\nto `NONE`. For [card\nmessages](https://developers.google.com/workspace/chat/api/guides/v1/messages/create#create)\nin Chat apps, you must also set the action's\n[`ResponseType`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages#responsetype)\nto `UPDATE_MESSAGE` and use the same\n[`card_id`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages#CardWithId)\nfrom the card that contained the action.\nIf `false`, the form values are cleared when the action is triggered.\nTo prevent the user from making changes while the action is being\nprocessed, set\n[`LoadIndicator`](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator)\nto `SPINNER`.\n\n### getInteraction\n\nOptional. Required when opening a\n[dialog](https://developers.google.com/workspace/chat/dialogs).\n\nWhat to do in response to an interaction with a user, such as a user\nclicking a button in a card message.\nIf unspecified, the app responds by executing an `action`---like opening a\nlink or running a function---as normal.\nBy specifying an `interaction`, the app can respond in special interactive\nways. For example, by setting `interaction` to `OPEN_DIALOG`, the app can\nopen a [dialog](https://developers.google.com/workspace/chat/dialogs). When\nspecified, a loading indicator isn't shown. If specified for\nan add-on, the entire card is stripped and nothing is shown in the client.\n[Google Chat apps](https://developers.google.com/workspace/chat):\n\n### setInteraction\n\nOptional. Required when opening a\n[dialog](https://developers.google.com/workspace/chat/dialogs).\n\nWhat to do in response to an interaction with a user, such as a user\nclicking a button in a card message.\nIf unspecified, the app responds by executing an `action`---like opening a\nlink or running a function---as normal.\nBy specifying an `interaction`, the app can respond in special interactive\nways. For example, by setting `interaction` to `OPEN_DIALOG`, the app can\nopen a [dialog](https://developers.google.com/workspace/chat/dialogs). When\nspecified, a loading indicator isn't shown. If specified for\nan add-on, the entire card is stripped and nothing is shown in the client.\n[Google Chat apps](https://developers.google.com/workspace/chat):"]]