Class CardWithId
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
CardWithId
CardWithId
객체의 빌더입니다. 이 클래스는 여러 카드를 보낼 때 메일의 카드 고유 식별자입니다.
Google Chat 앱에서만 사용할 수 있습니다. Google Workspace 부가기능에는 사용할 수 없습니다.
const cardSection = CardService.newCardSection();
cardSection.addWidget(
CardService.newTextParagraph().setText('This is a text paragraph widget.'),
);
const card = CardService.newCardBuilder()
.setHeader(CardService.newCardHeader().setTitle('Card title'))
.addSection(cardSection)
.build();
const cardWithId =
CardService.newCardWithId().setCardId('card_id').setCard(card);
자세한 문서
setCard(card)
cardWithId
의 카드를 설정합니다.
const cardHeader = CardService.newCardHeader()
.setTitle('Card Header Title')
.setSubtitle('Card Header Subtitle');
const card = CardService.newCardBuilder().setHeader(cardHeader).build();
const cardWithId = CardService.newCardWithId().setCard(card);
매개변수
리턴
CardWithId
: 연결을 위한 객체입니다.
setCardId(id)
cardWithId
의 고유 카드 ID를 설정합니다.
const cardWithId = CardService.newCardWithId();
// Sets the card ID of the cardWithId.
cardWithId.setCardId('card_id');
매개변수
이름 | 유형 | 설명 |
id | String | 사용할 텍스트입니다. |
리턴
CardWithId
: 연결을 위한 객체입니다.
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-07-26(UTC)
[null,null,["최종 업데이트: 2025-07-26(UTC)"],[[["\u003cp\u003e\u003ccode\u003eCardWithId\u003c/code\u003e is a builder for creating cards with unique identifiers, specifically for use in Google Chat apps.\u003c/p\u003e\n"],["\u003cp\u003eIt allows developers to set a card's content using \u003ccode\u003esetCard()\u003c/code\u003e and assign a unique ID using \u003ccode\u003esetCardId()\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThis functionality is crucial when sending multiple cards within a single message, enabling individual card identification and management.\u003c/p\u003e\n"],["\u003cp\u003eThis feature is not available for Google Workspace Add-ons.\u003c/p\u003e\n"]]],["`CardWithId` objects are unique identifiers for cards in messages, specifically for Google Chat apps. They are built using `CardService.newCardWithId()`. The core actions involve using `setCard(card)` to assign a `Card` object to the `CardWithId`, and `setCardId(id)` to assign a unique string identifier to the `CardWithId`. Both `setCard` and `setCardId` are chainable methods and are only available for Google Chat apps.\n"],null,["# Class CardWithId\n\nCardWithId\n\nA builder for [CardWithId](#) objects. This class is a unique identifier for a card in a\nmessage when sending multiple cards.\n\nOnly available for Google Chat apps. Not available for Google Workspace add-ons.\n\n```javascript\nconst cardSection = CardService.newCardSection();\ncardSection.addWidget(\n CardService.newTextParagraph().setText('This is a text paragraph widget.'),\n);\n\nconst card = CardService.newCardBuilder()\n .setHeader(CardService.newCardHeader().setTitle('Card title'))\n .addSection(cardSection)\n .build();\n\nconst cardWithId =\n CardService.newCardWithId().setCardId('card_id').setCard(card);\n``` \n\n### Methods\n\n| Method | Return type | Brief description |\n|-------------------------------------|-----------------|--------------------------------------------------|\n| [setCard(card)](#setCard(Card)) | [CardWithId](#) | Sets the card of the `card``With``Id`. |\n| [setCardId(id)](#setCardId(String)) | [CardWithId](#) | Sets the unique card ID of the `card``With``Id`. |\n\nDetailed documentation\n----------------------\n\n### `set``Card(card)`\n\nSets the card of the `card``With``Id`.\n\n```javascript\nconst cardHeader = CardService.newCardHeader()\n .setTitle('Card Header Title')\n .setSubtitle('Card Header Subtitle');\n\nconst card = CardService.newCardBuilder().setHeader(cardHeader).build();\n\nconst cardWithId = CardService.newCardWithId().setCard(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[CardWithId](#) --- This object, for chaining.\n\n*** ** * ** ***\n\n### `set``Card``Id(id)`\n\nSets the unique card ID of the `card``With``Id`.\n\n```javascript\nconst cardWithId = CardService.newCardWithId();\n\n// Sets the card ID of the cardWithId.\ncardWithId.setCardId('card_id');\n```\n\n#### Parameters\n\n| Name | Type | Description |\n|------|----------|------------------|\n| `id` | `String` | The text to use. |\n\n#### Return\n\n\n[CardWithId](#) --- This object, for chaining."]]