יצירת פרטי כניסה של מזהה לקוח OAuth לאפליקציה למחשב. כדי להריץ את הדוגמה במדריך הזה, צריך לשמור את פרטי הכניסה כקובץ JSON בשם credentials.json בספרייה המקומית.
כדי לקבל הנחיות, מבצעים את השלבים להגדרת הסביבה במדריך למתחילים הזה.
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);
כדי להריץ את הדוגמה הזו, מחליפים את הערכים הבאים:
SPACE_NAME: המזהה מname של המרחב.
אפשר לקבל את המזהה על ידי הפעלת השיטה ListSpaces() או מכתובת ה-URL של המרחב.
MESSAGE_NAME: המזהה מההודעה name.
אפשר לקבל את המזהה מגוף התגובה שמוחזר אחרי יצירת הודעה באופן אסינכרוני באמצעות Chat API, או באמצעות שם מותאם אישית שהוקצה להודעה בזמן היצירה.
REACTION_NAME: המזהה מname התגובה.
אפשר לקבל את המזהה באמצעות קריאה לשיטה ListReactions() או מגוף התגובה שמוחזר אחרי יצירת תגובה אסינכרונית באמצעות 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-07-25 (שעון UTC)."],[[["This guide explains how to delete reactions (emojis like 👍, 🚲, 🌞) from Google Chat messages using the `delete()` method."],["Deleting a reaction does not delete the original message itself."],["You'll need a Google Workspace account and Node.js to use the Google Chat API for deleting reactions."],["The guide provides a code sample and instructions to set up your environment and authenticate for using the API."],["To successfully delete a reaction, you need to provide the specific name of the reaction resource in your API request."]]],["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"]]