Google Chat 메시지 개요
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
이 페이지에서는 텍스트 메시지와 카드 메시지의 차이점을 설명합니다.
Chat 앱에서 기본 정보를 전달하기 위해 문자 메시지를 보내면 Google Chat 사용자가 메시지를 작성하는 방식과 마찬가지로 메시지가 인라인으로 표시됩니다. 텍스트 이상의 콘텐츠가 포함된 메시지를 만들거나 사용자가 상호작용할 수 있는 메시지를 만들려면 Chat 앱에서 카드를 사용할 수 있습니다.
채팅 앱은 카드와 함께 문자 메시지를 추가할 수도 있습니다. 사용자에게 양식 작성과 같은 다단계 프로세스를 완료하라는 메시지를 표시하기 위해 Chat 앱은 새 창에서 대화상자로 열리는 카드를 만들 수도 있습니다.
문자 메시지의 구조
Google Chat API에서 메시지는 JSON 객체로 표현됩니다. 메시지 내에서 텍스트 메시지는 text
객체로 표현됩니다.
다음 예에서 채팅 앱은 코드 동결이 다가오는 소프트웨어 개발자 팀의 스페이스에 텍스트 메시지를 만듭니다.
{
"text": "Attention <users/all>: Code freeze starts at `11:59 am` Pacific Standard Time! If you need a little more time, type `/moreTime` and I'll push the code freeze back one hour."
}
JSON은 다음 메시지를 반환합니다.
카드 메시지의 구조
Google Chat API에서 메시지는 JSON 객체로 표현됩니다. 메시지 내에서 카드는 cardsV2
배열로 표시되며 다음으로 구성됩니다.
- 하나 이상의
CardWithId
객체
- 카드를 식별하는 데 사용되며 지정된 메시지 내에서 범위가 지정된
cardId
입니다.
(메시지가 다른 카드에는 동일한 ID가 있을 수 있습니다.)
다음으로 구성된 card
객체
- 제목, 부제목, 아바타 스타일 이미지와 같은 항목을 지정하는
header
객체
- 각각 하나 이상의 위젯을 포함하는 하나 이상의
section
객체
- 하나 이상의
widget
객체
각 위젯은 텍스트, 이미지, 버튼, 기타 객체 유형을 나타낼 수 있는 복합 객체입니다.
예를 들어 다음 카드 메시지에는 header
, section
, widget
객체가 포함되어 있습니다.
다음 코드는 카드 메시지의 JSON을 나타냅니다.
JSON
{
"cardsV2": [
{
"cardId": "unique-card-id",
"card": {
"header": {
"title": "Sasha",
"subtitle": "Software Engineer",
"imageUrl": "https://developers.google.com/chat/images/quickstart-app-avatar.png",
"imageType": "CIRCLE",
"imageAltText": "Avatar for Sasha"
},
"sections": [
{
"header": "Contact Info",
"collapsible": true,
"uncollapsibleWidgetsCount": 1,
"widgets": [
{
"decoratedText": {
"startIcon": {
"knownIcon": "EMAIL"
},
"text": "sasha@example.com"
}
},
{
"decoratedText": {
"startIcon": {
"knownIcon": "PERSON"
},
"text": "<font color=\"#80e27e\">Online</font>"
}
},
{
"decoratedText": {
"startIcon": {
"knownIcon": "PHONE"
},
"text": "+1 (555) 555-1234"
}
},
{
"buttonList": {
"buttons": [
{
"text": "Share",
"onClick": {
"openLink": {
"url": "https://example.com/share"
}
}
},
{
"text": "Edit",
"onClick": {
"action": {
"function": "goToView",
"parameters": [
{
"key": "viewType",
"value": "EDIT"
}
]
}
}
}
]
}
}
]
}
]
}
}
]
}
카드 빌더를 사용하여 Chat 앱의 메시지 및 사용자 인터페이스를 디자인하고 미리 봅니다.
카드 빌더 열기
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-08-04(UTC)
[null,null,["최종 업데이트: 2025-08-04(UTC)"],[[["\u003cp\u003eGoogle Chat apps use text messages for basic information and cards for interactive elements or richer content.\u003c/p\u003e\n"],["\u003cp\u003eText messages appear inline within the chat, similar to regular user messages.\u003c/p\u003e\n"],["\u003cp\u003eCards provide a structured format to include images, buttons, and other interactive widgets within a message.\u003c/p\u003e\n"],["\u003cp\u003eCard messages are represented as JSON objects using the \u003ccode\u003ecardsV2\u003c/code\u003e field in the Google Chat API.\u003c/p\u003e\n"],["\u003cp\u003eThe Card Builder tool can be used to design and preview cards for Chat apps.\u003c/p\u003e\n"]]],["Chat apps use text messages for basic information, represented as JSON `text` objects. For richer content and user interaction, they use card messages. Card messages, represented by `cardsV2` JSON arrays, include a `cardId` and a `card` object. The `card` contains a `header`, `section`, and `widget` objects, enabling elements like titles, text, images, and buttons. Cards can also open as dialogs for multi-step processes, or be appended to a text message.\n"],null,["# Google Chat messages overview\n\nThis page explains the differences between text and card messages.\n\nWhen Chat apps send text messages to convey basic information,\nthe messages appear inline, just like how people in Google Chat write\nmessages. To create messages that contain more than text, or to create\nmessages that users can interact with, Chat apps can use\n[cards](/workspace/chat/create-messages#create).\nChat apps can also append a text message with a card. To\nprompt users to finish multi-step processes such as completing a form,\nChat apps can also create cards that open in a new window as\n[dialogs](/workspace/chat/dialogs).\n\nAnatomy of a text message\n-------------------------\n\nIn the Google Chat API, messages are represented as JSON objects. Within a message,\na text message is represented as a\n[`text`](/workspace/chat/api/reference/rest/v1/spaces.messages#Message.FIELDS.text)\nobject.\n\nIn the following\nexample, a Chat app creates a text message in a space\nfor a team of software developers that a code freeze is approaching: \n\n {\n \"text\": \"Attention \u003cusers/all\u003e: Code freeze starts at `11:59 am` Pacific Standard Time! If you need a little more time, type `/moreTime` and I'll push the code freeze back one hour.\"\n }\n\nThe JSON returns the following message:\n\nAnatomy of a card message\n-------------------------\n\nIn the Google Chat API, messages are represented as JSON objects. Within a message\na card is represented as a\n[`cardsV2`](/workspace/chat/api/reference/rest/v1/spaces.messages#Message.FIELDS.cards_v2)\narray and consists of the following:\n\n- One or more [`CardWithId` objects](/workspace/chat/api/reference/rest/v1/spaces.messages#CardWithId).\n- A `cardId`, used to identify the card and scoped within a given message. (Cards in different messages can have the same ID.)\n- A `card` object, which consists of the following:\n\n - A [`header` object](/workspace/chat/api/reference/rest/v1/cards#CardHeader_1) that specifies things like a title, subtitle, and avatar-style image.\n - One or more [`section` objects](/workspace/chat/api/reference/rest/v1/cards#section) that each contain at least one widget.\n - One or more [`widget` objects](/workspace/chat/api/reference/rest/v1/cards#Widget). Each widget is a composite object that can represent text, images, buttons, and other object types.\n\nAs an example, the following card message contains\n[`header`](/workspace/chat/api/reference/rest/v1/cards#CardHeader_1),\n[`section`](/workspace/chat/api/reference/rest/v1/cards#section), and\n[`widget`](/workspace/chat/api/reference/rest/v1/cards#Widget) objects:\n\nThe following code represents the JSON of the card message: \n\n### JSON\n\n {\n \"cardsV2\": [\n {\n \"cardId\": \"unique-card-id\",\n \"card\": {\n \"header\": {\n \"title\": \"Sasha\",\n \"subtitle\": \"Software Engineer\",\n \"imageUrl\": \"https://developers.google.com/chat/images/quickstart-app-avatar.png\",\n \"imageType\": \"CIRCLE\",\n \"imageAltText\": \"Avatar for Sasha\"\n },\n \"sections\": [\n {\n \"header\": \"Contact Info\",\n \"collapsible\": true,\n \"uncollapsibleWidgetsCount\": 1,\n \"widgets\": [\n {\n \"decoratedText\": {\n \"startIcon\": {\n \"knownIcon\": \"EMAIL\"\n },\n \"text\": \"sasha@example.com\"\n }\n },\n {\n \"decoratedText\": {\n \"startIcon\": {\n \"knownIcon\": \"PERSON\"\n },\n \"text\": \"\u003cfont color=\\\"#80e27e\\\"\u003eOnline\u003c/font\u003e\"\n }\n },\n {\n \"decoratedText\": {\n \"startIcon\": {\n \"knownIcon\": \"PHONE\"\n },\n \"text\": \"+1 (555) 555-1234\"\n }\n },\n {\n \"buttonList\": {\n \"buttons\": [\n {\n \"text\": \"Share\",\n \"onClick\": {\n \"openLink\": {\n \"url\": \"https://example.com/share\"\n }\n }\n },\n {\n \"text\": \"Edit\",\n \"onClick\": {\n \"action\": {\n \"function\": \"goToView\",\n \"parameters\": [\n {\n \"key\": \"viewType\",\n \"value\": \"EDIT\"\n }\n ]\n }\n }\n }\n ]\n }\n }\n ]\n }\n ]\n }\n }\n ]\n }\n\n\n*** ** * ** ***\n\nUse the Card Builder to design and preview messaging and user interfaces for Chat apps:\n[Open the Card Builder](https://addons.gsuite.google.com/uikit/builder)\n\n*** ** * ** ***\n\n\u003cbr /\u003e\n\nRelated topics\n--------------\n\n- [Send a message](/workspace/chat/create-messages)\n- [Format messages](/workspace/chat/format-messages)"]]