에이전트가 상태 이벤트를 사용자 기기로 전송하여 사람의 상호작용을 시뮬레이션합니다. 사용자에게는 이러한 이벤트가 수신 확인 또는 입력 표시기로 표시되어 메시지가 처리되고 있음을 알 수 있습니다.
전체 형식 지정 및 값 옵션은 phones.agentEvents 참조를 확인하세요.
상담사가 RBM 플랫폼에서 수신하는 웹훅 이벤트에 관한 자세한 내용은 이벤트 수신을 참고하세요.
상담사가 READ 이벤트를 전송함
사용자에게 이 이벤트는 특정 메시지의 읽음 확인으로 표시됩니다. RBM 플랫폼에서 메시지를 전송했으며 에이전트가 메시지를 처리하고 있음을 사용자에게 알립니다.
다음 코드는 일치하는 messageId이 있는 메시지에 대해 READ 이벤트를 전송합니다.
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 이벤트를 전송함
사용자에게 이 이벤트는 입력 표시기로 표시되며 에이전트가 메시지를 작성하고 있음을 알립니다. 입력 표시기는 잠시 후(약 20초) 또는 사용자의 기기가 상담사로부터 새 메시지를 수신하면 만료됩니다. 에이전트는 여러 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");