Temsilciniz, insan etkileşimlerini simüle etmek için kullanıcının cihazına durum etkinlikleri gönderir. Kullanıcılar için bu etkinlikler, okundu bilgisi veya yazma göstergesi olarak görünür ve mesajlarının işlendiğini gösterir.
Tüm biçimlendirme ve değer seçenekleri için phones.agentEvents referansına bakın.
Temsilcinizin RBM platformundan aldığı webhook etkinlikleri hakkında ayrıntılı bilgi için Etkinlikleri alma başlıklı makaleyi inceleyin.
Temsilci, READ etkinliği gönderir
Kullanıcılar bu etkinliği belirli bir mesajın okundu bilgisi olarak görür. Kullanıcıya, RBM platformunun mesajını teslim ettiğini ve temsilcinin mesajı işlediğini bildirir.
READ etkinlikleri 30 gün boyunca saklanır. Kullanıcıda RCS etkinse ancak kullanıcıya ulaşılamıyorsa etkinlik sıraya alınır. RCS etkinleştirilmemişse RCS for Business platformu NOT_FOUND (HTTP 404) hatası döndürür.
Aşağıdaki kod, eşleşen messageId içeren bir mesaj için READ 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': '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 bir IS_TYPING etkinliği gönderir
Kullanıcılar bu etkinliği yazma göstergesi olarak görür ve temsilcinizin mesaj yazdığını anlar. Yazma göstergesi kısa bir süre sonra (varsayılan olarak yaklaşık 5 saniye) veya kullanıcının cihazı temsilcinizden yeni bir mesaj aldığında kaybolur. Temsilciniz, yazma göstergesinin süre sonu zamanlayıcısını sıfırlamak için birden fazla IS_TYPING etkinliği gönderebilir.
IS_TYPING etkinlikleri geçicidir ve sıraya alınmaz.
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");