Class AccessoryWidget

AccessoryWidget

A builder for Chat AccessoryWidget objects. Accessory widgets are interactive widgets that appear at the bottom of a message.

Available for Google Workspace add-ons that extend Google Chat.

const widget = CardService.newButtonSet()
    .addButton(CardService.newImageButton()
      .setIcon(CardService.Icon.PHONE)
      .setOnClickAction(CardService.newAction()
        .setFunctionName("phone")))
    .addButton(CardService.newTextButton()
      .setText("Robot")
      .setIconUrl("https://developers.google.com/chat/images/quickstart-app-avatar.png")
      .setOnClickAction(CardService.newAction()
        .setFunctionName("robot")));

const accessoryWidget = AddOnsResponseService.newAccessoryWidget()
    .addWidget(widget);

Methods

MethodReturn typeBrief description
addWidget(widget)AccessoryWidgetSets the widget for this action.

Detailed documentation

addWidget(widget)

Sets the widget for this action.

Parameters

NameTypeDescription
widgetWidgetThe widget to set.

Return

AccessoryWidget — This object, for chaining.