Revoca messaggi

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.