ویجت به روز شده را تنظیم می کند که برای ارائه گزینه های تکمیل خودکار برای ویجت استفاده می شود.
constupdatedWidget=CardService.newUpdatedWidget().addItem('Contact 1','contact-1',false,'https://www.gstatic.com/images/branding/product/2x/contacts_48dp.png','Contact one description',).addItem('Contact 2','contact-2',false,'https://www.gstatic.com/images/branding/product/2x/contacts_48dp.png','Contact two description',).addItem('Contact 3','contact-3',false,'https://www.gstatic.com/images/branding/product/2x/contacts_48dp.png','Contact three description',).addItem('Contact 4','contact-4',false,'https://www.gstatic.com/images/branding/product/2x/contacts_48dp.png','Contact four description',).addItem('Contact 5','contact-5',false,'https://www.gstatic.com/images/branding/product/2x/contacts_48dp.png','Contact five description',);constactionResponse=CardService.newChatActionResponse().setUpdatedWidget(updatedWidget).setResponseType(CardService.ResponseType.UPDATE_WIDGET);
فقط برای برنامههای گپ Google در دسترس است. برای افزونه های Google Workspace در دسترس نیست.
تاریخ آخرین بهروزرسانی 2025-07-25 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","easyToUnderstand","thumb-up"],["مشکلم را برطرف کرد","solvedMyProblem","thumb-up"],["غیره","otherUp","thumb-up"]],[["اطلاعاتی که نیاز دارم وجود ندارد","missingTheInformationINeed","thumb-down"],["بیشازحد پیچیده/ مراحل بسیار زیاد","tooComplicatedTooManySteps","thumb-down"],["قدیمی","outOfDate","thumb-down"],["مشکل ترجمه","translationIssue","thumb-down"],["مشکل کد / نمونهها","samplesCodeIssue","thumb-down"],["غیره","otherDown","thumb-down"]],["تاریخ آخرین بهروزرسانی 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,["ChatActionResponse\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\nMethods\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`set``Dialog``Action(dialogAction)` \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\nParameters\n\n| Name | Type | Description |\n|------------------|-------------------------------------------------------------------|---------------------------|\n| `dialog``Action` | [DialogAction](/apps-script/reference/card-service/dialog-action) | The dialog action to set. |\n\nReturn\n\n\n[ChatActionResponse](#) --- This object, for chaining.\n\n*** ** * ** ***\n\n`set``Response``Type(responseType)` \nThe type of Chat app response.\n\n```javascript\nconst chatActionResponse = CardService.newChatActionResponse().setResponseType(\n CardService.Type.DIALOG,\n);\n```\n\nParameters\n\n| Name | Type | Description |\n|------------------|-------------------------------------------------------------------|--------------------|\n| `response``Type` | [ResponseType](/apps-script/reference/card-service/response-type) | The response type. |\n\nReturn\n\n\n[ChatActionResponse](#) --- This object, for chaining.\n\n*** ** * ** ***\n\n`set``Updated``Widget(updatedWidget)` \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\nParameters\n\n| Name | Type | Description |\n|-------------------|---------------------------------------------------------------------|-------------------------------|\n| `updated``Widget` | [UpdatedWidget](/apps-script/reference/card-service/updated-widget) | The updated widget to be set. |\n\nReturn\n\n\n[ChatActionResponse](#) --- This object, for chaining.\n\n*** ** * ** ***\n\n`set``Url(url)` \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\nParameters\n\n| Name | Type | Description |\n|-------|----------|------------------|\n| `url` | `String` | The URL to send. |\n\nReturn\n\n\n[ChatActionResponse](#) --- This object, for chaining."]]