AI-generated Key Takeaways
-
This page demonstrates how to revoke an undelivered message using the RBM API with code examples in Node.js, Java, Python, and C#.
-
The 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
messageId
. -
Each language example requires referencing a helper library, such as
rbmApiHelper
for Node.js, Java and C#, andrbm_service
for Python. -
The
revokeMessage
orrevoke
function is used in all examples to revoke a message associated with a providedmessageId
, and each language shows the necessary parameters.
In the following example, rbm_api_helper.js
(not used for Python) assumes the
file you are working in is one directory below the main app folder. You may
need to adjust the location depending on your project's configuration.
The following code revokes an existing, undelivered message with a client library.
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); });
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(); }
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)
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");