import{createClientWithUserCredentials}from'./authentication-utils.js';constUSER_AUTH_OAUTH_SCOPES=['https://www.googleapis.com/auth/chat.messages.reactions'];// This sample shows how to delete a reaction to a message with user credentialasyncfunctionmain(){// Create a clientconstchatClient=awaitcreateClientWithUserCredentials(USER_AUTH_OAUTH_SCOPES);// Initialize request argument(s)constrequest={// Replace SPACE_NAME, MESSAGE_NAME, and REACTION_NAME herename:'spaces/SPACE_NAME/messages/MESSAGE_NAME/reactions/REACTION_NAME'};// Make the requestconstresponse=awaitchatClient.deleteReaction(request);// Handle the responseconsole.log(response);}main().catch(console.error);
이 샘플을 실행하려면 다음을 바꿉니다.
SPACE_NAME: 스페이스의 name의 ID입니다.
ListSpaces() 메서드를 호출하거나 스페이스의 URL에서 ID를 가져올 수 있습니다.
MESSAGE_NAME: 메시지의 name에 있는 ID입니다.
Chat API를 사용하여 메시지를 비동기식으로 만들거나 만들 때 메시지에 할당된 맞춤 이름으로 메시지를 만든 후 반환된 응답 본문에서 ID를 가져올 수 있습니다.
REACTION_NAME: 리액션의 name에 있는 ID입니다.
ListReactions() 메서드를 호출하거나 Chat API로 비동기식으로 리액션을 만든 후 반환된 응답 본문에서 ID를 가져올 수 있습니다.
[null,null,["최종 업데이트: 2025-02-14(UTC)"],[[["This guide explains how to delete reactions (emojis like 👍, 🚲, 🌞) from Google Chat messages using the `delete()` method."],["Deleting a reaction does not delete the original message itself."],["You'll need a Google Workspace account and Node.js to use the Google Chat API for deleting reactions."],["The guide provides a code sample and instructions to set up your environment and authenticate for using the API."],["To successfully delete a reaction, you need to provide the specific name of the reaction resource in your API request."]]],["This guide details deleting reactions from Google Chat messages using the `delete()` method on the `Reaction` resource. Key steps include setting up a Google Workspace account, enabling the Google Chat API, and installing the Node.js Cloud Client Library. To delete a reaction, specify the `chat.messages.reactions` or `chat.messages` scope, and call `DeleteReaction()`, providing the reaction's `name`. The guide includes a Node.js code sample that demonstrates the deletion, requiring the space, message, and reaction IDs. A successful deletion results in an empty response.\n"]]