new_releases Update: Periksa
catatan rilis untuk mengetahui fitur baru dan update produk.
Mencabut pesan
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Dalam contoh berikut, rbm_api_helper.js
(tidak digunakan untuk Python) mengasumsikan bahwa
file yang Anda gunakan adalah satu direktori di bawah folder aplikasi utama. Anda mungkin
perlu menyesuaikan lokasi, bergantung pada konfigurasi project.
Kode berikut membatalkan pesan yang ada dan belum dikirim dengan
library klien.
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);
});
Kode ini adalah kutipan dari agen contoh 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();
}
Kode ini adalah kutipan dari agen contoh 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)
Kode ini adalah kutipan dari agen contoh 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");
Kode ini adalah kutipan dari agen contoh RBM.
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-04-10 UTC.
[null,null,["Terakhir diperbarui pada 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)."]]