메시지 취소

다음 예에서 rbm_api_helper.js (Python에는 사용되지 않음)는 작업 중인 파일이 기본 앱 폴더 아래에 있는 디렉터리 1개라고 가정합니다. 프로젝트 구성에 따라 위치를 조정해야 할 수도 있습니다.

다음 코드는 클라이언트 라이브러리를 사용하여 전송되지 않은 기존 메시지를 취소합니다.

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 샘플 에이전트의 발췌 부분입니다.

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)
이 코드는 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");
이 코드는 RBM 샘플 에이전트의 발췌 부분입니다.