เพิกถอนข้อความ

ในตัวอย่างต่อไปนี้ 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

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();
}
โค้ดนี้เป็นข้อความที่ตัดมาจากตัวแทนตัวอย่าง 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