Temsilciniz, kullanıcı etkileşimlerini simüle etmek için kullanıcının cihazına durum etkinlikleri gönderir. Bu etkinlikler, kullanıcılara iletilerinin işlendiğini bildirmek için okundu bilgisi veya yazma göstergesi olarak gösterilir.
Biçimlendirme ve değer seçeneklerinin tam listesi için phones.agentEvents referansına bakın.
Aracınızın RBM platformundan aldığı webhook etkinlikleri hakkında ayrıntılı bilgi için Etkinlik alma başlıklı makaleyi inceleyin.
Temsilci bir READ etkinliği gönderir
Bu etkinlik, kullanıcılara belirli bir mesajın okunma onayı olarak görünür. Kullanıcıya, RBM platformunun mesajını ilettiğini ve temsilcinin mesajı işlediğini bildirir.
Aşağıdaki kod, eşleşen bir messageId içeren ileti için READ etkinliğini gönderir.
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);
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");
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");
Temsilci, IS_TYPING etkinliğini gönderir.
Bu etkinlik, kullanıcılara yazma göstergesi olarak görünür ve temsilcinizin bir mesaj yazdığını bildirir. Yazma göstergesi kısa bir süre sonra (yaklaşık 20 saniye) veya kullanıcının cihazı temsilcinizden yeni bir mesaj aldığında sona erer. Aracılarınız, yazma göstergesinin geçerlilik süresi zamanlayıcısını sıfırlamak için birden fazla IS_TYPING etkinliği gönderebilir.
Aşağıdaki kod, bir IS_TYPING etkinliği gönderir.
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!'); });
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");
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");