Class ChatActionResponse
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
צ'אטפעולהתגובה
סיווג שמייצג את הפרמטרים שבהם אפליקציית צ'אט יכולה להשתמש כדי לקבוע איך התשובה שלה תפורסם.
האפשרות הזו זמינה רק לאפליקציות של 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);
const chatActionResponse = CardService.newChatActionResponse()
.setResponseType(CardService.Type.DIALOG)
.setDialogAction(dialogAction);
מסמכים מפורטים
setDialogAction(dialogAction)
הגדרת פעולת תיבת הדו-שיח לאירוע שקשור לתיבת דו-שיח.
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);
פרמטרים
שם | סוג | תיאור |
dialogAction | DialogAction | הפעולה בתיבת הדו-שיח שרוצים להגדיר. |
חזרה
ChatActionResponse
– האובייקט הזה, לצורך קישור.
setResponseType(responseType)
סוג התגובה באפליקציית Chat.
const chatActionResponse = CardService.newChatActionResponse().setResponseType(
CardService.Type.DIALOG,
);
פרמטרים
חזרה
ChatActionResponse
– האובייקט הזה, לצורך קישור.
setUrl(url)
כתובת ה-URL שבה המשתמשים יכולים לבצע אימות או הגדרה. רק לסוג התגובה REQUEST_CONFIG
.
const chatActionResponse = CardService.newChatActionResponse()
.setResponseType(CardService.Type.REQUEST_CONFIG)
.setUrl('https://www.google.com');
פרמטרים
שם | סוג | תיאור |
url | String | כתובת ה-URL שרוצים לשלוח. |
חזרה
ChatActionResponse
– האובייקט הזה, לצורך קישור.
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-26 (שעון UTC).
[null,null,["עדכון אחרון: 2025-07-26 (שעון UTC)."],[[["\u003cp\u003e\u003ccode\u003eChatActionResponse\u003c/code\u003e allows Google Chat apps to configure how their responses are displayed, including dialogs, widgets, and URLs.\u003c/p\u003e\n"],["\u003cp\u003eThis class provides methods like \u003ccode\u003esetDialogAction\u003c/code\u003e, \u003ccode\u003esetResponseType\u003c/code\u003e, \u003ccode\u003esetUpdatedWidget\u003c/code\u003e, and \u003ccode\u003esetUrl\u003c/code\u003e to customize the response behavior.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eChatActionResponse\u003c/code\u003e is exclusively for Google Chat apps and is not supported in Google Workspace Add-ons.\u003c/p\u003e\n"],["\u003cp\u003eEach method within \u003ccode\u003eChatActionResponse\u003c/code\u003e returns the object itself, enabling method chaining for streamlined configuration.\u003c/p\u003e\n"]]],["The `ChatActionResponse` class configures how a Chat app's response is posted, specifically for Google Chat apps. Key actions include setting the response type, which can be a dialog, updating a widget, or requesting configuration. The `setDialogAction` method links an event to a dialog. `setUpdatedWidget` provides autocomplete options, while `setUrl` directs users to a specific URL, mainly for authentication or configuration requests. Each method returns a `ChatActionResponse` object, enabling method chaining.\n"],null,["# Class ChatActionResponse\n\nChatActionResponse\n\nA class that represents the parameters that a Chat app can use to configure how its response is\nposted.\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\nconst chatActionResponse = CardService.newChatActionResponse()\n .setResponseType(CardService.Type.DIALOG)\n .setDialogAction(dialogAction);\n``` \n\n### Methods\n\n| Method | Return type | Brief description |\n|---------------------------------------------------------------------|-------------------------|-----------------------------------------------------------------------------|\n| [setDialogAction(dialogAction)](#setDialogAction(DialogAction)) | [ChatActionResponse](#) | Sets the dialog action to an event related to a dialog. |\n| [setResponseType(responseType)](#setResponseType(ResponseType)) | [ChatActionResponse](#) | The type of Chat app response. |\n| [setUpdatedWidget(updatedWidget)](#setUpdatedWidget(UpdatedWidget)) | [ChatActionResponse](#) | Sets the updated widget, used to provide autocomplete options for a widget. |\n| [setUrl(url)](#setUrl(String)) | [ChatActionResponse](#) | The URL for users to authenticate or configure. |\n\nDetailed documentation\n----------------------\n\n### `set``Dialog``Action(dialogAction)`\n\nSets the dialog action to an event related to a dialog.\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\nconst chatActionResponse = CardService.newChatActionResponse()\n .setResponseType(CardService.Type.DIALOG)\n .setDialogAction(dialogAction);\n```\n\n#### Parameters\n\n| Name | Type | Description |\n|------------------|-------------------------------------------------------------------|---------------------------|\n| `dialog``Action` | [DialogAction](/apps-script/reference/card-service/dialog-action) | The dialog action to set. |\n\n#### Return\n\n\n[ChatActionResponse](#) --- This object, for chaining.\n\n*** ** * ** ***\n\n### `set``Response``Type(responseType)`\n\nThe type of Chat app response.\n\n```javascript\nconst chatActionResponse = CardService.newChatActionResponse().setResponseType(\n CardService.Type.DIALOG,\n);\n```\n\n#### Parameters\n\n| Name | Type | Description |\n|------------------|-------------------------------------------------------------------|--------------------|\n| `response``Type` | [ResponseType](/apps-script/reference/card-service/response-type) | The response type. |\n\n#### Return\n\n\n[ChatActionResponse](#) --- This object, for chaining.\n\n*** ** * ** ***\n\n### `set``Updated``Widget(updatedWidget)`\n\nSets the updated widget, used to provide autocomplete options for a widget.\n\n```javascript\nconst updatedWidget =\n CardService.newUpdatedWidget()\n .addItem(\n 'Contact 1',\n 'contact-1',\n false,\n 'https://www.gstatic.com/images/branding/product/2x/contacts_48dp.png',\n 'Contact one description',\n )\n .addItem(\n 'Contact 2',\n 'contact-2',\n false,\n 'https://www.gstatic.com/images/branding/product/2x/contacts_48dp.png',\n 'Contact two description',\n )\n .addItem(\n 'Contact 3',\n 'contact-3',\n false,\n 'https://www.gstatic.com/images/branding/product/2x/contacts_48dp.png',\n 'Contact three description',\n )\n .addItem(\n 'Contact 4',\n 'contact-4',\n false,\n 'https://www.gstatic.com/images/branding/product/2x/contacts_48dp.png',\n 'Contact four description',\n )\n .addItem(\n 'Contact 5',\n 'contact-5',\n false,\n 'https://www.gstatic.com/images/branding/product/2x/contacts_48dp.png',\n 'Contact five description',\n );\n\nconst actionResponse =\n CardService.newChatActionResponse()\n .setUpdatedWidget(updatedWidget)\n .setResponseType(CardService.ResponseType.UPDATE_WIDGET);\n```\nOnly available for Google Chat apps. Not available for Google Workspace add-ons.\n\n#### Parameters\n\n| Name | Type | Description |\n|-------------------|---------------------------------------------------------------------|-------------------------------|\n| `updated``Widget` | [UpdatedWidget](/apps-script/reference/card-service/updated-widget) | The updated widget to be set. |\n\n#### Return\n\n\n[ChatActionResponse](#) --- This object, for chaining.\n\n*** ** * ** ***\n\n### `set``Url(url)`\n\nThe URL for users to authenticate or configure. Only for the `REQUEST_CONFIG` response\ntype.\n\n```javascript\nconst chatActionResponse = CardService.newChatActionResponse()\n .setResponseType(CardService.Type.REQUEST_CONFIG)\n .setUrl('https://www.google.com');\n```\n\n#### Parameters\n\n| Name | Type | Description |\n|-------|----------|------------------|\n| `url` | `String` | The URL to send. |\n\n#### Return\n\n\n[ChatActionResponse](#) --- This object, for chaining."]]