이 가이드에서는
update()
Google Chat API의 Message
리소스에 대한 메서드로 텍스트 또는 카드를 업데이트합니다.
메시지가 표시됩니다. 메시지를 업데이트하여 메시지 속성(예:
또는 카드의 내용입니다. 카드 메시지에 텍스트 메시지를 추가하거나 텍스트 메시지에 카드를 추가할 수도 있습니다.
Chat API에서 Chat 메시지는
Message
리소스.
Chat 사용자는 텍스트가 포함된 메시지만 보낼 수 있지만 Chat 앱은 정적 또는 대화형 사용자 인터페이스 표시, 사용자로부터 정보 수집, 비공개 메시지 전송 등 다른 많은 메시지 기능을 사용할 수 있습니다. 메시지 기능 자세히 알아보기
Chat API에서 사용할 수 있는 기능에 대한 자세한 내용은
Google Chat 메시지 개요
기본 요건
Node.js
- Google Chat에 액세스할 수 있는 비즈니스 또는 엔터프라이즈 Google Workspace 계정
- 환경을 설정합니다.
<ph type="x-smartling-placeholder">
- </ph>
- Google Cloud 프로젝트를 만듭니다.
- OAuth 동의 화면 구성
- 채팅 앱의 이름, 아이콘, 설명을 사용하여 Google Chat API를 사용 설정하고 구성합니다.
- Node.js Cloud 클라이언트 라이브러리를 설치합니다.
- Google Chat API에서 인증하려는 방법에 따라 액세스 사용자 인증 정보를 만듭니다.
요청:
<ph type="x-smartling-placeholder">
- </ph>
- Chat 사용자로 인증하려면 다음 단계를 따르세요.
OAuth 클라이언트 ID 만들기
사용자 인증 정보를 만들고 사용자 인증 정보를
client_secrets.json
를 로컬 디렉터리로 복사합니다. - Chat 앱으로 인증하려면 서비스 계정 사용자 인증 정보를 만들고 사용자 인증 정보를
credentials.json
라는 JSON 파일로 저장합니다.
- Chat 사용자로 인증하려면 다음 단계를 따르세요.
OAuth 클라이언트 ID 만들기
사용자 인증 정보를 만들고 사용자 인증 정보를
- <ph type="x-smartling-placeholder"></ph> 사용자로 인증할 것인지, 아니면 다음으로 인증할 것인지에 따라 승인 범위를 선택합니다. 채팅 앱
Python
- Google Chat에 액세스할 수 있는 비즈니스 또는 엔터프라이즈 Google Workspace 계정
- 환경을 설정합니다.
- Google Cloud 프로젝트를 만듭니다.
- OAuth 동의 화면 구성
- Google Chat API를 사용 설정 및 구성합니다. 아이콘, 채팅 앱 설명이 있습니다.
- Python Cloud 클라이언트 라이브러리를 설치합니다.
- Google Chat API 요청에서 인증할 방법에 따라 액세스 사용자 인증 정보를 만듭니다.
- Chat 사용자로 인증하려면 OAuth 클라이언트 ID 사용자 인증 정보를 만들고 사용자 인증 정보를
client_secrets.json
라는 JSON 파일로 로컬 디렉터리에 저장합니다. - 채팅 앱으로 인증하려면 다음 단계를 따르세요.
서비스 계정 만들기
사용자 인증 정보를 만들고 사용자 인증 정보를
credentials.json
입니다.
- Chat 사용자로 인증하려면 OAuth 클라이언트 ID 사용자 인증 정보를 만들고 사용자 인증 정보를
- 사용자 또는 Chat 앱으로 인증할지 여부에 따라 승인 범위를 선택합니다.
자바
- Google Chat에 액세스할 수 있는 비즈니스 또는 엔터프라이즈 Google Workspace 계정
- 환경을 설정합니다.
<ph type="x-smartling-placeholder">
- </ph>
- Google Cloud 프로젝트를 만듭니다.
- OAuth 동의 화면 구성
- 채팅 앱의 이름, 아이콘, 설명을 사용하여 Google Chat API를 사용 설정하고 구성합니다.
- 설치 자바 Cloud 클라이언트 라이브러리를 참조하세요.
- Google Chat API에서 인증하려는 방법에 따라 액세스 사용자 인증 정보를 만듭니다.
요청:
<ph type="x-smartling-placeholder">
- </ph>
- Chat 사용자로 인증하려면 다음 단계를 따르세요.
OAuth 클라이언트 ID 만들기
사용자 인증 정보를 만들고 사용자 인증 정보를
client_secrets.json
를 로컬 디렉터리로 복사합니다. - Chat 앱으로 인증하려면 서비스 계정 사용자 인증 정보를 만들고 사용자 인증 정보를
credentials.json
라는 JSON 파일로 저장합니다.
- Chat 사용자로 인증하려면 다음 단계를 따르세요.
OAuth 클라이언트 ID 만들기
사용자 인증 정보를 만들고 사용자 인증 정보를
- <ph type="x-smartling-placeholder"></ph> 사용자로 인증할 것인지, 아니면 다음으로 인증할 것인지에 따라 승인 범위를 선택합니다. 채팅 앱
Apps Script
- 비즈니스 또는 기업 다음 액세스 권한이 있는 Google Workspace 계정 Google Chat
- 환경을 설정합니다.
- Google Cloud 프로젝트를 만듭니다.
- OAuth 동의 화면 구성
- Google Chat API를 사용 설정 및 구성합니다. 아이콘, 채팅 앱 설명이 있습니다.
- 독립형 Apps Script 프로젝트 만들기 그런 다음 고급 채팅 서비스를 사용 설정합니다.
- 이 가이드에서는 사용자 또는 앱 인증 중 하나를 사용해야 합니다. Chat 앱으로 인증하려면 서비스 계정 사용자 인증 정보를 만듭니다. 단계는 다음을 참조하세요. 서비스 계정 관리자로서 Google Chat 앱.
- <ph type="x-smartling-placeholder"></ph> 사용자로 인증할 것인지, 아니면 다음으로 인증할 것인지에 따라 승인 범위를 선택합니다. 채팅 앱
<ph type="x-smartling-placeholder">
사용자 대신 메일 업데이트
사용자 인증을 통해 메시지의 텍스트만 업데이트할 수 있습니다.
사용자 인증을 사용하여 메일을 업데이트하려면 다음을 요청:
chat.messages
승인 범위를 지정합니다.UpdateMessage()
메서드를 호출합니다.message
를Message
다음과 같이 바꿉니다. <ph type="x-smartling-placeholder">- </ph>
- 스페이스 ID를 포함하여 업데이트할 메시지로 설정된
name
필드 메시지 ID가 있습니다. - 새 텍스트로 설정된
text
필드
- 스페이스 ID를 포함하여 업데이트할 메시지로 설정된
updateMask
과 값text
를 전달합니다.
업데이트된 메시지가 카드 메시지인 경우 텍스트가 카드 앞에 추가되며 카드는 계속 표시됩니다.
사용자 인증을 사용하여 메시지를 업데이트하거나 카드 메시지에 텍스트 메시지를 추가하는 방법은 다음과 같습니다.
Node.js
Python
자바
Apps Script
이 샘플을 실행하려면 다음을 바꿉니다.
SPACE_NAME
: 스페이스의name
의 ID입니다.ListSpaces()
메서드를 호출하거나 스페이스의 URL에서 ID를 가져올 수 있습니다.MESSAGE_NAME
: 메시지의name
에 있는 ID입니다. Chat API를 사용하여 메시지를 비동기식으로 만들거나 만들 때 메시지에 할당된 맞춤 이름으로 메시지를 만든 후 반환된 응답 본문에서 ID를 가져올 수 있습니다.
Chat API는
Message
업데이트된 메시지를 표시합니다.
채팅 앱으로 메시지 업데이트하기
앱 인증을 사용하면 메시지의 텍스트와 카드를 모두 업데이트할 수 있습니다.
앱 인증으로 메시지를 업데이트하려면 요청에 다음을 전달합니다.
chat.bot
승인 범위를 지정합니다.UpdateMessage()
메서드를 호출합니다.- 다음과 같이
message
를Message
의 인스턴스로 전달합니다.- 스페이스 ID를 포함하여 업데이트할 메시지로 설정된
name
필드 메시지 ID가 있습니다. - 업데이트해야 하는 경우 새 텍스트로 설정된
text
필드입니다. - 업데이트가 필요한 경우 새 카드로 설정된
cardsV2
필드입니다.
- 스페이스 ID를 포함하여 업데이트할 메시지로 설정된
updateMask
를 필드 목록과 함께 업데이트에 전달합니다(예:text
).cardsV2
입니다.
업데이트된 메시지가 카드 메시지이고 텍스트가 업데이트되면 업데이트된 텍스트가 카드 앞에 추가되며 카드는 계속 표시됩니다. 업데이트된 메시지가 SMS 및 카드 업데이트되면 업데이트된 카드가 텍스트에 추가되며 합니다.
을 사용하여 메시지의 텍스트와 카드를 업데이트하는 방법은 다음과 같습니다. 앱 인증:
Node.js
Python
자바
Apps Script
이 샘플을 실행하려면 다음을 바꿉니다.
SPACE_NAME
: 스페이스의name
ID는ListSpaces()
메서드를 사용하거나 스페이스의 URL에서 가져올 수 있습니다.MESSAGE_NAME
: 메시지의name
에 있는 ID입니다. Chat API를 사용하여 메시지를 비동기식으로 만들거나 만들 때 메시지에 할당된 맞춤 이름으로 메시지를 만든 후 반환된 응답 본문에서 ID를 가져올 수 있습니다.
Chat API는 업데이트된 메시지에 관한 세부정보가 포함된 Message
의 인스턴스를 반환합니다.