إنشاء بيانات اعتماد معرِّف عميل OAuth لتطبيق على جهاز كمبيوتر لتشغيل النموذج في هذا الدليل، احفظ بيانات الاعتماد كملف JSON باسم credentials.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()
أو من عنوان URL الخاص بالمساحة.
MESSAGE_NAME: المعرّف من name الخاص بالرسالة
يمكنك الحصول على المعرّف من نص الرد الذي يتم إرجاعه بعد إنشاء رسالة بشكل غير متزامن باستخدام Chat API، أو باستخدام الاسم المخصّص الذي تم تعيينه للرسالة عند إنشائها.
تاريخ التعديل الأخير: 2025-09-10 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","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-09-10 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eThis guide explains how to use the \u003ccode\u003elist()\u003c/code\u003e method to retrieve reactions (e.g., 👍, 🚲, 🌞) for messages in Google Chat using the Google Chat API.\u003c/p\u003e\n"],["\u003cp\u003eBefore 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.\u003c/p\u003e\n"],["\u003cp\u003eTo list reactions, call the \u003ccode\u003eListReactions()\u003c/code\u003e method, providing the message's resource name and specifying the necessary authorization scope.\u003c/p\u003e\n"],["\u003cp\u003eYou'll need the space ID and message ID to construct the resource name for the \u003ccode\u003eListReactions()\u003c/code\u003e method call.\u003c/p\u003e\n"],["\u003cp\u003eThe Chat API returns a paginated list of reactions for the specified message.\u003c/p\u003e\n"]]],["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"],null,[]]