لغو پیام ها

نماینده شما می تواند پیامی را که ارسال شده اما هنوز تحویل داده نشده است، لغو کند. بهتر است پیام‌های تحویل‌نگرفته را قبل از کهنه شدن لغو کنید. زمان بندی بستگی به مورد استفاده نماینده شما دارد. برای مثال، ممکن است یک پیام OTP را پس از ده دقیقه لغو کنید، اما یک پیام تبلیغاتی را در تاریخ انقضای خاصی لغو کنید. برای تحویل به موقع پیام، مطمئن شوید که پیام ها را به موقع لغو کنید تا آنها را از طریق یک مسیر جایگزین مانند SMS ارسال کنید.

دو راه برای لغو یک پیام وجود دارد:

لغو ممکن است در موارد نادر با شکست مواجه شود. به عنوان مثال، نماینده شما ممکن است سعی کند پیامی را در حالی که پلتفرم RBM در حال تحویل آن است لغو کند. اگر لغو نشد، رویداد DELIVERED را در webhook خود بررسی کنید. اگر پیام تحویل داده نشده است، می توانید یک درخواست لغو جدید ارسال کنید و سپس پیام را برای تحویل به موقع به کانال دیگری مانند پیامک هدایت کنید.

مثال

کد زیر یک درخواست ابطال ارسال می کند. برای اطلاعات قالب‌بندی و ارزش، به phones.agentMessages.delete مراجعه کنید.

CURL

curl -X DELETE "https://REGION-rcsbusinessmessaging.googleapis.com/v1/phones/PHONE_NUMBER/agentMessages/MESSAGE_ID?agentId=AGENT_ID" \
-H "Content-Type: application/json" \
-H "User-Agent: curl/rcs-business-messaging" \
-H "`oauth2l header --json PATH_TO_SERVICE_ACCOUNT_KEY rcsbusinessmessaging`"

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 است.