Class UpdateInlinePreviewAction

Cập nhậtHành độngxem trướcnội tuyến

Ứng dụng Chat xem trước một đường liên kết trong tin nhắn bằng cách thêm hoặc cập nhật một hoặc nhiều thẻ. Để biết thông tin chi tiết, hãy xem bài viết Xem trước đường liên kết trong tin nhắn trên Google Chat.

Dành cho các tiện ích bổ sung của Google Workspace mở rộng Google Chat.

const card = CardService.newCardBuilder()
    .setHeader(CardService.newCardHeader().setTitle("Unfurl Card!"))
    .addSection(CardService.newCardSection()
      .addWidget(CardService.newTextParagraph().setText("url"))
      .addWidget(CardService.newButtonSet()
        .addButton(CardService.newTextButton()
          .setText("Open URL!")
          .setOpenLink(CardService.newOpenLink().setUrl("https://www.google.com")))))
    .build();

const cardWithId = CardService.newCardWithId().setCardId("card_one").setCard(card);

const chatDataAction = AddOnsResponseService.newChatDataActionBuilder()
    .setUpdateInlinePreviewAction(AddOnsResponseService.newUpdateInlinePreviewAction()
    .addCardWithId(cardWithId)).build();

Phương thức

Phương thứcKiểu dữ liệu trả vềMô tả ngắn
addCardWithId(cardWithId)UpdateInlinePreviewActionThêm thẻ cho thao tác này.
addExpiration(ttl)UpdateInlinePreviewActionThêm ngày hết hạn cho hành động này.

Tài liệu chi tiết

addCardWithId(cardWithId)

Thêm thẻ cho thao tác này.

const card = CardService.newCardBuilder()
    .setHeader(CardService.newCardHeader().setTitle("Unfurl Card!"))
    .addSection(CardService.newCardSection()
      .addWidget(CardService.newTextParagraph().setText("url"))
      .addWidget(CardService.newButtonSet()
        .addButton(CardService.newTextButton()
          .setText("Open URL!")
          .setOpenLink(CardService.newOpenLink().setUrl("https://www.google.com")))))
    .build();

const cardWithId = CardService.newCardWithId().setCardId("card_one").setCard(card);

const chatDataAction = AddOnsResponseService.newChatDataActionBuilder()
    .setUpdateInlinePreviewAction(AddOnsResponseService.newUpdateInlinePreviewAction()
    .addCardWithId(cardWithId)).build();

Thông số

TênLoạiMô tả
cardWithIdCardWithIdThẻ cần thiết lập.

Cầu thủ trả bóng

UpdateInlinePreviewAction – Đối tượng này, để liên kết.


addExpiration(ttl)

Thêm ngày hết hạn cho hành động này.

Thông số

TênLoạiMô tả
ttlDurationThời hạn hết hạn cần đặt.

Cầu thủ trả bóng

UpdateInlinePreviewAction – Đối tượng này, để liên kết.