Etkinlikleri gönder

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, READ etkinliğini gönderir.

Bu etkinlik, kullanıcılara belirli bir mesajın okunma onayı olarak görünür. Bu mesaj, kullanıcıya RBM platformunun iletisini teslim ettiğini ve temsilcinin iletisi işlediğini bildirir.

READ etkinlikleri kalıcı hale getirilir ve 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 etkin değilse İş için RCS platformu NOT_FOUND (HTTP 404) hatası döndürür.

Aşağıdaki kod, eşleşen messageId içeren bir 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);
Bu kod, RBM örnek temsilcisinden alınmıştır.

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");
Bu kod, RBM örnek temsilcisinden alınmıştır.

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)
Bu kod, RBM örnek temsilcisinden alınmıştır.

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");
Bu kod, RBM örnek temsilcisinden alınmıştır.

Temsilci, IS_TYPING etkinliğini gönderir.

Bu etkinlik, kullanıcılara yazma göstergesi olarak görünür ve temsilcinizin 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ı, yazma göstergesinin geçerlilik bitiş 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!');
});
Bu kod, RBM örnek temsilcisinden alınmıştır.

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");
Bu kod, RBM örnek temsilcisinden alınmıştır.

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')
Bu kod, RBM örnek temsilcisinden alınmıştır.

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");
Bu kod, RBM örnek temsilcisinden alınmıştır.