Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Questa guida spiega come utilizzare il metodo
list()
nella risorsa Reaction dell'API Google Chat per elencare le reazioni a un messaggio, ad esempio 👍, 🚲 e 🌞.
La
risorsa Reaction rappresenta un'emoji che le persone possono usare per reagire a un messaggio, ad esempio 👍, 🚲 e 🌞.
Crea le credenziali dell'ID client OAuth per un'applicazione desktop. Per eseguire l'esempio in questa
guida, salva le credenziali come file JSON denominato client_secrets.json nella
directory locale.
Per indicazioni, completa i passaggi per configurare il tuo ambiente in questa
guida rapida.
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);
Per eseguire questo esempio, sostituisci quanto segue:
SPACE_NAME: l'ID del
name dello spazio.
Puoi ottenere l'ID chiamando il metodo
ListSpaces()
o dall'URL dello spazio.
MESSAGE_NAME: l'ID del messaggio
name.
Puoi ottenere l'ID dal corpo della risposta restituito dopo aver creato un messaggio in modo asincrono con l'API Chat o con il nome personalizzato assegnato al messaggio al momento della creazione.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Mancano le informazioni di cui ho bisogno","missingTheInformationINeed","thumb-down"],["Troppo complicato/troppi passaggi","tooComplicatedTooManySteps","thumb-down"],["Obsoleti","outOfDate","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Problema relativo a esempi/codice","samplesCodeIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 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"]]