In den folgenden Beispielen wird für rbm_api_helper.js
(nicht für Python verwendet) davon ausgegangen, dass sich die Datei, in der Sie arbeiten, einen Ordner unterhalb des Hauptordners der Anwendung befindet. Je nach Konfiguration Ihres Projekts müssen Sie den Speicherort möglicherweise anpassen.
Ereignisse lesen
Lesevorgänge informieren den Nutzer darüber, dass der Kundenservicemitarbeiter die Nachricht erhalten hat, und geben ihm die Gewissheit, dass die Nachricht über die RBM-Plattform zugestellt wurde. Im folgenden Code wird ein Leseereignis an ein Gerät mit einer Clientbibliothek gesendet.
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");
Tippen
Ereignisse beim Tippen informieren den Nutzer darüber, dass Ihr Kundenservicemitarbeiter eine Nachricht verfasst. Im folgenden Code wird ein Tippen-Ereignis an ein Gerät mit einer Clientbibliothek gesendet.
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");