Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Ten przewodnik wyjaśnia, jak za pomocą metody list() w zasobach Reaction interfejsu Google Chat API wyświetlić reakcje na wiadomość, takie jak 👍, 🚲 i 🌞.
Reaction to zasób, który reprezentuje emotikon, którego użytkownicy mogą używać do reakcji na wiadomości, np. 👍, 🚲 i 🌞.
Utwórz identyfikator klienta OAuth dla aplikacji komputerowej. Aby uruchomić przykładowy skrypt w tym przewodniku, zapisz dane logowania jako plik JSON o nazwie client_secrets.json w katalogu lokalnym.
Aby uzyskać pomoc, wykonaj czynności opisane w tym krótkim przewodniku, aby skonfigurować środowisko.
import{createClientWithUserCredentials}from'./authentication-utils.js';constUSER_AUTH_OAUTH_SCOPES=['https://www.googleapis.com/auth/chat.messages.reactions.readonly'];// This sample shows how to list reactions 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'};// Make the requestconstpageResult=chatClient.listReactionsAsync(request);// Handle the response. Iterating over pageResult will yield results and// resolve additional pages automatically.forawait(constresponseofpageResult){console.log(response);}}main().catch(console.error);
Aby uruchomić ten przykład, zastąp:
SPACE_NAME: identyfikator pokojuname.
Identyfikator możesz uzyskać, wywołując metodę ListSpaces() lub korzystając z adresu URL pokoju.
MESSAGE_NAME: identyfikator z name wiadomości.
Identyfikator możesz uzyskać z treści odpowiedzi zwróconej po asynchronicznym utworzeniu wiadomości za pomocą interfejsu Chat API lub za pomocą nazwy niestandardowej przypisanej do wiadomości podczas jej tworzenia.
[[["Ł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-02-14 UTC."],[[["This guide explains how to use the `list()` method to retrieve reactions (e.g., 👍, 🚲, 🌞) for messages in Google Chat using the Google Chat API."],["Before you begin, ensure you have a Google Workspace account, set up a Google Cloud project, enable the Google Chat API, and install the Node.js Cloud Client Library."],["To list reactions, call the `ListReactions()` method, providing the message's resource name and specifying the necessary authorization scope."],["You'll need the space ID and message ID to construct the resource name for the `ListReactions()` method call."],["The Chat API returns a paginated list of reactions for the specified message."]]],["This guide details listing reactions (emojis like 👍, 🚲, 🌞) on Google Chat messages using the Chat API's `ListReactions()` method. Key actions include setting up a Google Cloud project, enabling the Chat API, and obtaining OAuth credentials. To list reactions, specify the appropriate authorization scope (`chat.messages.reactions.readonly`, etc.) and call `ListReactions()`, passing the message's resource name as the `parent`. The API returns a paginated list of reactions.\n"]]