इवेंट

इवेंट ऐसी सूचनाएं होती हैं जिन्हें आपका एजेंट भेज और पा सकता है. इवेंट तीन तरह के होते हैं:

सर्वर से जनरेट किए गए इवेंट

आरबीएम प्लैटफ़ॉर्म आपके एजेंट को सर्वर-लेवल अपडेट के बारे में सूचना देने के लिए इवेंट भेजता है. जैसे, मैसेज की समयसीमा खत्म होना.

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

मैसेज की समयसीमा खत्म हो गई है; रद्द हो गया है

संदेश की समय-सीमा खत्म हो गई थी और उसे रद्द कर दिया गया था. यह इवेंट आपकी फ़ॉलबैक मैसेज की रणनीति के लिए एक अच्छा ट्रिगर होगा.

{
  "phoneNumber": [phone number of recipient that the original message was intended for] ,
  "messageId": [RCS message ID of the message],
  "agentId": [bot ID],
  "eventType": "TTL_EXPIRATION_REVOKED",
  "eventId": [unique ID generated by the RBM platform],
  "sendTime": [time at which the server sent this event]
}

मैसेज की समयसीमा खत्म हो गई है; रद्द नहीं किया जा सका

मैसेज की समयसीमा खत्म हो गई थी, लेकिन इसे रद्द नहीं किया गया है.

{
  "phoneNumber": [phone number of recipient that the original message was intended for] ,
  "messageId": [RCS message ID of the message],
  "agentId": [bot ID],
  "eventType": "TTL_EXPIRATION_REVOKE_FAILED",
  "eventId": [unique ID generated by the RBM platform],
  "sendTime": [time at which the server sent this event]
}

मैसेज डिलीवर होने की कोई गारंटी नहीं है.

  • अगर मैसेज डिलीवर हो गया है, तो आपको अपने वेबहुक पर DELIVERED इवेंट मिलेगा.
  • अगर मैसेज डिलीवर नहीं हुआ था, तो रद्द करने का अनुरोध भेजने के लिए, 'रद्द करें' एपीआई का इस्तेमाल करें.

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

उपयोगकर्ता के बनाए गए इवेंट

लोगों के मैसेज और सुविधा की जांच की तरह ही, आपके एजेंट को उपयोगकर्ता के इवेंट JSON के तौर पर मिलते हैं.

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

उपयोगकर्ता को एजेंट का मैसेज मिलता है

यह इवेंट बताता है कि मैसेज डिलीवर कर दिया गया है.

{
  "senderPhoneNumber": "PHONE_NUMBER",
  "eventType": "DELIVERED",
  "eventId": "EVENT_ID",
  "messageId": "MESSAGE_ID",
  "agentId": "AGENT_ID"
}

उपयोगकर्ता, एजेंट का मैसेज पढ़ता है

यह इवेंट बताता है कि किसी मैसेज को खोला गया है या स्वीकार किया गया है.

{
  "senderPhoneNumber": "PHONE_NUMBER",
  "eventType": "READ",
  "eventId": "EVENT_ID",
  "messageId": "MESSAGE_ID",
  "agentId": "AGENT_ID"
}

उपयोगकर्ता टाइप करना शुरू करता है

यह इवेंट बताता है कि कोई उपयोगकर्ता टाइप कर रहा है.

{
  "senderPhoneNumber": "PHONE_NUMBER",
  "eventType": "IS_TYPING",
  "eventId": "EVENT_ID",,
  "agentId": "AGENT_ID"
}

उपयोगकर्ता आपको मैसेज भेजता है

{
  "senderPhoneNumber": "PHONE_NUMBER",
  "text": "Hi",
  "eventId": "EVENT_ID",
  "agentId": "AGENT_ID"
}

उपयोगकर्ता एक फ़ाइल भेजता है

{
  "senderPhoneNumber": "PHONE_NUMBER",
  "userFile": {
    "payload": {
      "mimeType": "image/gif",
      "fileSizeBytes": 127806,
      "fileUri": "https://storage.googleapis.com/copper_test/77ddb795-24ad-4607-96ae-b08b4d86406a/d2dcc67ab888d34ee272899c020b13402856f81597228322079eb007e8c9",
      "fileName": "4_animated.gif"
    }
  },
  "eventId": "EVENT_ID",,
  "agentId": "AGENT_ID"
}

उपयोगकर्ता सुझाए गए जवाब पर टैप करता है

जब कोई उपयोगकर्ता सुझाए गए जवाब पर टैप करता है, तो आपके एजेंट को जवाब के पोस्टबैक डेटा और टेक्स्ट के साथ एक इवेंट मिलता है.

{
  "senderPhoneNumber": "PHONE_NUMBER",
  "eventId": "EVENT_ID",
  "agentId": "AGENT_ID",
  "suggestionResponse": {
    "postbackData": "postback_1234",
    "text": "Hello there!"
  }
}

उपयोगकर्ता किसी सुझाई गई कार्रवाई पर टैप करता है

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

{
  "senderPhoneNumber": "PHONE_NUMBER",
  "eventId": "EVENT_ID",
  "agentId": "AGENT_ID",
  "suggestionResponse": {
    "postbackData": "postback_1234"
  }
}

एजेंट के बनाए गए इवेंट

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

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

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

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

यह कोड, मिलते-जुलते messageId वाले मैसेज के लिए READ इवेंट भेजता है.

cURL

curl -X POST "https://REGION-rcsbusinessmessaging.googleapis.com/v1/phones/PHONE_NUMBER/agentEvents?eventId=EVENT_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('../libs/rbm_api_helper');

// Send the device an event to indicate that messageId has been read
rbmApiHelper.sendReadMessage('+12223334444', messageId);
यह कोड, आरबीएम के सैंपल एजेंट से लिया गया है.

Java

import com.google.rbm.samples.lib.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" \
-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('../libs/rbm_api_helper');

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