Отзыв сообщений

В следующем примере rbm_api_helper.js (не используется для Python) предполагает, что файл, с которым вы работаете, находится на один каталог ниже основной папки приложения. Возможно, вам придется изменить местоположение в зависимости от конфигурации вашего проекта.

Следующий код отзывает существующее недоставленное сообщение с помощью клиентской библиотеки.

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);
});
Этот код представляет собой отрывок из примера агента RBM .

Ява

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();
}
Этот код представляет собой отрывок из примера агента RBM .

Питон

# 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)
Этот код представляет собой отрывок из примера агента RBM .

С#

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");
Этот код представляет собой отрывок из примера агента RBM .