ঘটনা পাঠান

আপনার এজেন্ট মানুষের সাথে কথোপকথনের অনুকরণ করতে ব্যবহারকারীর ডিভাইসে স্ট্যাটাস ইভেন্ট পাঠায়। ব্যবহারকারীদের জন্য, এই ইভেন্টগুলি রিড রিসিপ্ট বা টাইপিং ইন্ডিকেটর হিসাবে প্রদর্শিত হয়, যা তাদের আশ্বস্ত করে যে তাদের বার্তাগুলি প্রক্রিয়া করা হচ্ছে।

সম্পূর্ণ ফরম্যাটিং এবং মানের বিকল্পগুলির জন্য, phones.agentEvents রেফারেন্সটি দেখুন।

আপনার এজেন্ট RBM প্ল্যাটফর্ম থেকে যে ওয়েবহুক ইভেন্টগুলো গ্রহণ করে, সে সম্পর্কে বিস্তারিত জানতে “ইভেন্ট গ্রহণ করুন” দেখুন।

এজেন্ট একটি READ ইভেন্ট পাঠায়

ব্যবহারকারীদের কাছে এই ইভেন্টটি একটি নির্দিষ্ট বার্তার 'রিড রিসিপ্ট' হিসেবে প্রদর্শিত হয়। এর মাধ্যমে ব্যবহারকারী জানতে পারেন যে, RBM প্ল্যাটফর্ম তার বার্তাটি পৌঁছে দিয়েছে এবং এজেন্ট সেটি প্রসেস করছে।

READ ইভেন্টগুলো ৩০ দিনের জন্য সংরক্ষিত থাকে। যদি ব্যবহারকারীর RCS সক্রিয় থাকে কিন্তু তার সাথে যোগাযোগ করা না যায়, তাহলে ইভেন্টটি কিউতে জমা হয়। আর যদি তাদের RCS সক্রিয় না থাকে, তাহলে RCS for Business প্ল্যাটফর্মটি একটি NOT_FOUND (HTTP 404) এরর রিটার্ন করে।

নিম্নলিখিত কোডটি একটি মিলে যাওয়া messageId সহ একটি বার্তার জন্য একটি READ ইভেন্ট পাঠায়।

cURL

curl -X POST "https://REGION-rcsbusinessmessaging.googleapis.com/v1/phones/PHONE_NUMBER/agentEvents?eventId=EVENT_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`" \
-d "{
  'eventType': 'READ',
  'messageId': 'MESSAGE_ID'
}"

নোড.জেএস

// Reference to RBM API helper
const rbmApiHelper = require('@google/rcsbusinessmessaging');

// Send the device an event to indicate that messageId has been read
rbmApiHelper.sendReadMessage('+12223334444', messageId);
এই কোডটি একটি RBM নমুনা এজেন্ট থেকে নেওয়া অংশ।

জাভা

import com.google.rbm.RbmApiHelper;


// Create an instance of the RBM API helper
RbmApiHelper rbmApiHelper = new RbmApiHelper();

// Send the device an event to indicate that messageId has been read
rbmApiHelper.sendReadMessage(messageId, "+12223334444");
এই কোডটি একটি RBM নমুনা এজেন্ট থেকে নেওয়া অংশ।

পাইথন

# Reference to RBM Python client helper and messaging object structure
from rcs_business_messaging import rbm_service

# Send the device an event to indicate that message_id was read
rbm_service.send_read_event('+12223334444', message_id)
এই কোডটি একটি RBM নমুনা এজেন্ট থেকে নেওয়া অংশ।

সি#

using RCSBusinessMessaging;


// Create an instance of the RBM API helper
RbmApiHelper rbmApiHelper = new RbmApiHelper(credentialsFileLocation,
                                                 projectId);

// Send the device an event to indicate that messageId has been read
rbmApiHelper.SendReadMessage(messageId, "+12223334444");
এই কোডটি একটি RBM নমুনা এজেন্ট থেকে নেওয়া অংশ।

এজেন্ট একটি IS_TYPING ইভেন্ট পাঠায়

ব্যবহারকারীদের কাছে এই ইভেন্টটি একটি টাইপিং ইন্ডিকেটর হিসেবে প্রদর্শিত হয় এবং তাদের জানিয়ে দেয় যে আপনার এজেন্ট একটি মেসেজ কম্পোজ করছে। টাইপিং ইন্ডিকেটরটি অল্প সময়ের মধ্যে (প্রায় ২০ সেকেন্ড) অথবা যখন ব্যবহারকারীর ডিভাইসে আপনার এজেন্টের কাছ থেকে একটি নতুন মেসেজ আসে, তখন অদৃশ্য হয়ে যায়। আপনার এজেন্ট টাইপিং ইন্ডিকেটরের এক্সপায়ারেশন টাইমার রিসেট করার জন্য একাধিক IS_TYPING ইভেন্ট পাঠাতে পারে।

IS_TYPING ইভেন্টগুলো ক্ষণস্থায়ী এবং সারিবদ্ধ করা হয় না।

নিম্নলিখিত কোডটি একটি IS_TYPING ইভেন্ট প্রেরণ করে।

cURL

curl -X POST "https://REGION-rcsbusinessmessaging.googleapis.com/v1/phones/PHONE_NUMBER/agentEvents?eventId=EVENT_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`" \
-d "{
  'eventType': 'IS_TYPING',
}"

নোড.জেএস

// Reference to RBM API helper
const rbmApiHelper = require('@google/rcsbusinessmessaging');

// Send the device an event to indicate that the agent is typing
rbmApiHelper.sendIsTypingMessage('+12223334444', function() {
    console.log('Typing event sent!');
});
এই কোডটি একটি RBM নমুনা এজেন্ট থেকে নেওয়া অংশ।

জাভা

import com.google.rbm.RbmApiHelper;


// Create an instance of the RBM API helper
RbmApiHelper rbmApiHelper = new RbmApiHelper();

// Send the device an event to indicate that the agent is typing
rbmApiHelper.sendIsTypingMessage("+12223334444");
এই কোডটি একটি RBM নমুনা এজেন্ট থেকে নেওয়া অংশ।

পাইথন

# Reference to RBM Python client helper and messaging object structure
from rcs_business_messaging import rbm_service

# Send the device an event to indicate that the agent is typing
rbm_service.send_is_typing_event('+12223334444')
এই কোডটি একটি RBM নমুনা এজেন্ট থেকে নেওয়া অংশ।

সি#

using RCSBusinessMessaging;


// Create an instance of the RBM API helper
RbmApiHelper rbmApiHelper = new RbmApiHelper(credentialsFileLocation,
                                                 projectId);

// Send the device an event to indicate that the agent is typing
rbmApiHelper.SendIsTypingMessage(messageId, "+12223334444");
এই কোডটি একটি RBM নমুনা এজেন্ট থেকে নেওয়া অংশ।