لغو پیام ها

در مثال زیر، rbm_api_helper.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 است.