Class Dialog
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
對話詳情請參閱 Google Chat 說明文件中的「開啟互動式對話方塊」。
Dialog
物件的建構工具。
僅適用於 Google Chat 應用程式。不適用於 Google Workspace 外掛程式。
const card = CardService.newCardBuilder()
.setHeader(CardService.newCardHeader().setTitle('Card title'))
.build();
// Sets the card of the dialog.
const dialog = CardService.newDialog().setBody(card);
內容詳盡的說明文件
setBody(card)
設定 Dialog
的卡片。
const card = CardService.newCardBuilder()
.setHeader(CardService.newCardHeader().setTitle('Card title'))
.build();
// Sets the card of the dialog.
const dialog = CardService.newDialog().setBody(card);
參數
回攻員
Dialog
:這個物件用於鏈結。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[null,null,["上次更新時間:2025-07-26 (世界標準時間)。"],[[["\u003cp\u003e\u003ccode\u003eDialog\u003c/code\u003e helps you create interactive dialogs within Google Chat apps for displaying information or gathering input.\u003c/p\u003e\n"],["\u003cp\u003eIt's exclusively for Google Chat apps and not available for Google Workspace Add-ons.\u003c/p\u003e\n"],["\u003cp\u003eThe core functionality involves setting a card, built using \u003ccode\u003eCardService\u003c/code\u003e, as the body of the dialog to present content to the user.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003esetBody()\u003c/code\u003e method is key to setting the card within the dialog and supports chaining for further configurations.\u003c/p\u003e\n"]]],[],null,["# Class Dialog\n\nDialog\n\nFor details, see [Open interactive\ndialogs](https://developers.google.com/chat/how-tos/dialogs) in the Google Chat documentation.\n\nA builder for [Dialog](#) objects.\n\nOnly available for Google Chat apps. Not available for Google Workspace add-ons.\n\n```javascript\nconst card = CardService.newCardBuilder()\n .setHeader(CardService.newCardHeader().setTitle('Card title'))\n .build();\n\n// Sets the card of the dialog.\nconst dialog = CardService.newDialog().setBody(card);\n``` \n\n### Methods\n\n| Method | Return type | Brief description |\n|---------------------------------|-------------|--------------------------------|\n| [setBody(card)](#setBody(Card)) | [Dialog](#) | Sets the card of the `Dialog`. |\n\nDetailed documentation\n----------------------\n\n### `set``Body(card)`\n\nSets the card of the `Dialog`.\n\n```javascript\nconst card = CardService.newCardBuilder()\n .setHeader(CardService.newCardHeader().setTitle('Card title'))\n .build();\n\n// Sets the card of the dialog.\nconst dialog = CardService.newDialog().setBody(card);\n```\n\n#### Parameters\n\n| Name | Type | Description |\n|--------|--------------------------------------------------|--------------------------------------------------------------|\n| `card` | [Card](/apps-script/reference/card-service/card) | The [Card](/apps-script/reference/card-service/card) to use. |\n\n#### Return\n\n\n[Dialog](#) --- This object, for chaining."]]