import{createClientWithUserCredentials}from'./authentication-utils.js';constUSER_AUTH_OAUTH_SCOPES=['https://www.googleapis.com/auth/chat.messages.reactions.create'];// This sample shows how to create reaction to a message with user credentialasyncfunctionmain(){// Create a clientconstchatClient=awaitcreateClientWithUserCredentials(USER_AUTH_OAUTH_SCOPES);// Initialize request argument(s)constrequest={// Replace SPACE_NAME and MESSAGE_NAME here.parent:'spaces/SPACE_NAME/messages/MESSAGE_NAME',reaction:{// A standard emoji represented by a unicode string.emoji:{unicode:'😀'}}};// Make the requestconstresponse=awaitchatClient.createReaction(request);// Handle the responseconsole.log(response);}main().catch(console.error);
이 샘플을 실행하려면 다음을 바꿉니다.
SPACE_NAME: 스페이스의 name의 ID입니다.
ListSpaces() 메서드를 호출하거나 스페이스의 URL에서 ID를 가져올 수 있습니다.
MESSAGE_NAME: 메시지의 name에 있는 ID입니다.
Chat API를 사용하여 메시지를 비동기식으로 만들거나 만들 때 메시지에 할당된 맞춤 이름으로 메시지를 만든 후 반환된 응답 본문에서 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"]],["최종 업데이트: 2024-12-21(UTC)"],[[["This guide demonstrates how to add emoji reactions (👍, 🚲, 🌞) to Google Chat messages using the `create()` method of the Google Chat API."],["It requires a Google Workspace account, a configured Google Cloud project with the Chat API enabled, and the Node.js Cloud Client Library."],["To add a reaction, call the `CreateReaction()` method, providing the message's resource name and the desired emoji's unicode representation."],["A sample Node.js code snippet is included, illustrating the process of creating a reaction using user credentials."],["You need to replace placeholders for space and message names within the code with your specific values to execute the sample successfully."]]],[]]