Class DialogAction
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
DialogAction
ตัวสร้างสำหรับออบเจ็กต์ DialogAction
ใช้ได้กับแอป Google Chat เท่านั้น ไม่พร้อมใช้งานสำหรับส่วนเสริมของ 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);
เอกสารประกอบโดยละเอียด
setActionStatus(actionStatus)
ตั้งค่าสถานะการดําเนินการของ DialogAction
const actionStatus = CardService.newActionStatus().setStatusCode(
CardService.Status.OK,
);
const dialogAction =
CardService.newDialogAction().setActionStatus(actionStatus);
พารามิเตอร์
รีเทิร์น
DialogAction
— ออบเจ็กต์นี้สําหรับการต่อเชื่อม
setDialog(dialog)
ตั้งค่ากล่องโต้ตอบของ DialogAction
const card = CardService.newCardBuilder()
.setHeader(CardService.newCardHeader().setTitle('card title'))
.build();
// Sets the card of the dialog.
const dialog = CardService.newDialog().setBody(card);
const dialogAction = CardService.newDialogAction().setDialog(dialog);
พารามิเตอร์
รีเทิร์น
DialogAction
— ออบเจ็กต์นี้สําหรับการต่อเชื่อม
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 2025-07-26 UTC"],[[["\u003cp\u003e\u003ccode\u003eDialogAction\u003c/code\u003e is a builder for creating interactive dialogs within Google Chat apps.\u003c/p\u003e\n"],["\u003cp\u003eIt allows developers to set the content of the dialog and control its behavior using methods like \u003ccode\u003esetDialog\u003c/code\u003e and \u003ccode\u003esetActionStatus\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThis functionality is exclusive to Google Chat apps and is not available for Google Workspace Add-ons.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eDialogAction\u003c/code\u003e uses chaining, meaning methods can be called sequentially to configure the dialog.\u003c/p\u003e\n"]]],["This content describes how to build `DialogAction` objects for Google Chat apps. Key actions involve using `CardService` to create a `DialogAction`, setting its content, and specifying its status. The `setDialog(dialog)` method sets the content of the `DialogAction` using a `Dialog` object, which itself can contain a `Card`. The `setActionStatus(actionStatus)` method sets the action's status using an `ActionStatus` object. Both methods allow chaining.\n"],null,["# Class DialogAction\n\nDialogAction\n\nA builder for [DialogAction](#) 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();\nconst dialog = CardService.newDialog().setBody(card);\n\nconst dialogAction = CardService.newDialogAction().setDialog(dialog);\n``` \n\n### Methods\n\n| Method | Return type | Brief description |\n|-----------------------------------------------------------------|-------------------|---------------------------------------------|\n| [setActionStatus(actionStatus)](#setActionStatus(ActionStatus)) | [DialogAction](#) | Sets the action status of `Dialog``Action`. |\n| [setDialog(dialog)](#setDialog(Dialog)) | [DialogAction](#) | Sets the dialog of the `Dialog``Action`. |\n\nDetailed documentation\n----------------------\n\n### `set``Action``Status(actionStatus)`\n\nSets the action status of `Dialog``Action`.\n\n```javascript\nconst actionStatus = CardService.newActionStatus().setStatusCode(\n CardService.Status.OK,\n);\n\nconst dialogAction =\n CardService.newDialogAction().setActionStatus(actionStatus);\n```\n\n#### Parameters\n\n| Name | Type | Description |\n|------------------|-------------------------------------------------------------------|-------------------------------------------------------------------------------|\n| `action``Status` | [ActionStatus](/apps-script/reference/card-service/action-status) | The [ActionStatus](/apps-script/reference/card-service/action-status) to use. |\n\n#### Return\n\n\n[DialogAction](#) --- This object, for chaining.\n\n*** ** * ** ***\n\n### `set``Dialog(dialog)`\n\nSets the dialog of the `Dialog``Action`.\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\nconst dialogAction = CardService.newDialogAction().setDialog(dialog);\n```\n\n#### Parameters\n\n| Name | Type | Description |\n|----------|------------------------------------------------------|------------------------------------------------------------------|\n| `dialog` | [Dialog](/apps-script/reference/card-service/dialog) | The [Dialog](/apps-script/reference/card-service/dialog) to use. |\n\n#### Return\n\n\n[DialogAction](#) --- This object, for chaining."]]