요청 시간으로부터 최대 28일 전에 이벤트를 요청할 수 있습니다. 이벤트에는 변경된 리소스의 최신 버전이 포함됩니다. 예를 들어 새 메시지에 관한 이벤트를 요청했지만 나중에 메시지가 업데이트된 경우 서버는 이벤트 페이로드에서 업데이트된 Message 리소스를 반환합니다.
이 메서드를 호출하려면 사용자 인증을 사용해야 합니다. 이벤트를 가져오려면 인증된 사용자가 이벤트가 발생한 스페이스의 회원이어야 합니다.
import{createClientWithUserCredentials}from'./authentication-utils.js';// Replace SCOPE_NAME here with an authorization scope based on the event typeconstUSER_AUTH_OAUTH_SCOPES=['SCOPE_NAME'];// This sample shows how to get space event with user credentialasyncfunctionmain(){// Create a clientconstchatClient=awaitcreateClientWithUserCredentials(USER_AUTH_OAUTH_SCOPES);// Initialize request argument(s)constrequest={// Replace SPACE_NAME and SPACE_EVENT_NAME herename:'spaces/SPACE_NAME/spaceEvents/SPACE_EVENT_NAME'};// Make the requestconstresponse=awaitchatClient.getSpaceEvent(request);// Handle the responseconsole.log(response);}main().catch(console.error);
이 샘플을 실행하려면 다음을 바꿉니다.
SCOPE_NAME: 이벤트 유형에 따른 승인 범위입니다. 예를 들어 새 멤버십에 관한 스페이스 이벤트를 가져오는 경우 형식이 https://www.googleapis.com/auth/chat.memberships.readonly인 chat.memberships.readonly 범위를 사용합니다.
ListSpaceEvents() 메서드에서 이벤트 유형을 가져올 수 있습니다. 이 메서드를 사용하는 방법을 알아보려면 스페이스의 이벤트 나열을 참고하세요.
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-02-14(UTC)"],[[["This guide explains how to retrieve details about specific events within a Google Chat space using the `get()` method of the Google Chat API."],["The `SpaceEvent` resource tracks changes in a space, and this guide details how to access information about these events."],["To use this functionality, you need a Google Workspace account, appropriate authorization, and a configured Google Cloud project."],["You must provide the correct authorization scope, space name, and space event name to successfully retrieve the event details."],["The API returns a `SpaceEvent` object containing comprehensive information about the requested event."]]],["The guide details how to retrieve space event information using the `get()` method on the Google Chat API's `SpaceEvent` resource. This method requires user authentication, and the user must be a space member. To use `get()`, provide an authorization scope and the event's name within a request. The API returns the latest `SpaceEvent` data, up to 28 days old, reflecting any changes to the space or its resources. It requires Node.js, a Google Workspace account, and proper API configuration.\n"]]