किसी मैसेज पर मिलने वाली प्रतिक्रियाओं की सूची बनाना
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
इस गाइड में, Google Chat API के Reaction संसाधन पर list() के तरीके का इस्तेमाल करके, किसी मैसेज पर प्रतिक्रियाओं की सूची बनाने का तरीका बताया गया है. जैसे, 👍, 🚲, और 🌞.
Reaction रिसॉर्स, किसी इमोजी को दिखाता है. इसका इस्तेमाल करके, लोग किसी मैसेज पर प्रतिक्रिया दे सकते हैं. जैसे, 👍, 🚲, और 🌞.
ज़रूरी शर्तें
Node.js
आपके पास Google Chat का ऐक्सेस हो और आपके पास Google Workspace का Business या Enterprise वर्शन वाला खाता हो.
डेस्कटॉप ऐप्लिकेशन के लिए,
OAuth क्लाइंट आईडी क्रेडेंशियल बनाएं. इस गाइड में दिए गए सैंपल को चलाने के लिए, अपनी लोकल डायरेक्ट्री में क्रेडेंशियल को client_secrets.json नाम की JSON फ़ाइल के तौर पर सेव करें.
निर्देशों के लिए, इस क्विकस्टार्ट में अपना एनवायरमेंट सेट अप करने के लिए दिया गया तरीका अपनाएं.
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);
इस सैंपल को चलाने के लिए, इन चीज़ों को बदलें:
SPACE_NAME: स्पेस के
name का आईडी.
आईडी पाने के लिए, ListSpaces() तरीका अपनाएं या स्पेस के यूआरएल का इस्तेमाल करें.
MESSAGE_NAME: मैसेज के name से मिला आईडी.
Chat API का इस्तेमाल करके, एसिंक्रोनस तरीके से मैसेज बनाने के बाद मिले रिस्पॉन्स बॉडी से आईडी हासिल किया जा सकता है. इसके अलावा, मैसेज बनाने के दौरान असाइन किए गए कस्टम नाम से भी आईडी हासिल किया जा सकता है.
[[["समझने में आसान है","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"]],["आखिरी बार 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"]]