Class ChatActionResponse

ChatActionResponse

Một lớp biểu thị các tham số mà ứng dụng Chat có thể dùng để định cấu hình cách đăng phản hồi.

Chỉ dành cho các ứng dụng Google Chat. Không sử dụng được với tiện ích bổ sung của Google Workspace.

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);

Phương thức

Phương thứcKiểu dữ liệu trả vềMô tả ngắn
setDialogAction(dialogAction)ChatActionResponseĐặt thao tác của hộp thoại thành một sự kiện liên quan đến hộp thoại.
setResponseType(responseType)ChatActionResponseLoại phản hồi của ứng dụng Chat.
setUpdatedWidget(updatedWidget)ChatActionResponseĐặt tiện ích đã cập nhật được dùng để cung cấp các tuỳ chọn tự động hoàn thành cho tiện ích.
setUrl(url)ChatActionResponseURL để người dùng xác thực hoặc định cấu hình.

Tài liệu chi tiết

setDialogAction(dialogAction)

Đặt thao tác của hộp thoại thành một sự kiện liên quan đến hộp thoại.

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);

Tham số

TênLoạiNội dung mô tả
dialogActionDialogActionThao tác cần thiết lập trong hộp thoại.

Cầu thủ trả bóng

ChatActionResponse – Đối tượng này để tạo chuỗi.


setResponseType(responseType)

Loại phản hồi của ứng dụng Chat.

const chatActionResponse = CardService.newChatActionResponse()
   .setResponseType(CardService.Type.DIALOG)

Tham số

TênLoạiNội dung mô tả
responseTypeResponseTypeLoại phản hồi.

Cầu thủ trả bóng

ChatActionResponse – Đối tượng này để tạo chuỗi.


setUpdatedWidget(updatedWidget)

Đặt tiện ích đã cập nhật được dùng để cung cấp các tuỳ chọn tự động hoàn thành cho tiện ích.

const updatedWidget = CardService.newUpdatedWidget()
    .addItem("Contact 1", "contact-1", false,
       "https://www.gstatic.com/images/branding/product/2x/contacts_48dp.png",
       "Contact one description")
    .addItem("Contact 2", "contact-2", false,
       "https://www.gstatic.com/images/branding/product/2x/contacts_48dp.png",
       "Contact two description")
    .addItem("Contact 3", "contact-3", false,
       "https://www.gstatic.com/images/branding/product/2x/contacts_48dp.png",
       "Contact three description")
    .addItem("Contact 4", "contact-4", false,
       "https://www.gstatic.com/images/branding/product/2x/contacts_48dp.png",
       "Contact four description")
    .addItem("Contact 5", "contact-5", false,
       "https://www.gstatic.com/images/branding/product/2x/contacts_48dp.png",
       "Contact five description");

const actionResponse = CardService.newChatActionResponse()
    .setUpdatedWidget(updatedWidget)
    .setResponseType(CardService.ResponseType.UPDATE_WIDGET);
Chỉ có trong các ứng dụng Google Chat. Không sử dụng được với tiện ích bổ sung của Google Workspace.

Tham số

TênLoạiNội dung mô tả
updatedWidgetUpdatedWidgetTiện ích đã cập nhật sẽ được đặt.

Cầu thủ trả bóng

ChatActionResponse – Đối tượng này để tạo chuỗi.


setUrl(url)

URL để người dùng xác thực hoặc định cấu hình. Chỉ dành cho loại phản hồi REQUEST_CONFIG.

const chatActionResponse = CardService.newChatActionResponse()
   .setResponseType(CardService.Type.REQUEST_CONFIG)
   .setUrl('https://www.google.com');

Tham số

TênLoạiNội dung mô tả
urlStringURL cần gửi.

Cầu thủ trả bóng

ChatActionResponse – Đối tượng này để tạo chuỗi.