ইভেন্ট

ইভেন্ট হল এমন বিজ্ঞপ্তি যা আপনার এজেন্ট পাঠাতে এবং গ্রহণ করতে পারে। তিন ধরণের ইভেন্ট রয়েছে:

Server-generated events

RBM প্ল্যাটফর্ম আপনার এজেন্টকে সার্ভার-স্তরের আপডেট, যেমন মেসেজের মেয়াদ শেষ হওয়ার বিষয়ে অবহিত করার জন্য ইভেন্ট পাঠায়।

বিন্যাস এবং মান বিকল্পগুলির জন্য, ServerEvent দেখুন।

Agent launch status has changed

The RBM platform sends an AgentLaunchEvent for every change to your agent's launch status. For example, when your agent's state changes from PENDING to LAUNCHED after carrier approval, you receive an AgentLaunchEvent event to indicate the change. These events are sent for all RBM agents, for all carrier launch state changes.

Webhook configuration

এই বিজ্ঞপ্তিগুলি পেতে আপনি আপনার পার্টনার-লেভেল বা এজেন্ট-লেভেল ওয়েবহুক ব্যবহার করতে পারেন।

পূর্বশর্ত

Event payload structure

AgentLaunchEvent একটি পাব/সাব বার্তা হিসেবে সরবরাহ করা হয়। এখানে একটি উদাহরণ দেওয়া হল:

{
  "message": {
    "attributes": {
      "business_id": "rbm-chatbot-id@rbm.goog",
      "event_type": "REJECTED",
      "product": "RBM",
      "project_number": "3338881441851",
      "type": "agent_launch_event"
    },
    "data": "....BASE64-encoded-JSON-with-notification...",
    "messageId": "14150481888479752",
    "message_id": "14150481888479752",
    "publishTime": "2025-03-05T18:50:21.88Z",
    "publish_time": "2025-03-05T18:50:21.88Z"
  },
  "subscription": "projects/rbm-partner-gcp/subscriptions/rbm-sub"
}

ইভেন্ট পেলোডের AgentLaunchEvent.LaunchState ফিল্ড এজেন্টের নতুন লঞ্চ অবস্থা নির্দেশ করে। সম্ভাব্য মানগুলি এখানে দেওয়া হল:

মূল্য Agent launch state বিস্তারিত
PENDING মুলতুবি অনুরোধটি পর্যালোচনার জন্য একটি ক্যারিয়ারের কাছে পাঠানো হয়েছে।
LAUNCHED চালু হয়েছে Messages are allowed on a given carrier.
REJECTED Rejected on a given carrier প্রত্যাখ্যানের কারণ মন্তব্যে উল্লেখ করা আছে।
SUSPENDED Suspended on a given carrier স্থগিতাদেশের কারণ মন্তব্যে উল্লেখ করা হয়েছে।
UNLAUNCHED Unlaunched সমস্ত ক্যারিয়ার থেকে আনলঞ্চ করা এজেন্টদের জন্য সম্পাদনা অনুমোদিত।

ডেটা ফিল্ডে একটি Base64-এনকোডেড JSON অবজেক্ট রয়েছে যেখানে লঞ্চ স্টেটের বিবরণ রয়েছে। ডিকোডেড JSON এর একটি উদাহরণ এখানে দেওয়া হল:

    {
      "eventId": "rbm-chatbot-id/0a7ed168-676e-4a56-b422-b23434",
      "agentId": "rbm-chatbot-id@rbm.goog",
      "botDisplayName": "RBM Welcome Bot 7 - RBM Chatbot name",
      "brandId": "bd38fbff-392a-437b-a6f2-7f2e43745b56",
      "brandDisplayName": "Chatbots brand",
      "regionId": "/v1/regions/fi-rcs",
      "oldLaunchState": "PENDING",
      "newLaunchState": "REJECTED",
      "actingParty": "rbm-support@google.com",
      "comment": "Carrier has rejected the launch: policy violation",
      "sendTime": "2025-03-05T18:50:19.386436Z"
    }

নিম্নলিখিত টেবিলে এজেন্ট লঞ্চের অবস্থা এবং সেগুলিকে ট্রিগারকারী ক্রিয়াগুলি দেখানো হয়েছে:

Old launch state New launch state Trigger for change
PENDING LAUNCHED Pending agent approved.
PENDING REJECTED Pending agent rejected.
LAUNCHED SUSPENDED Launched agent suspended.
SUSPENDED LAUNCHED Suspended agent reactivated.
SUSPENDED UNLAUNCHED Suspended agent unlaunched.
UNLAUNCHED PENDING নতুন লঞ্চ অনুরোধের জন্য প্রস্তুত আনলঞ্চড এজেন্ট।

Message has expired; revocation succeeded

বার্তাটির মেয়াদ শেষ হয়ে গেছে এবং সফলভাবে প্রত্যাহার করা হয়েছে। এই ইভেন্টটি আপনার ফলব্যাক মেসেজিং কৌশলের জন্য একটি ভালো ট্রিগার হবে।

{
  "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]
}

Message has expired; revocation failed

The message has expired, but it was not revoked.

{
  "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]
}

Message delivery is not guaranteed.

  • যদি বার্তাটি পৌঁছে দেওয়া হয়, তাহলে আপনার ওয়েবহুকে একটি DELIVERED ইভেন্ট পাবেন।
  • যদি বার্তাটি সরবরাহ না করা হয়, তাহলে প্রত্যাহারের অনুরোধ পাঠাতে প্রত্যাহার API ব্যবহার করুন।

যদি বার্তাটি সময়-সংবেদনশীল হয়, যেমন OTP বা জালিয়াতির সতর্কতা, তাহলে SMS-এর মতো বিকল্প চ্যানেলের মাধ্যমে বার্তাটি পাঠানোই ভালো, এমনকি এর ফলে ব্যবহারকারীর কাছে ডুপ্লিকেট বার্তা আসে।

User-generated events

ব্যবহারকারীর বার্তা এবং ক্ষমতা পরীক্ষার মতো, আপনার এজেন্ট ব্যবহারকারীর ইভেন্টগুলি JSON হিসাবে গ্রহণ করে।

বিন্যাস এবং মান বিকল্পগুলির জন্য, UserEvent দেখুন।

User receives agent message

এই ঘটনাটি নির্দেশ করে যে একটি বার্তা পৌঁছে দেওয়া হয়েছে।

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

User reads agent message

এই ঘটনাটি নির্দেশ করে যে একটি বার্তা খোলা হয়েছে বা স্বীকৃত হয়েছে।

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

User starts typing

This event indicates that a user is typing.

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

User sends a text message

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

User sends a file

{
  "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"
}

User taps a suggested reply

যখন একজন ব্যবহারকারী একটি প্রস্তাবিত উত্তরে ট্যাপ করেন, তখন আপনার এজেন্ট উত্তরের পোস্টব্যাক ডেটা এবং টেক্সট সহ একটি ইভেন্ট পান।

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

User taps a suggested action

যখন একজন ব্যবহারকারী একটি প্রস্তাবিত অ্যাকশনে ট্যাপ করেন, তখন আপনার এজেন্ট অ্যাকশনের পোস্টব্যাক ডেটা সহ একটি ইভেন্ট পান।

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

User unsubscribes from the conversation

যদি কোনও ব্যবহারকারী কোনও ব্যবসা থেকে অপ্রয়োজনীয় বার্তা, যেমন প্রচার, পেতে না চান, তাহলে তিনি Google Messages-এ RBM কথোপকথন থেকে সদস্যতা ত্যাগ করতে পারেন।

UNSUBSCRIBE ইভেন্টটি নির্দেশ করে যে ব্যবহারকারী আপনার এজেন্ট এবং তার প্রতিনিধিত্বকারী ব্যবসার সাথে তাদের কথোপকথন থেকে আনসাবস্ক্রাইব করেছেন। এখানে JSON পেলোডের একটি উদাহরণ দেওয়া হল:

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

কিভাবে এটা কাজ করে

  • An Unsubscribe option is always available within the chat menu. For promotional and multi-use agents, this option also appears directly in the chat after a certain number of unread messages (specific rules vary by country).
  • Selecting Unsubscribe triggers two simultaneous actions: Google Messages sends a country-specific keyword (for example, "STOP") to your agent, and the RBM platform sends an UNSUBSCRIBE event to your webhook.

    ব্যবহারকারীর ফোন নম্বরের দুই অক্ষরের দেশের কোড দ্বারা কীওয়ার্ডটি নির্ধারিত হয়। নিম্নলিখিত টেবিলে প্রতিটি সমর্থিত দেশের কীওয়ার্ডগুলি তালিকাভুক্ত করা হয়েছে।

    Country (country code) Unsubscribe keyword
    মার্কিন যুক্তরাষ্ট্র (মার্কিন), ভারত (IN), যুক্তরাজ্য (GB), জার্মানি (DE) STOP
    Spain (ES), Mexico (MX) BAJA
    France (FR) STOP
    Brazil (BR) parar
  • ব্যবহারকারী আনসাবস্ক্রাইব করার পরে, কথোপকথনটি তাদের ইনবক্সে থেকে যায় যদি না স্প্যাম হিসেবে রিপোর্ট করা হয়, এই ক্ষেত্রে এটি স্প্যাম এবং ব্লক করা ফোল্ডারে চলে যায়।

  • নীতি এবং ব্যবসায়িক নিয়ম লঙ্ঘন শনাক্ত করার জন্য, ব্যবহারকারী সদস্যতা ত্যাগ করার পরে Google বার্তার ধরণ পর্যবেক্ষণ করে।

Business rules

  • As the RBM partner who manages this conversation, it's your responsibility to comply with the user's request to unsubscribe.
  • If you can't perform the unsubscription within the message thread, you must immediately send a message of acknowledgement with a direct link to the website or app where users can manage their subscription preferences.
  • ব্যবহারকারী সদস্যতা ত্যাগ করার পর, অপ্রয়োজনীয় বার্তা পাঠানো নিষিদ্ধ।
  • গুরুত্বপূর্ণ বার্তাগুলি এখনও অনুমোদিত। এর মধ্যে রয়েছে:
    • প্রমাণীকরণ, যেমন এককালীন পাসওয়ার্ড (OTP)
    • Notifications about a specific service the user has requested and consented to
    • ব্যবহারকারীর আনসাবস্ক্রাইব অনুরোধের নিশ্চিতকরণ, তাদের যোগাযোগের পছন্দগুলি আরও পরিচালনা করার জন্য তথ্য সহ

উদাহরণ

If a user unsubscribes from an airline agent whose use case is multi-use , you must stop sending marketing messages. However, you may send flight updates if the user has provided explicit consent to receive updates for that specific flight.

Unsubscribe reasons

যখন কোনও ব্যবহারকারী আপনার এজেন্ট থেকে সদস্যতা ত্যাগ করেন, তখন তারা নিম্নলিখিত বিকল্পগুলি থেকে একটি কারণ নির্বাচন করতে পারেন:

  • Not signed up
  • Too many messages
  • No longer interested
  • স্প্যাম
  • অন্যান্য

Currently, unsubscribe reasons are not shared with partners or carriers.

User resubscribes to the conversation

ব্যবহারকারীরা Google Messages-এ পূর্বে আনসাবস্ক্রাইব করা কথোপকথনে পুনরায় সাবস্ক্রাইব করতে পারবেন।

SUBSCRIBE ইভেন্টটি নির্দেশ করে যে একজন ব্যবহারকারী আপনার এজেন্টের কাছ থেকে বার্তা পেতে চান, যার মধ্যে প্রচারের মতো অপ্রয়োজনীয় সামগ্রীও অন্তর্ভুক্ত। এখানে JSON পেলোডের একটি উদাহরণ দেওয়া হল:

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

কিভাবে এটা কাজ করে

  • চ্যাট মেনু এবং ইন-চ্যাট লিঙ্ক উভয় থেকেই একটি সাবস্ক্রাইব বিকল্প পাওয়া যায়, যা ব্যবহারকারীদের এমন একটি কথোপকথনে পুনরায় সাবস্ক্রাইব করতে দেয় যা থেকে তারা আনসাবস্ক্রাইব করেছিলেন।
  • Selecting Subscribe triggers two simultaneous actions: Google Messages sends a country-specific keyword (for example, "START") to your agent, and the RBM platform sends a SUBSCRIBE event to your webhook.

    The specific keyword is determined by the two-letter country code of the user's phone number. The following table lists the keywords for each supported country.

    Country (country code) Subscribe keyword
    মার্কিন যুক্তরাষ্ট্র (মার্কিন), ভারত (IN), যুক্তরাজ্য (GB), জার্মানি (DE) শুরু
    Spain (ES), Mexico (MX) ALTA
    France (FR) Démarrer
    Brazil (BR) começar

Business rules

  • As the RBM partner who manages this conversation, it's your responsibility to comply with the user's request to resubscribe.
  • Resubscription applies to all message types, including non-essential content like promotions.
  • If a user messages your business after unsubscribing, this can be considered a resubscribe request.
  • If a user resubscribes outside the messaging channel (for example, on your website), it's your responsibility as RBM partner to update their status and resume sending messages accordingly.

Agent-generated events

Your agent sends events to simulate human interactions and assure the user that your agent is engaging with their messages. For users, events display as notifications within their conversations.

For formatting and value options, see phones.agentEvents .

Agent sends a READ event

To users, this event appears as a read receipt for a specific message. It lets the user know that the RBM platform delivered their message and the agent is processing it.

The following code sends a READ event for a message with a matching messageId .

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'
}"

নোড.জেএস

// 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);
This code is an excerpt from an RBM sample agent .

জাভা

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");
This code is an excerpt from an RBM sample agent .

পাইথন

# 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)
This code is an excerpt from an RBM sample agent .

সি#

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");
This code is an excerpt from an RBM sample agent .

Agent sends an IS_TYPING event

To users, this event appears as a typing indicator and lets them know that your agent is composing a message. The typing indicator expires after a short time (approximately 20 seconds) or when the user's device receives a new message from your agent. Your agent can send multiple IS_TYPING events to reset the typing indicator's expiration timer.

The following code sends an IS_TYPING event.

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',
}"

নোড.জেএস

// 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!');
});
This code is an excerpt from an RBM sample agent .

জাভা

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");
This code is an excerpt from an RBM sample agent .

পাইথন

# 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')
This code is an excerpt from an RBM sample agent .

সি#

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");
This code is an excerpt from an RBM sample agent .