new_releases Updates: Check the
release notes for new features and product updates.
Revoke messages
Stay organized with collections
Save and categorize content based on your preferences.
Your agent can revoke a message that has been sent but not yet delivered. It's
best to revoke undelivered messages before they go stale. The timing depends on
your agent's use case. For example, you might revoke an OTP message after ten
minutes but revoke a promotional message on a specific expiration date. For
timely message delivery, be sure to revoke messages in time for you to send them
by an alternate route like SMS.
There are two ways to revoke a message:
Send a revocation request
to trigger the revocation. The 200 OK response confirms that the message was
revoked and deleted from the user's queue. A 404 Not Found response means
the revocation attempt has failed because the message was delivered.
Set a message expiration
to automatically revoke the message at the appropriate time. The RBM
platform notifies your agent when the message has expired and confirms
whether or not it was successfully revoked. See Server-generated events
for more information.
Revocation could fail on rare occasions. For example, your agent may attempt to
revoke a message while the RBM platform is in the process of delivering it. If
revocation fails, check for a DELIVERED
event
at your webhook. If the message hasn't been delivered, you can send a new
revocation request
and then route the message to an alternate channel like SMS for timely delivery.
Example
The following code sends a revocation request. For formatting and value
information, see
phones.agentMessages.delete
.
cURL
curl -X DELETE "https://REGION-rcsbusinessmessaging.googleapis.com/v1/phones/PHONE_NUMBER/agentMessages/MESSAGE_ID?agentId=AGENT_ID" \
-H "Content-Type: application/json" \
-H "User-Agent: curl/rcs-business-messaging" \
-H "`oauth2l header --json PATH_TO_SERVICE_ACCOUNT_KEY rcsbusinessmessaging`"
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);
});
This code is an excerpt from an RBM sample agent.
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();
}
This code is an excerpt from an RBM sample agent.
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)
This code is an excerpt from an RBM sample agent.
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");
This code is an excerpt from an RBM sample agent.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-01 UTC.
[null,null,["Last updated 2025-08-01 UTC."],[[["\u003cp\u003eAgents can revoke undelivered messages, with the optimal timing for revocation depending on the message's context, such as revoking an OTP after ten minutes versus a promotional message on a specific date.\u003c/p\u003e\n"],["\u003cp\u003eMessage revocation can be initiated through a revocation request, which triggers a 200 OK response from the RBM platform without guaranteeing successful revocation; success results in the message being deleted from the user's queue.\u003c/p\u003e\n"],["\u003cp\u003eSetting a message expiration time enables automatic revocation, with the RBM platform confirming whether the message was successfully revoked upon expiration.\u003c/p\u003e\n"],["\u003cp\u003eIn the rare event that revocation fails, an agent can check for a \u003ccode\u003eDELIVERED\u003c/code\u003e event and resend a revocation request before routing the message via an alternative channel, like SMS, to ensure delivery.\u003c/p\u003e\n"],["\u003cp\u003eThe code examples show how to revoke a message through a revocation request in cURL, Node.js, Java, Python, and C#, demonstrating the practical application of message revocation.\u003c/p\u003e\n"]]],[],null,["# Revoke messages\n\nYour agent can revoke a message that has been sent but not yet delivered. It's\nbest to revoke undelivered messages before they go stale. The timing depends on\nyour agent's use case. For example, you might revoke an OTP message after ten\nminutes but revoke a promotional message on a specific expiration date. For\ntimely message delivery, be sure to revoke messages in time for you to send them\nby an alternate route like SMS.\n\nThere are two ways to revoke a message:\n\n- [Send a revocation request](/business-communications/rcs-business-messaging/guides/build/messages/revoke#example)\n to trigger the revocation. The 200 OK response confirms that the message was\n revoked and deleted from the user's queue. A 404 Not Found response means\n the revocation attempt has failed because the message was delivered.\n\n- [Set a message expiration](/business-communications/rcs-business-messaging/guides/build/messages/send#expire)\n to automatically revoke the message at the appropriate time. The RBM\n platform notifies your agent when the message has expired and confirms\n whether or not it was successfully revoked. See [Server-generated events](/business-communications/rcs-business-messaging/guides/build/events#server-generated_events)\n for more information.\n\nRevocation could fail on rare occasions. For example, your agent may attempt to\nrevoke a message while the RBM platform is in the process of delivering it. If\nrevocation fails, check for a [`DELIVERED` event](/business-communications/rcs-business-messaging/guides/build/events#delivered)\nat your webhook. If the message hasn't been delivered, you can send a new\n[revocation request](/business-communications/rcs-business-messaging/guides/build/messages/revoke#example)\nand then route the message to an alternate channel like SMS for timely delivery.\n\nExample\n-------\n\nThe following code sends a revocation request. For formatting and value\ninformation, see\n[`phones.agentMessages.delete`](/business-communications/rcs-business-messaging/reference/rest/v1/phones.agentMessages/delete). \n\n### cURL\n\n```console\ncurl -X DELETE \"https://\u003cvar fieldvalues=\"asia,europe,us\" translate=\"no\"\u003eREGION\u003c/var\u003e-rcsbusinessmessaging.googleapis.com/v1/phones/\u003cvar translate=\"no\"\u003ePHONE_NUMBER\u003c/var\u003e/agentMessages/\u003cvar fieldlabel=\"Message ID\" translate=\"no\"\u003eMESSAGE_ID\u003c/var\u003e?agentId=\u003cvar translate=\"no\"\u003eAGENT_ID\u003c/var\u003e\" \\\n-H \"Content-Type: application/json\" \\\n-H \"User-Agent: curl/rcs-business-messaging\" \\\n-H \"`oauth2l header --json \u003cvar translate=\"no\"\u003ePATH_TO_SERVICE_ACCOUNT_KEY\u003c/var\u003e rcsbusinessmessaging`\"\n```\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)."]]