קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
במדריך הזה מוסבר איך להשתמש ב-method delete() במשאב Reaction של Google Chat API כדי למחוק תגובה להודעה, כמו 👍, 🚲 ו-🌞. מחיקת תגובה לא מוחקת את ההודעה.
המשאבים מסוג Reaction מייצגים אמוג'י שאנשים יכולים להשתמש בו כדי להגיב להודעה, כמו 👍, 🚲 ו-🌞.
יצירת פרטי כניסה של מזהה לקוח 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 של המרחב המשותף.
אפשר לקבל את המזהה על ידי קריאה ל-method ListSpaces() או מכתובת ה-URL של המרחב המשותף.
MESSAGE_NAME: המזהה מ-name של ההודעה.
אפשר לקבל את המזהה מגוף התגובה שמוחזר אחרי יצירת הודעה באופן אסינכררוני באמצעות Chat API, או באמצעות השם המותאם אישית שהוקצה להודעה בזמן היצירה.
REACTION_NAME: המזהה מ-name של התגובה.
אפשר לקבל את המזהה באמצעות הקריאה ל-method 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-06-05 (שעון 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"]]