इवेंट भेजें

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

फ़ॉर्मैटिंग और वैल्यू के सभी विकल्पों के लिए, phones.agentEvents रेफ़रंस देखें.

RBM प्लैटफ़ॉर्म से आपके एजेंट को मिलने वाले वेबुक इवेंट के बारे में ज़्यादा जानने के लिए, इवेंट पाना लेख पढ़ें.

एजेंट, READ इवेंट भेजता है

उपयोगकर्ताओं को यह इवेंट, किसी खास मैसेज के लिए पढ़े जाने की रसीद के तौर पर दिखता है. इससे उपयोगकर्ता को पता चलता है कि RBM प्लैटफ़ॉर्म ने उसका मैसेज डिलीवर कर दिया है और एजेंट उसे प्रोसेस कर रहा है.

READ इवेंट को सेव किया जाता है और 30 दिनों तक स्टोर किया जाता है. अगर उपयोगकर्ता ने आरसीएस की सुविधा चालू की है, लेकिन उससे संपर्क नहीं किया जा सकता, तो इवेंट को कतार में रखा जाता है. अगर उनके पास आरसीएस की सुविधा चालू नहीं है, तो RCS for Business प्लैटफ़ॉर्म, NOT_FOUND (एचटीटीपी 404) गड़बड़ी दिखाता है.

नीचे दिया गया कोड, मैच करने वाले 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);
यह कोड, आरबीएम के सैंपल एजेंट से लिया गया है.

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

एजेंट, IS_TYPING इवेंट भेजता है

उपयोगकर्ताओं को यह इवेंट, टाइपिंग इंडिकेटर के तौर पर दिखता है. इससे उन्हें पता चलता है कि आपका एजेंट कोई मैसेज लिख रहा है. टाइपिंग इंडिकेटर, कुछ समय (लगभग 20 सेकंड) के बाद या जब उपयोगकर्ता के डिवाइस को आपके एजेंट से कोई नया मैसेज मिलता है, तब बंद हो जाता है. आपका एजेंट, टाइपिंग इंडिकेटर के खत्म होने के टाइमर को रीसेट करने के लिए, कई IS_TYPING इवेंट भेज सकता है.

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

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