이 가이드에서는 Google Chat API의 ThreadReadState 리소스에서 get() 메서드를 사용하여 메시지 스레드 내 사용자의 읽기 상태에 관한 세부정보를 가져오는 방법을 설명합니다. 스페이스의 메시지 읽기 상태를 가져오려면 사용자의 스페이스 읽기 상태에 관한 세부정보 가져오기를 참고하세요.
ThreadReadState 리소스는 Google Chat 메시지 대화목록에서 지정된 사용자의 마지막으로 읽은 메시지에 관한 세부정보를 나타내는 싱글톤 리소스입니다.
메시지 스레드 내에서 사용자의 읽기 상태에 관한 세부정보를 가져오려면 요청에 다음을 포함하세요.
chat.users.readstate 또는 chat.users.readstate.readonly 승인 범위를 지정합니다.
GetThreadReadState() 메서드를 호출하여 스레드 읽기 상태의 name를 전달합니다. 여기에는 사용자 ID 또는 별칭과 스페이스 ID가 포함됩니다. 스레드 읽기 상태 가져오기는 호출 사용자의 읽기 상태 가져오기만 지원하며, 이는 다음 중 하나를 설정하여 지정할 수 있습니다.
me 별칭입니다. 예를 들면 users/me/spaces/SPACE/threads/THREAD/threadReadState입니다.
호출하는 사용자의 Workspace 이메일 주소입니다. 예를 들면 다음과 같습니다.
users/user@example.com/spaces/SPACE/threads/THREAD/threadReadState
호출 사용자의 사용자 ID입니다. 예를 들면 다음과 같습니다.
users/USER/spaces/SPACE/threads/THREAD/threadReadState
import{createClientWithUserCredentials}from'./authentication-utils.js';constUSER_AUTH_OAUTH_SCOPES=['https://www.googleapis.com/auth/chat.users.readstate.readonly',];// This sample shows how to get the thread read state for a space and calling userasyncfunctionmain(){// Create a clientconstchatClient=awaitcreateClientWithUserCredentials(USER_AUTH_OAUTH_SCOPES,);// Initialize request argument(s)constrequest={// Replace SPACE_NAME and THREAD_NAME herename:'users/me/spaces/SPACE_NAME/threads/THREAD_NAME/threadReadState',};// Make the requestconstresponse=awaitchatClient.getThreadReadState(request);// Handle the responseconsole.log(response);}awaitmain();
이 샘플을 실행하려면 다음을 바꾸세요.
SPACE_NAME: 스페이스의 name에서 가져온 ID입니다.
ListSpaces() 메서드를 호출하거나 스페이스의 URL에서 ID를 가져올 수 있습니다.
THREAD_NAME: 스레드의 name에서 가져온 ID입니다.
Chat API를 사용하여 비동기식으로 메시지를 만든 후 반환되는 응답 본문에서 ID를 가져오거나, 생성 시 메시지에 할당된 맞춤 이름을 사용하여 ID를 가져올 수 있습니다.
Google Chat API는 지정된 스레드 읽기 상태를 가져와 ThreadReadState 인스턴스를 반환합니다.
[[["이해하기 쉬움","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-09-12(UTC)"],[[["\u003cp\u003eThis guide explains how to use the \u003ccode\u003eget()\u003c/code\u003e method to retrieve a user's read state within a Google Chat message thread using the Google Chat API.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eThreadReadState\u003c/code\u003e resource provides details about a user's last read message in a thread.\u003c/p\u003e\n"],["\u003cp\u003eTo get the thread read state, you need a Google Workspace account, a configured Google Cloud project with the Google Chat API enabled, and the Node.js Cloud Client Library installed.\u003c/p\u003e\n"],["\u003cp\u003eYou must use the \u003ccode\u003echat.users.readstate\u003c/code\u003e or \u003ccode\u003echat.users.readstate.readonly\u003c/code\u003e authorization scope and call the \u003ccode\u003eGetThreadReadState()\u003c/code\u003e method, specifying the thread read state's name.\u003c/p\u003e\n"],["\u003cp\u003eThe API returns a \u003ccode\u003eThreadReadState\u003c/code\u003e instance containing the user's read state information.\u003c/p\u003e\n"]]],["This guide details retrieving a user's read state within a Google Chat message thread using the `get()` method on the `ThreadReadState` resource. Key actions involve setting up a Google Cloud project, enabling the Chat API, and obtaining OAuth credentials. The process requires specifying either the `chat.users.readstate` or `chat.users.readstate.readonly` authorization scope, then calling `GetThreadReadState()` with the thread read state's `name`, including a user ID/alias and space ID. The method returns a `ThreadReadState` instance.\n"],null,[]]