new_releases Aggiornamenti: controlla le
note di rilascio per conoscere le nuove funzionalità e gli aggiornamenti del prodotto.
Revoca messaggi
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Nell'esempio seguente, rbm_api_helper.js
(non utilizzato per Python) presuppone che il
file in cui stai lavorando si trovi una directory sotto la cartella dell'app principale. Potresti dover modificare la posizione in base alla configurazione del progetto.
Il seguente codice revoca un messaggio esistente non recapitato con una biblioteca client.
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);
});
Questo codice è un estratto di un agente di esempio 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();
}
Questo codice è un estratto di un agente di esempio 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)
Questo codice è un estratto di un agente di esempio 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");
Questo codice è un estratto di un agente di esempio RBM.
Salvo quando diversamente specificato, i contenuti di questa pagina sono concessi in base alla licenza Creative Commons Attribution 4.0, mentre gli esempi di codice sono concessi in base alla licenza Apache 2.0. Per ulteriori dettagli, consulta le norme del sito di Google Developers. Java è un marchio registrato di Oracle e/o delle sue consociate.
Ultimo aggiornamento 2025-04-10 UTC.
[null,null,["Ultimo aggiornamento 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)."]]