이 가이드에서는 Google Chat API의 SpaceEvent 리소스에서 list() 메서드를 사용하여 스페이스의 리소스 변경사항을 나열하는 방법을 설명합니다.
SpaceEvent 리소스는 메시지, 반응, 멤버십과 같은 스페이스의 하위 리소스를 포함하여 타겟 스페이스의 변경사항을 나타냅니다. 지원되는 이벤트 유형 및 이벤트 페이로드 목록에 대한 자세한 내용은 SpaceEvent 리소스 참조 문서의 eventType 및 payload 필드를 참고하세요.
요청 시간 최대 28일 전의 이벤트를 나열할 수 있습니다. 서버는 영향을 받는 리소스의 최신 버전이 포함된 이벤트를 반환합니다.
예를 들어 새 스페이스 구성원에 관한 이벤트를 나열하면 서버는 최신 멤버십 세부정보가 포함된 Membership 리소스를 반환합니다. 요청된 기간 동안 새 회원이 삭제된 경우 이벤트 페이로드에는 빈 Membership 리소스가 포함됩니다.
이 메서드를 호출하려면 사용자 인증을 사용해야 합니다. 스페이스의 이벤트를 나열하려면 인증된 사용자가 스페이스의 구성원이어야 합니다.
import{createClientWithUserCredentials}from'./authentication-utils.js';// Authorization scopes based on the event typesconstUSER_AUTH_OAUTH_SCOPES=['https://www.googleapis.com/auth/chat.memberships.readonly','https://www.googleapis.com/auth/chat.messages.readonly',];// This sample shows how to list space events with user credentialasyncfunctionmain(){// Create a clientconstchatClient=awaitcreateClientWithUserCredentials(USER_AUTH_OAUTH_SCOPES,);// Initialize request argument(s)constrequest={// Replace SPACE_NAME hereparent:'spaces/SPACE_NAME',// A required filter. Filters events about new memberships and messagesfilter:'eventTypes:"google.workspace.chat.membership.v1.created" OR eventTypes:"google.workspace.chat.message.v1.created"',};// Make the requestconstpageResult=chatClient.listSpaceEventsAsync(request);// Handle the response. Iterating over pageResult will yield results and// resolve additional pages automatically.forawait(constresponseofpageResult){console.log(response);}}awaitmain();
이 샘플을 실행하려면 SPACE_NAME를 스페이스의 name에서 가져온 ID로 바꿉니다.
ListSpaces() 메서드를 호출하거나 스페이스의 URL에서 ID를 가져올 수 있습니다.
[[["이해하기 쉬움","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\u003elist()\u003c/code\u003e method to list changes to resources in a Google Chat space using the \u003ccode\u003eSpaceEvent\u003c/code\u003e resource.\u003c/p\u003e\n"],["\u003cp\u003eYou can list events up to 28 days prior, retrieving the most recent version of affected resources, and must authenticate with user credentials and be a space member.\u003c/p\u003e\n"],["\u003cp\u003eTo call this method, specify authorization scopes for desired event types and use the \u003ccode\u003eListSpaceEvents()\u003c/code\u003e method with a filter to specify event types and date ranges.\u003c/p\u003e\n"],["\u003cp\u003eThe provided Node.js code sample demonstrates listing events for new memberships and messages within a space, requiring replacement of \u003ccode\u003eSPACE_NAME\u003c/code\u003e with the space's ID.\u003c/p\u003e\n"]]],["This guide details how to use the `list()` method on the `SpaceEvent` resource within the Google Chat API to track changes in a space, such as new memberships and messages. To use, authenticate as a space member and specify the desired event types using the `filter` parameter when calling `ListSpaceEvents()`. The method returns the latest resource versions, up to 28 days prior, with the ability to filter by date. An example is provided showing how to filter events about new memberships and messages.\n"],null,[]]