Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Ten przewodnik wyjaśnia, jak używać metody
delete()
w zasobie Reaction interfejsu Google Chat API do usuwania reakcji z wiadomości, takich jak 👍, 🚲 i 🌞. Usunięcie reakcji nie powoduje usunięcia wiadomości.
ReactionZasób
reprezentuje emotikon, którego użytkownicy mogą używać do reagowania na wiadomości, np. 👍, 🚲 i 🌞.
Utwórz dane logowania identyfikatora klienta OAuth dla aplikacji na komputery. Aby uruchomić przykład w tym przewodniku, zapisz dane logowania jako plik JSON o nazwie credentials.json w katalogu lokalnym.
Aby uzyskać wskazówki, wykonaj czynności związane z konfigurowaniem środowiska opisane w tym krótkim przewodniku.
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);
Aby uruchomić ten przykład, zastąp te elementy:
SPACE_NAME: identyfikator z przestrzeni name.
Możesz go uzyskać, wywołując metodę
ListSpaces()
lub z adresu URL pokoju.
MESSAGE_NAME: identyfikator z elementu name wiadomości.
Identyfikator możesz uzyskać z treści odpowiedzi zwróconej po utworzeniu wiadomości asynchronicznie za pomocą interfejsu Chat API lub za pomocą niestandardowej nazwy przypisanej do wiadomości podczas jej tworzenia.
REACTION_NAME: identyfikator z reakcji name.
Identyfikator możesz uzyskać, wywołując metodę
ListReactions()
lub z treści odpowiedzi zwróconej po asynchronicznym utworzeniu reakcji za pomocą interfejsu Chat API.
Jeśli operacja się uda, treść odpowiedzi będzie pusta, co oznacza, że reakcja została usunięta.
[[["Łatwo zrozumieć","easyToUnderstand","thumb-up"],["Rozwiązało to mój problem","solvedMyProblem","thumb-up"],["Inne","otherUp","thumb-up"]],[["Brak potrzebnych mi informacji","missingTheInformationINeed","thumb-down"],["Zbyt skomplikowane / zbyt wiele czynności do wykonania","tooComplicatedTooManySteps","thumb-down"],["Nieaktualne treści","outOfDate","thumb-down"],["Problem z tłumaczeniem","translationIssue","thumb-down"],["Problem z przykładami/kodem","samplesCodeIssue","thumb-down"],["Inne","otherDown","thumb-down"]],["Ostatnia aktualizacja: 2025-09-10 UTC."],[[["\u003cp\u003eThis guide explains how to delete reactions (emojis like 👍, 🚲, 🌞) from Google Chat messages using the \u003ccode\u003edelete()\u003c/code\u003e method.\u003c/p\u003e\n"],["\u003cp\u003eDeleting a reaction does not delete the original message itself.\u003c/p\u003e\n"],["\u003cp\u003eYou'll need a Google Workspace account and Node.js to use the Google Chat API for deleting reactions.\u003c/p\u003e\n"],["\u003cp\u003eThe guide provides a code sample and instructions to set up your environment and authenticate for using the API.\u003c/p\u003e\n"],["\u003cp\u003eTo successfully delete a reaction, you need to provide the specific name of the reaction resource in your API request.\u003c/p\u003e\n"]]],["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"],null,[]]