Class ChatResponse
ChatResponse
Google Chat 中卡片訊息的回應物件。
僅適用於 Google Chat 應用程式。不適用於 Google Workspace 外掛程式。
// Creates a card message in Chat.
const cardHeader = CardService.newCardHeader()
.setTitle('Card Header Title')
.setSubtitle('Card Header Subtitle');
const card = CardService.newCardBuilder().setHeader(cardHeader).build();
const chatResponse =
CardService.newChatResponseBuilder()
.setText('Example text')
.addCardsV2(
CardService.newCardWithId().setCardId('card_id').setCard(card))
.build();
console.log(chatResponse.printJson());
內容詳盡的說明文件
printJson()
列印此物件的 JSON 表示法。這項設定僅供偵錯。
回攻員
String
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-01-30 (世界標準時間)。
[null,null,["上次更新時間:2025-01-30 (世界標準時間)。"],[[["`ChatResponse` is an object used for card messages specifically within Google Chat apps, not add-ons."],["It facilitates building responses containing text and cards with customizable headers and content using methods like `addCardsV2()`."],["Developers can utilize the `printJson()` method to debug and view the JSON structure of the constructed response for verification."]]],["The `ChatResponse` object, exclusive to Google Chat apps, facilitates the creation of card messages. It is not for Google Workspace add-ons. You can build card messages using methods like `newCardHeader()` and `newCardBuilder()`. `newChatResponseBuilder()` builds the ChatResponse by adding text and cards. `printJson()` outputs the JSON representation of the constructed `ChatResponse` object, for debugging purposes.\n"]]