Class ActionResponseBuilder

ActionResponseBuilder

A builder for ActionResponse objects.

Available for Google Workspace add-ons.

const notification = AddOnsResponseService.newNotification().setText("You closed a dialog!");

const navigation = AddOnsResponseService.newNavigation()
    .setEndNavigation(AddOnsResponseService.EndNavigation.CLOSE_DIALOG);

const action = AddOnsResponseService.newActionResponseBuilder()
    .setNavigation(navigation)
    .setNotification(notification)
    .build();

Methods

MethodReturn typeBrief description
addModifyCard(modifyCard)ActionResponseBuilderSets the modify card operation to the action.
build()ActionResponseBuilds the current action response and validates it.
setLinkPreview(linkPreview)ActionResponseBuilderSets the LinkPreview to the action.
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.

Detailed documentation

addModifyCard(modifyCard)

Sets the modify card operation to the action.

Parameters

NameTypeDescription
modifyCardModifyCardThe ModifyCard to use.

Return

ActionResponseBuilder — This object, for chaining.


build()

Builds the current action response and validates it.

Return

ActionResponse — A validated ActionResponse.

Throws

Error — if the constructed action response isn't valid.


setLinkPreview(linkPreview)

Sets the LinkPreview to the action.

Parameters

NameTypeDescription
linkPreviewLinkPreviewThe LinkPreview to use.

Return

ActionResponseBuilder — This object, for chaining.


setNavigation(navigation)

Sets the response to a Navigation action.

const navigation = AddOnsResponseService.newNavigation()
    .setEndNavigation(AddOnsResponseService.EndNavigation.CLOSE_DIALOG);

const action = AddOnsResponseService.newActionResponseBuilder()
    .setNavigation(navigation)
    .build();

Parameters

NameTypeDescription
navigationNavigationThe Navigation to use.

Return

ActionResponseBuilder — This object, for chaining.


setNotification(notification)

Sets the notification to display when the action is activated.

const notification = AddOnsResponseService.newNotification().setText("You closed a dialog!");

const action = AddOnsResponseService.newActionResponseBuilder()
    .setNotification(notification)
    .build();

Parameters

NameTypeDescription
notificationNotificationThe Notification to use.

Return

ActionResponseBuilder — This object, for chaining.


Sets the URL to navigate to when the action is activated.

Parameters

NameTypeDescription
openLinkOpenLinkThe OpenLink to use.

Return

ActionResponseBuilder — This object, for chaining.


setStateChanged(stateChanged)

Sets a flag to indicate that this action changed the existing data state. For example, if the action created a task or updated contact information. When this flag is set to true, services such as Gmail can attempt to clear any cached state data associated with this action.

Parameters

NameTypeDescription
stateChangedBooleanWhether this action has changed the existing state data. Defaults to false.

Return

ActionResponseBuilder — This object, for chaining.