يرسل وكيلك أحداث الحالة إلى جهاز المستخدم لمحاكاة التفاعلات البشرية. بالنسبة إلى المستخدمين، تظهر هذه الأحداث كإشعارات بالقراءة أو مؤشرات كتابة، ما يضمن لهم أنّه تتم معالجة رسائلهم.
للحصول على خيارات التنسيق والقيم الكاملة، يُرجى الاطّلاع على مرجع phones.agentEvents.
للاطّلاع على تفاصيل حول أحداث الردّ التلقائي على الويب التي يتلقّاها وكيلك من منصة RBM، يُرجى الاطّلاع على تلقّي الأحداث.
يرسل الوكيل حدث READ
بالنسبة إلى المستخدمين، يظهر هذا الحدث كإشعار بالقراءة لرسالة معيّنة. تتيح هذه الحالة للمستخدم معرفة أنّ منصة RBM قد سلّمت رسالته وأنّ الوكيل يعالجها.
يتم الاحتفاظ بأحداث READ وتخزينها لمدة 30 يومًا. إذا كانت خدمات الاتصالات التفاعلية (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);
جافا
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");
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)
#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");
يرسل الوكيل حدث IS_TYPING
يظهر هذا الحدث للمستخدمين كمؤشر كتابة ويُعلمهم بأنّ وكيلك يكتب رسالة. تنتهي صلاحية مؤشر الكتابة بعد فترة قصيرة (حوالي 5 ثوانٍ تلقائيًا) أو عندما يتلقّى جهاز المستخدم رسالة جديدة من وكيلك. يمكن لوكيلك إرسال أحداث 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!'); });
جافا
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");
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')
#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");