Class ChatActionResponse
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
پاسخ اقدام چت کلاسی که پارامترهایی را نشان می دهد که یک برنامه چت می تواند برای پیکربندی نحوه ارسال پاسخ خود استفاده کند.
فقط برای برنامههای گپ Google در دسترس است. برای افزونه های 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);
مستندات دقیق
set Dialog Action(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);
پارامترها
نام | تایپ کنید | توضیحات |
---|
dialog Action | Dialog Action | عمل گفتگو برای تنظیم. |
بازگشت
Chat Action Response
- این شیء، برای زنجیر کردن.
set Response Type(responseType)
نوع پاسخ برنامه چت.
const chatActionResponse = CardService.newChatActionResponse().setResponseType(
CardService.Type.DIALOG,
);
پارامترها
بازگشت
Chat Action Response
- این شیء، برای زنجیر کردن.
set Url(url)
URL برای احراز هویت یا پیکربندی کاربران. فقط برای نوع پاسخ REQUEST_CONFIG
.
const chatActionResponse = CardService.newChatActionResponse()
.setResponseType(CardService.Type.REQUEST_CONFIG)
.setUrl('https://www.google.com');
پارامترها
نام | تایپ کنید | توضیحات |
---|
url | String | URL برای ارسال. |
بازگشت
Chat Action Response
- این شیء، برای زنجیر کردن.
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-07-25 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-25 بهوقت ساعت هماهنگ جهانی."],[[["\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."]]