इवेंट

यहां दिए गए उदाहरणों में, rbm_api_helper.js (Python के लिए इस्तेमाल नहीं किया जाता) यह मानता है कि जिस फ़ाइल में काम किया जा रहा है वह मुख्य ऐप्लिकेशन फ़ोल्डर से एक डायरेक्ट्री नीचे है. आपको अपने प्रोजेक्ट के कॉन्फ़िगरेशन के हिसाब से, जगह में बदलाव करना पड़ सकता है.

मैसेज देखे जाने से जुड़े इवेंट

मैसेज देखे जाने से जुड़े इवेंट से, उपयोगकर्ता को पता चलता है कि एजेंट को मैसेज मिल गया है. साथ ही, इससे यह पक्का होता है कि 'RCS for Business' प्लैटफ़ॉर्म ने उनका मैसेज डिलीवर कर दिया है. यहां दिया गया कोड, क्लाइंट लाइब्रेरी वाले डिवाइस पर मैसेज देखे जाने से जुड़ा इवेंट भेजता है.

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);
यह कोड, RBM के सैंपल एजेंट से लिया गया है.

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");
यह कोड, RBM के सैंपल एजेंट से लिया गया है.

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)
यह कोड, RBM के सैंपल एजेंट से लिया गया है.

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");
यह कोड, RBM के सैंपल एजेंट से लिया गया है.

टाइप किए जाने से जुड़े इवेंट

टाइप किए जाने से जुड़े इवेंट से, उपयोगकर्ता को पता चलता है कि आपका एजेंट कोई मैसेज कंपोज़ कर रहा है. यहां दिया गया कोड, क्लाइंट लाइब्रेरी वाले डिवाइस पर टाइप किए जाने से जुड़ा इवेंट भेजता है.

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!');
});
यह कोड, RBM के सैंपल एजेंट से लिया गया है.

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");
यह कोड, RBM के सैंपल एजेंट से लिया गया है.

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')
यह कोड, RBM के सैंपल एजेंट से लिया गया है.

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");
यह कोड, RBM के सैंपल एजेंट से लिया गया है.