ইভেন্ট পাঠানো

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

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

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

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

ব্যবহারকারীদের কাছে, এই ইভেন্টটি একটি নির্দিষ্ট মেসেজের জন্য পঠনের প্রাপ্তি হিসেবে দেখানো হয়। এটি ব্যবহারকারীকে জানায় যে RBM প্ল্যাটফর্ম তার মেসেজ ডেলিভার করেছে এবং এজেন্ট সেটি প্রসেস করছে।

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

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

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'
}"

Node.js

// 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 স্যাম্পেল এজেন্ট থেকে নেওয়া হয়েছে।

Java

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 স্যাম্পেল এজেন্ট থেকে নেওয়া হয়েছে।

Python

# 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 স্যাম্পেল এজেন্ট থেকে নেওয়া হয়েছে।

C#

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',
}"

Node.js

// 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 স্যাম্পেল এজেন্ট থেকে নেওয়া হয়েছে।

Java

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 স্যাম্পেল এজেন্ট থেকে নেওয়া হয়েছে।

Python

# 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 স্যাম্পেল এজেন্ট থেকে নেওয়া হয়েছে।

C#

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 স্যাম্পেল এজেন্ট থেকে নেওয়া হয়েছে।