new_releases עדכונים: בדקו את
נתוני הגרסה כדי לגלות תכונות חדשות ועדכוני מוצרים.
ביטול הודעות
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
בדוגמה הבאה, rbm_api_helper.js
(לא בשימוש ב-Python) מתייחס לקובץ שבו אתם עובדים, שנמצא בתיקייה אחת מתחת לתיקיית האפליקציה הראשית. יכול להיות שתצטרכו לשנות את המיקום בהתאם להגדרות הפרויקט.
הקוד הבא מבטל הודעה קיימת שלא נשלחה באמצעות ספריית לקוח.
Node.js
// Reference to RBM API helper
const rbmApiHelper = require('@google/rcsbusinessmessaging');
// Stop the message associated with messageId from being delivered
rbmApiHelper.revokeMessage('+12223334444', messageId, function(err, response) {
console.log(response);
});
הקוד הזה הוא קטע מנציג לדוגמה של RBM.
Java
import com.google.rbm.RbmApiHelper;
…
try {
// Create an instance of the RBM API helper
RbmApiHelper rbmApiHelper = new RbmApiHelper();
// Stop the message associated with messageId from being delivered
rbmApiHelper.revokeMessage(messageId, "+12223334444");
} catch(Exception e) {
e.printStackTrace();
}
הקוד הזה הוא קטע מנציג לדוגמה של RBM.
Python
# Reference to RBM Python client helper and messaging object structure
from rcs_business_messaging import rbm_service
# Stop the message associated with message_id from being delivered
rbm_service.revoke('+12223334444', message_id)
הקוד הזה הוא קטע מנציג לדוגמה של RBM.
C#
using RCSBusinessMessaging;
…
// Create an instance of the RBM API helper
RbmApiHelper rbmApiHelper = new RbmApiHelper(credentialsFileLocation,
projectId);
// Stop the message associated with messageId from being delivered
rbmApiHelper.RevokeMessage(messageId, "+12223334444");
הקוד הזה הוא קטע מנציג לדוגמה של RBM.
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-04-10 (שעון UTC).
[null,null,["עדכון אחרון: 2025-04-10 (שעון UTC)."],[[["\u003cp\u003eThis page demonstrates how to revoke an undelivered message using the RBM API with code examples in Node.js, Java, Python, and C#.\u003c/p\u003e\n"],["\u003cp\u003eThe provided code snippets show how to utilize the respective language's RBM API helper or client library to stop a message from being delivered, referencing a specific \u003ccode\u003emessageId\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eEach language example requires referencing a helper library, such as \u003ccode\u003erbmApiHelper\u003c/code\u003e for Node.js, Java and C#, and \u003ccode\u003erbm_service\u003c/code\u003e for Python.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003erevokeMessage\u003c/code\u003e or \u003ccode\u003erevoke\u003c/code\u003e function is used in all examples to revoke a message associated with a provided \u003ccode\u003emessageId\u003c/code\u003e, and each language shows the necessary parameters.\u003c/p\u003e\n"]]],[],null,["# Revoke messages\n\nIn the following example, `rbm_api_helper.js` (not used for Python) assumes the\nfile you are working in is one directory below the main app folder. You may\nneed to adjust the location depending on your project's configuration.\n\nThe following code [revokes](/business-communications/rcs-business-messaging/guides/build/messages/revoke) an existing, undelivered message with a\nclient library. \n\n### Node.js\n\n```javascript\n// Reference to RBM API helper\nconst rbmApiHelper = require('@google/rcsbusinessmessaging');\n\n// Stop the message associated with messageId from being delivered\nrbmApiHelper.revokeMessage('\u003cvar fieldlabel=\"Phone number\" translate=\"no\"\u003e+12223334444\u003c/var\u003e', messageId, function(err, response) {\n console.log(response);\n});\n```\nThis code is an excerpt from an [RBM sample agent](/business-communications/rcs-business-messaging/samples).\n\n### Java\n\n```java\nimport com.google.rbm.RbmApiHelper;\n...\n\ntry {\n // Create an instance of the RBM API helper\n RbmApiHelper rbmApiHelper = new RbmApiHelper();\n\n // Stop the message associated with messageId from being delivered\n rbmApiHelper.revokeMessage(messageId, \"\u003cvar fieldlabel=\"Phone number\" translate=\"no\"\u003e+12223334444\u003c/var\u003e\");\n} catch(Exception e) {\n e.printStackTrace();\n}\n```\nThis code is an excerpt from an [RBM sample agent](/business-communications/rcs-business-messaging/samples).\n\n### Python\n\n```python\n# Reference to RBM Python client helper and messaging object structure\nfrom rcs_business_messaging import rbm_service\n\n# Stop the message associated with message_id from being delivered\nrbm_service.revoke('\u003cvar fieldlabel=\"Phone number\" translate=\"no\"\u003e+12223334444\u003c/var\u003e', message_id)\n```\nThis code is an excerpt from an [RBM sample agent](/business-communications/rcs-business-messaging/samples).\n\n### C#\n\n```c#\nusing RCSBusinessMessaging;\n...\n\n// Create an instance of the RBM API helper\nRbmApiHelper rbmApiHelper = new RbmApiHelper(credentialsFileLocation,\n projectId);\n\n// Stop the message associated with messageId from being delivered\nrbmApiHelper.RevokeMessage(messageId, \"\u003cvar fieldlabel=\"Phone number\" translate=\"no\"\u003e+12223334444\u003c/var\u003e\");\n```\nThis code is an excerpt from an [RBM sample agent](/business-communications/rcs-business-messaging/samples)."]]