ক্লায়েন্ট লাইব্রেরি

RBM ক্লায়েন্ট লাইব্রেরি Node.js, C#, Python, বা Java ব্যবহার করে RBM এজেন্ট তৈরি করা সহজ করে।

পূর্বশর্ত

আপনি শুরু করার আগে, আপনাকে নিম্নলিখিত জিনিসগুলি করতে হবে:

সেটআপ

  1. প্রথম এজেন্ট নমুনা ডাউনলোড করুন.

    নোট: ডাউনলোড লিঙ্ক অ্যাক্সেস করতে আপনার RBM Google অ্যাকাউন্ট দিয়ে সাইন ইন করুন

  2. আপনার স্থানীয় মেশিনে ফাইলটি বের করুন।

  3. আপনার RBM শংসাপত্রগুলি কনফিগার করতে README-এর নির্দেশাবলী অনুসরণ করুন৷

বার্তাগুলো প্রেরণ কর

নিম্নলিখিত উদাহরণগুলিতে, rbm_api_helper.js (পাইথনের জন্য ব্যবহার করা হয় না) অনুমান করে যে আপনি যে ফাইলটি থেকে কাজ করছেন সেটি মূল অ্যাপ ফোল্ডারের নীচে একটি ডিরেক্টরি। আপনার প্রকল্পের কনফিগারেশনের উপর নির্ভর করে আপনাকে অবস্থান সামঞ্জস্য করতে হতে পারে।

পরীক্ষক আমন্ত্রণ

আপনি আপনার এজেন্ট চালু না করা পর্যন্ত, এটি শুধুমাত্র আমন্ত্রিত পরীক্ষা ডিভাইসগুলির সাথে যোগাযোগ করতে পারে৷ নিম্নলিখিত কোডটি একটি ক্লায়েন্ট লাইব্রেরি সহ একটি ডিভাইসে একটি পরীক্ষক আমন্ত্রণ পাঠায়।

Node.js

// Reference to RBM API helper
const rbmApiHelper = require('../libs/rbm_api_helper');

// Send the tester invite to the device
rbmApiHelper.sendTesterInvite('+12223334444', function(response) {
   console.log(response);
});
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

জাভা

import com.google.rbm.samples.lib.RbmApiHelper;
…

try {
   // Create an instance of the RBM API helper
   RbmApiHelper rbmApiHelper = new RbmApiHelper();

   // Register the device as a tester
   rbmApiHelper.registerTester("+12223334444");
} catch(Exception e) {
   e.printStackTrace();
}
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

পাইথন

# Reference to RBM Python client helper
from rcs_business_messaging import rbm_service

# Send the tester invite to a device
rbm_service.invite_tester('+12223334444')
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

সি#

using RCSBusinessMessaging;
…

// Create an instance of the RBM API helper
RbmApiHelper rbmApiHelper = new RbmApiHelper(credentialsFileLocation,
                                             projectId);

// Register the device as a tester
rbmApiHelper.RegisterTester("+12223334444");
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

সক্ষমতা পরীক্ষা

আপনার এজেন্ট শুধুমাত্র RCS-সক্ষম ডিভাইসগুলির সাথে যোগাযোগ করতে পারে। আপনি ডিভাইসের সক্ষমতা যাচাই করে একটি ডিভাইস RCS-সক্ষম কিনা তা পরীক্ষা করতে পারেন। নিম্নলিখিত কোডটি একটি ক্লায়েন্ট লাইব্রেরি সহ একটি ডিভাইসের ক্ষমতা পরীক্ষা করে।

Node.js

// Reference to RBM API helper
const rbmApiHelper = require('../libs/rbm_api_helper');

// Send a capability check to the device
rbmApiHelper.checkCapability('+12223334444', function(response) {
   // Print capabilities of the device
   console.log(response);
});
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

জাভা

import com.google.rbm.samples.lib.RbmApiHelper;
…

// Create an instance of the RBM API helper
RbmApiHelper rbmApiHelper = new RbmApiHelper();

// Check the capabilities of the device
boolean capability = rbmApiHelper.getCapability("+12223334444");
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

পাইথন

# Reference to RBM Python client helper
from rcs_business_messaging import rbm_service

# Send the tester invite to a device
response = rbm_service.make_cap_request('+12223334444')
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

সি#

using RCSBusinessMessaging;
…

// Create an instance of the RBM API helper
RbmApiHelper rbmApiHelper = new RbmApiHelper(credentialsFileLocation,
                                             projectId);

// Register the device as a tester
Capabilities capabilities = rbmApiHelper.GetCapability("+12223334444");
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

সহজ বার্তা

একটি সাধারণ বার্তা সম্পূর্ণরূপে পাঠ্য দ্বারা তৈরি করা হয়। নিম্নলিখিত কোডটি একটি ক্লায়েন্ট লাইব্রেরি সহ একটি ডিভাইসে একটি সাধারণ পাঠ্য বার্তা পাঠায়।

Node.js

// Reference to RBM API helper
const rbmApiHelper = require('../libs/rbm_api_helper');

let params = {
   messageText: 'Hello, world!',
   msisdn: '+12223334444',
};

// Send a simple message to the device
rbmApiHelper.sendMessage(params, function(response) {
   console.log(response);
});
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

জাভা

import com.google.rbm.samples.lib.RbmApiHelper;
…

try {
   // Create an instance of the RBM API helper
   RbmApiHelper rbmApiHelper = new RbmApiHelper();

   // Send simple text message to user
   rbmApiHelper.sendTextMessage(
      "Hello, world!",
      "+12223334444"
   );
} catch(Exception e) {
   e.printStackTrace();
}
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

পাইথন

# Reference to RBM Python client helper and messaging object structure
from rcs_business_messaging import rbm_service
from rcs_business_messaging import messages

# Create a simple RBM text message
message_text = messages.TextMessage('Hello, world!')

# Send text message to the device
messages.MessageCluster().append_message(message_text).send_to_msisdn('+12223334444')
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

সি#

using RCSBusinessMessaging;
…

// Create an instance of the RBM API helper
RbmApiHelper rbmApiHelper = new RbmApiHelper(credentialsFileLocation,
                                             projectId);

rbmApiHelper.SendTextMessage(
    "Hello, world!",
    "+12223334444",
);
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

প্রস্তাবিত উত্তর সহ বার্তা

প্রস্তাবিত উত্তরগুলি আপনার এজেন্টের সাথে কথোপকথনের মাধ্যমে ব্যবহারকারীদের গাইড করতে সহায়তা করে। একটি সাধারণ বার্তা প্রস্তাবিত উত্তর এবং কর্মের একটি সংগ্রহ অন্তর্ভুক্ত করতে পারে। নিম্নলিখিত কোডটি একটি ক্লায়েন্ট লাইব্রেরি সহ একটি ডিভাইসে দুটি প্রস্তাবিত উত্তর সহ একটি সাধারণ পাঠ্য বার্তা পাঠায়।

Node.js

// Reference to RBM API helper
const rbmApiHelper = require('../libs/rbm_api_helper');

let suggestions = [
   {
      reply: {
         'text': 'Suggestion #1',
         'postbackData': 'suggestion_1',
      },
   },
   {
      reply: {
         'text': 'Suggestion #2',
         'postbackData': 'suggestion_2',
      },
   },
];

let params = {
   messageText: 'Hello, world!',
   msisdn: '+12223334444',
   suggestions: suggestions,
};

// Send a simple message with suggestion chips to the device
rbmApiHelper.sendMessage(params, function(response) {
   console.log(response);
});
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

জাভা

import com.google.api.services.rcsbusinessmessaging.v1.model.Suggestion;
import com.google.rbm.samples.lib.RbmApiHelper;
import com.google.rbm.samples.lib.SuggestionHelper;
…

try {
   // Create an instance of the RBM API helper
   RbmApiHelper rbmApiHelper = new RbmApiHelper();

   // Create suggestions for chip list
   List<Suggestion> suggestions = new ArrayList<Suggestion>();
   suggestions.add(
      new SuggestionHelper("Suggestion #1", "suggestion_1").getSuggestedReply());

   suggestions.add(
      new SuggestionHelper("Suggestion #2", "suggestion_2").getSuggestedReply());

   // Send simple text message to user
   rbmApiHelper.sendTextMessage(
      "Hello, world!",
      "+12223334444",
      suggestions
   );
} catch(Exception e) {
   e.printStackTrace();
}
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

পাইথন

# Reference to RBM Python client helper and messaging object structure
from rcs_business_messaging import rbm_service
from rcs_business_messaging import messages

# Create text message to send to user
text_msg = messages.TextMessage('Hello, world!')
cluster = messages.MessageCluster().append_message(text_msg)

# Append suggested replies for the message to send to the user
cluster.append_suggestion_chip(messages.SuggestedReply('Suggestion #1', 'reply:suggestion_1'))
cluster.append_suggestion_chip(messages.SuggestedReply('Suggestion #2', 'reply:suggestion_2'))

# Send a simple message with suggestion chips to the device
cluster.send_to_msisdn('+12223334444')
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

সি#

using Google.Apis.RCSBusinessMessaging.v1.Data;
using RCSBusinessMessaging;
…

// Create an instance of the RBM API helper
RbmApiHelper rbmApiHelper = new RbmApiHelper(credentialsFileLocation,
                                             projectId);

List<Suggestion> suggestions = new List<Suggestion>
{
   // Create suggestion chips
   new SuggestionHelper("Suggestion #1", "suggestion_1").SuggestedReply(),
   new SuggestionHelper("Suggestion #2", "suggestion_2").SuggestedReply()
};

// Send simple text message with suggestions to user
rbmApiHelper.SendTextMessage(
    "Hello, world!",
    "+12223334444",
   suggestions
);
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

মিডিয়া বার্তা

নিম্নলিখিত কোডটি একটি ক্লায়েন্ট লাইব্রেরি সহ একটি ডিভাইসে একটি চিত্র বা ভিডিও পাঠায়।

Node.js

// Reference to RBM API helper
const rbmApiHelper = require('../libs/rbm_api_helper');

let params = {
   fileUrl: 'http://www.google.com/logos/doodles/2015/googles-new-logo-5078286822539264.3-hp2x.gif',
   msisdn: '+12223334444',
};

// Send an image/video to a device
rbmApiHelper.sendMessage(params, function(response) {
   console.log(response);
});
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

জাভা

import com.google.api.services.rcsbusinessmessaging.v1.model.AgentContentMessage;
import com.google.api.services.rcsbusinessmessaging.v1.model.AgentMessage;
import com.google.rbm.samples.lib.RbmApiHelper;
…

try {
   // Create an instance of the RBM API helper
   RbmApiHelper rbmApiHelper = new RbmApiHelper();

   String fileUrl = "http://www.google.com/logos/doodles/2015/googles-new-logo-5078286822539264.3-hp2x.gif";

   // create media only message
   AgentContentMessage agentContentMessage = new AgentContentMessage();
   agentContentMessage.setContentInfo(new ContentInfo().setFileUrl(fileUrl));

   // attach content to message
   AgentMessage agentMessage = new AgentMessage();
   agentMessage.setContentMessage(agentContentMessage);

   rbmApiHelper.sendAgentMessage(agentMessage, "+12223334444");
} catch(Exception e) {
   e.printStackTrace();
}
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

পাইথন

# Reference to RBM Python client helper and messaging object structure
from rcs_business_messaging import rbm_service
from rcs_business_messaging import messages

# Create media file attachment
file_message = messages.FileMessage('http://www.google.com/logos/doodles/2015/googles-new-logo-5078286822539264.3-hp2x.gif')

messages.MessageCluster().append_message(file_message).send_to_msisdn('+12223334444')
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

সি#

using Google.Apis.RCSBusinessMessaging.v1.Data;
using RCSBusinessMessaging;
…

// Create an instance of the RBM API helper
RbmApiHelper rbmApiHelper = new RbmApiHelper(credentialsFileLocation,
                                                 projectId);

string fileUrl = "http://www.google.com/logos/doodles/2015/googles-new-logo-5078286822539264.3-hp2x.gif";

// Create content info with the file url
ContentInfo contentInfo = new ContentInfo
{
    FileUrl = fileUrl
};

// Attach content info to a message
AgentContentMessage agentContentMessage = new AgentContentMessage
{
    ContentInfo = contentInfo,
};

// Attach content to message
AgentMessage agentMessage = new AgentMessage
{
    ContentMessage = agentContentMessage
};

rbmApiHelper.SendAgentMessage(agentMessage, "+12223334444");
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

রিচ কার্ড

একটি সমৃদ্ধ কার্ডের মাধ্যমে, আপনি সম্পর্কিত তথ্যের একটি অংশ পাঠাতে পারেন: শিরোনাম, বিবরণ, ছবি এবং 4টি পর্যন্ত প্রস্তাবিত উত্তর বা ক্রিয়া। নিম্নলিখিত কোডটি একটি ক্লায়েন্ট লাইব্রেরি সহ একটি ডিভাইসে একটি রিচকার্ড পাঠায়।

Node.js

// Reference to RBM API helper
const rbmApiHelper = require('../libs/rbm_api_helper');

// Suggested replies to be used in the card
let suggestions = [
   {
      reply: {
         'text': 'Suggestion #1',
         'postbackData': 'suggestion_1',
      },
   },
   {
      reply: {
         'text': 'Suggestion #2',
         'postbackData': 'suggestion_2',
      },
   },
];

// Image to be displayed by the card
let imageUrl = 'http://www.google.com/logos/doodles/2015/googles-new-logo-5078286822539264.3-hp2x.gif';

// Definition of the card parameters
let params = {
   messageText: 'Hello, world!',
   messageDescription: 'RBM is awesome!',
   msisdn: '+12223334444',
   suggestions: suggestions,
   imageUrl: imageUrl,
   height: 'TALL',
};

// Send rich card to device
rbmApiHelper.sendRichCard(params, function(response) {
   console.log(response);
});
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

জাভা

import com.google.api.services.rcsbusinessmessaging.v1.model.StandaloneCard;
import com.google.api.services.rcsbusinessmessaging.v1.model.Suggestion;
import com.google.rbm.samples.lib.cards.CardOrientation;
import com.google.rbm.samples.lib.cards.MediaHeight;
import com.google.rbm.samples.lib.RbmApiHelper;
import com.google.rbm.samples.lib.SuggestionHelper;
…

try {
   // Create an instance of the RBM API helper
   RbmApiHelper rbmApiHelper = new RbmApiHelper();

   // Create suggestions for chip list
   List<Suggestion> suggestions = new ArrayList<Suggestion>();
   suggestions.add(
      new SuggestionHelper("Suggestion #1", "suggestion_1").getSuggestedReply());

   suggestions.add(
      new SuggestionHelper("Suggestion #2", "suggestion_2").getSuggestedReply());

   String imageUrl = "http://www.google.com/logos/doodles/2015/googles-new-logo-5078286822539264.3-hp2x.gif";

   // Create a standalone rich card to send to the user
   StandaloneCard standaloneCard = rbmApiHelper.createStandaloneCard(
       "Hello, world!",
       "RBM is awesome!",
       imageUrl,
       MediaHeight.MEDIUM,
       CardOrientation.VERTICAL,
       suggestions
   );

   rbmApiHelper.sendStandaloneCard(standaloneCard, "+12223334444");
} catch(Exception e) {
   e.printStackTrace();
}
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

পাইথন

# Reference to RBM Python client helper and messaging object structure
from rcs_business_messaging import rbm_service
from rcs_business_messaging import messages

# Suggested replies to be used in the card
suggestions = [
      messages.SuggestedReply('Suggestion #1', 'reply:suggestion_1'),
      messages.SuggestedReply('Suggestion #2', 'reply:suggestion_2')
]

# Image to be displayed by the card
image_url = 'http://www.google.com/logos/doodles/2015/googles-new-logo-5078286822539264.3-hp2x.gif';

# Define rich card structure
rich_card = messages.StandaloneCard('VERTICAL',
                                    'Hello, world!',
                                    'RBM is awesome!',
                                    suggestions,
                                    image_url,
                                    None,
                                    None,
                                    'MEDIUM')

# Append rich card and send to the user
cluster = messages.MessageCluster().append_message(rich_card)
cluster.send_to_msisdn('+12223334444')
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

সি#

using Google.Apis.RCSBusinessMessaging.v1.Data;
using RCSBusinessMessaging;
using RCSBusinessMessaging.Cards;
…

// Create an instance of the RBM API helper
RbmApiHelper rbmApiHelper = new RbmApiHelper(credentialsFileLocation,
                                             projectId);

List<Suggestion> suggestions = new List<Suggestion>
{
   // Create suggestion chips
   new SuggestionHelper("Suggestion #1", "suggestion_1").SuggestedReply(),
   new SuggestionHelper("Suggestion #2", "suggestion_2").SuggestedReply()
};

string imageUrl = "http://www.google.com/logos/doodles/2015/googles-new-logo-5078286822539264.3-hp2x.gif";

// Create rich card with suggestions
StandaloneCard standaloneCard = rbmApiHelper.CreateStandaloneCard(
   "Hello, world!",
   "RBM is awesome",
   imageUrl,
   MediaHeight.TALL,
   CardOrientation.VERTICAL,
   suggestions
);

// Send rich card to user
rbmApiHelper.SendStandaloneCard(standaloneCard, "+12223334444");
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

ক্যারোসেল একাধিক রিচ কার্ড একত্রিত করে যা একজন ব্যবহারকারীকে বিকল্পগুলির তুলনা করতে এবং পৃথকভাবে প্রতিক্রিয়া জানাতে দেয়। নিম্নলিখিত কোডটি একটি ক্লায়েন্ট লাইব্রেরি সহ একটি ডিভাইসে দুটি কার্ড সহ একটি সমৃদ্ধ কার্ড ক্যারোজেল পাঠায়।

Node.js

// Reference to RBM API helper
const rbmApiHelper = require('../libs/rbm_api_helper');

// Images for the carousel cards
let card1Image = 'https://storage.googleapis.com/kitchen-sink-sample-images/cute-dog.jpg';
let card2Image = 'https://storage.googleapis.com/kitchen-sink-sample-images/elephant.jpg';

// Define the card contents for a carousel with two cards, each with one suggested reply
let cardContents = [
   {
      title: 'Card #1',
      description: 'The description for card #1',
      suggestions: [
         {
            reply: {
               text: 'Card #1',
               postbackData: 'card_1',
            }
         }
      ],
      media: {
         height: 'MEDIUM',
         contentInfo: {
            fileUrl: card1Image,
            forceRefresh: false,
         },
      },
   },
   {
      title: 'Card #2',
      description: 'The description for card #2',
      suggestions: [
         {
            reply: {
               text: 'Card #2',
               postbackData: 'card_2',
            }
         }
      ],
      media: {
         height: 'MEDIUM',
         contentInfo: {
            fileUrl: card2Image,
            forceRefresh: false,
         },
      },
   },
];

// Definition of carousel card
let params = {
   msisdn: '+12223334444',
   cardContents: cardContents,
};

// Send the device the carousel card defined above
rbmApiHelper.sendCarouselCard(params, function(response) {
   console.log(response);
});
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

জাভা

import com.google.api.services.rcsbusinessmessaging.v1.model.CardContent;
import com.google.api.services.rcsbusinessmessaging.v1.model.Suggestion;
import com.google.rbm.samples.lib.cards.CardOrientation;
import com.google.rbm.samples.lib.cards.CardWidth;
import com.google.rbm.samples.lib.cards.MediaHeight;
import com.google.rbm.samples.lib.RbmApiHelper;
import com.google.rbm.samples.lib.SuggestionHelper;
…

try {
            // Create an instance of the RBM API helper
            RbmApiHelper rbmApiHelper = new RbmApiHelper();

            List cardContents = new ArrayList();

            // Images for the carousel cards
            String card1Image = "https://storage.googleapis.com/kitchen-sink-sample-images/cute-dog.jpg";

            // Create suggestions for first carousel card
            List card1Suggestions = new ArrayList();
            card1Suggestions.add(
                new SuggestionHelper("Card #1", "card_1"));

            cardContents.add(
                new StandaloneCardHelper(
                    "Card #1",
                    "The description for card #1",
                    card1Image,
                    card1Suggestions)
                    .getCardContent(MediaHeight.SHORT)
            );

            // Images for the carousel cards
            String card2Image = "https://storage.googleapis.com/kitchen-sink-sample-images/elephant.jpg";

            // Create suggestions for second carousel card
            List card2Suggestions = new ArrayList();
            card2Suggestions.add(
                new SuggestionHelper("Card #2", "card_2"));

            cardContents.add(
                new StandaloneCardHelper(
                    "Card #2",
                    "The description for card #2",
                    card2Image,
                    card2Suggestions)
                    .getCardContent(MediaHeight.SHORT)
            );

            // Send the carousel to the user
            rbmApiHelper.sendCarouselCards(cardContents, CardWidth.MEDIUM, "+12223334444");
        } catch(Exception e) {
            e.printStackTrace();
        }
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

পাইথন

# Reference to RBM Python client helper and messaging object structure
from rcs_business_messaging import rbm_service
from rcs_business_messaging import messages

# Images for the carousel cards
card_image_1 = 'https://storage.googleapis.com/kitchen-sink-sample-images/cute-dog.jpg';
card_image_2 = 'https://storage.googleapis.com/kitchen-sink-sample-images/elephant.jpg';

# Suggested replies to be used in the cards
suggestions1 = [
      messages.SuggestedReply('Card #1', 'reply:card_1')
]

suggestions2 = [
      messages.SuggestedReply('Card #2', 'reply:card_2')
]

# Define the card contents for a carousel with two cards,
# each with one suggested reply
card_contents = []
card_contents.append(messages.CardContent('Card #1',
                                          'The description for card #1',
                                          card_image_1,
                                          'MEDIUM',
                                          suggestions1))

card_contents.append(messages.CardContent('Card #2',
                                          'The description for card #2',
                                          card_image_2,
                                          'MEDIUM',
                                          suggestions2))

# Send the device the carousel card defined above
carousel_card = messages.CarouselCard('MEDIUM', card_contents)
cluster = messages.MessageCluster().append_message(carousel_card)
cluster.send_to_msisdn('+12223334444')
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

সি#

using Google.Apis.RCSBusinessMessaging.v1.Data;
using RCSBusinessMessaging;
using RCSBusinessMessaging.Cards;
…

// Create an instance of the RBM API helper
RbmApiHelper rbmApiHelper = new RbmApiHelper(credentialsFileLocation,
                                             projectId);

// Image references to be used in the carousel cards
string card1Image = "https://storage.googleapis.com/kitchen-sink-sample-images/cute-dog.jpg";
string card2Image = "https://storage.googleapis.com/kitchen-sink-sample-images/elephant.jpg";

// Suggestion chip lists to be used in carousel cards
List<Suggestion> suggestions1 = new List<Suggestion>
{
   new SuggestionHelper("Card #1", "card_1").SuggestedReply()
};

List<Suggestion> suggestions2 = new List<Suggestion>
{
   new SuggestionHelper("Card #2", "card_2").SuggestedReply()
};

// Create the card content for the carousel
List<CardContent> cardContents = new List<CardContent>
{
   // Add items as card content
   new StandaloneCardHelper(
                    "Card #1",
                    "The description for card #1",
                    card1Image,
                    suggestions1).GetCardContent(),
   new StandaloneCardHelper(
                    "Card #2",
                    "The description for card #2",
                    card2Image,
                    suggestions2).GetCardContent()
};

// Send the carousel to the user
rbmApiHelper.SendCarouselCards(cardContents, CardWidth.MEDIUM, msisdn);
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

একটি নম্বর ডায়াল করুন

নিম্নলিখিত কোডটি একটি ক্লায়েন্ট লাইব্রেরি সহ একটি ডিভাইসে একটি ডায়াল অ্যাকশন পাঠায়।

Node.js

// Reference to RBM API helper
const rbmApiHelper = require('../libs/rbm_api_helper');

// Define a dial suggested action
let suggestions = [
   {
      action: {
         text: 'Call',
         postbackData: 'postback_data_1234',
         dialAction: {
            phoneNumber: '+15556667777'
         }
      }
   },
];

let params = {
   messageText: 'Hello, world!',
   msisdn: '+12223334444',
   suggestions: suggestions,
};

// Send a simple message with a dial suggested action
rbmApiHelper.sendMessage(params, function(response) {
   console.log(response);
});
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

জাভা

import com.google.api.services.rcsbusinessmessaging.v1.model.DialAction;
import com.google.api.services.rcsbusinessmessaging.v1.model.SuggestedAction;
import com.google.api.services.rcsbusinessmessaging.v1.model.Suggestion;
import com.google.rbm.samples.lib.RbmApiHelper;
…

try {
   // Create an instance of the RBM API helper
   RbmApiHelper rbmApiHelper = new RbmApiHelper();

   // Create suggestions for chip list
   List<Suggestion> suggestions = new ArrayList<Suggestion>();

   // creating a dial suggested action
   DialAction dialAction = new DialAction();
   dialAction.setPhoneNumber("+15556667777");

   // creating a suggested action based on a dial action
   SuggestedAction suggestedAction = new SuggestedAction();
   suggestedAction.setText("Call");
   suggestedAction.setPostbackData("postback_data_1234");
   suggestedAction.setDialAction(dialAction);

   // attaching action to a suggestion
   Suggestion suggestion = new Suggestion();
   suggestion.setAction(suggestedAction);

   suggestions.add(suggestion);

   // Send simple text message with the suggestion action
   rbmApiHelper.sendTextMessage(
      "Hello, world!",
      "+12223334444",
      suggestions
   );
} catch(Exception e) {
   e.printStackTrace();
}
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

পাইথন

# Reference to RBM Python client helper and messaging object structure
from rcs_business_messaging import rbm_service
from rcs_business_messaging import messages

# Create a dial suggested action
suggestions = [
      messages.DialAction('Call', 'reply:postback_data_1234', '+15556667777')
]

# Create text message to send to user
text_msg = messages.TextMessage('Hello, world!')
cluster = messages.MessageCluster().append_message(text_msg)

# Append suggestions for the message to send to the user
for suggestion in suggestions:
    cluster.append_suggestion_chip(suggestion)

# Send a simple message with suggested action to the device
cluster.send_to_msisdn('+12223334444')
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

সি#

using Google.Apis.RCSBusinessMessaging.v1.Data;
using RCSBusinessMessaging;
…

// Create an instance of the RBM API helper
RbmApiHelper rbmApiHelper = new RbmApiHelper(credentialsFileLocation,
                                                 projectId);

// Create a dial an agent suggested action
DialAction dialAction = new DialAction
{
    PhoneNumber = "+15556667777"
};

// Creating a suggested action based on a dial action
SuggestedAction suggestedAction = new SuggestedAction
{
    Text = "Call",
    PostbackData = "postback_data_1234",
    DialAction = dialAction
};

// Attach action to a suggestion
Suggestion suggestion = new Suggestion
{
    Action = suggestedAction
};

List<Suggestion> suggestions = new List<Suggestion>
{
    suggestion
};

rbmApiHelper.SendTextMessage(
    "Hello, world!",
    "+12223334444",
    suggestions
);
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

একটি অবস্থান দেখুন

নিম্নলিখিত কোডটি একটি ক্লায়েন্ট লাইব্রেরি সহ একটি ডিভাইসে একটি ভিউ অবস্থান অ্যাকশন পাঠায়।

Node.js

// Reference to RBM API helper
const rbmApiHelper = require('../libs/rbm_api_helper');

// Define a view location suggested action
let suggestions = [
   {
      action: {
         text: 'View map',
         postbackData: 'postback_data_1234',
         viewLocationAction: {
            latLong: {
               latitude: 37.4220188,
               longitude: -122.0844786
            },
            label: 'Googleplex'
         }
      }
   },
];

let params = {
   messageText: 'Hello, world!',
   msisdn: '+12223334444',
   suggestions: suggestions,
};

// Send a simple message with a view location suggested action
rbmApiHelper.sendMessage(params, function(response) {
   console.log(response);
});
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

জাভা

import com.google.api.services.rcsbusinessmessaging.v1.model.ViewLocationAction;
import com.google.api.services.rcsbusinessmessaging.v1.model.SuggestedAction;
import com.google.api.services.rcsbusinessmessaging.v1.model.Suggestion;
import com.google.rbm.samples.lib.RbmApiHelper;
…

try {
   // Create an instance of the RBM API helper
   RbmApiHelper rbmApiHelper = new RbmApiHelper();

   // Create suggestions for chip list
   List<Suggestion> suggestions = new ArrayList<Suggestion>();

   // creating a view location suggested action
   ViewLocationAction viewLocationAction = new ViewLocationAction();
   viewLocationAction.setQuery("Googleplex, Mountain View, CA");

   // creating a suggested action based on a view location action
   SuggestedAction suggestedAction = new SuggestedAction();
   suggestedAction.setText("View map");
   suggestedAction.setPostbackData("postback_data_1234");
   suggestedAction.setViewLocationAction(viewLocationAction);

   // attaching action to a suggestion
   Suggestion suggestion = new Suggestion();
   suggestion.setAction(suggestedAction);

   suggestions.add(suggestion);

   // Send simple text message with the suggestion action
   rbmApiHelper.sendTextMessage(
      "Hello, world!",
      "+12223334444",
      suggestions
   );
} catch(Exception e) {
   e.printStackTrace();
}
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

পাইথন

# Reference to RBM Python client helper and messaging object structure
from rcs_business_messaging import rbm_service
from rcs_business_messaging import messages

# Create a view location suggested action
suggestions = [
      messages.ViewLocationAction('View map',
            'reply:postback_data_1234',
            query='Googleplex, Mountain View, CA')
]

# Create text message to send to user
text_msg = messages.TextMessage('Hello, world!')
cluster = messages.MessageCluster().append_message(text_msg)

# Append suggestions for the message to send to the user
for suggestion in suggestions:
    cluster.append_suggestion_chip(suggestion)

# Send a simple message with suggested action to the device
cluster.send_to_msisdn('+12223334444')
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

সি#

using Google.Apis.RCSBusinessMessaging.v1.Data;
using RCSBusinessMessaging;
…

// Create an instance of the RBM API helper
RbmApiHelper rbmApiHelper = new RbmApiHelper(credentialsFileLocation,
                                                 projectId);

// create an view location action
ViewLocationAction viewLocationAction = new ViewLocationAction
{
    Query = "Googleplex Mountain View, CA"
};

// Attach the view location action to a suggested action
SuggestedAction suggestedAction = new SuggestedAction
{
    ViewLocationAction = viewLocationAction,
    Text = "View map",
    PostbackData = "postback_data_1234"
};

// Attach the action to a suggestion object
Suggestion suggestion = new Suggestion
{
    Action = suggestedAction
};

List<Suggestion> suggestions = new List<Suggestion>
{
    suggestion
};

rbmApiHelper.SendTextMessage(
    "Hello, world!",
    "+12223334444",
    suggestions
);
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

একটি অবস্থান শেয়ার করুন

নিম্নলিখিত কোডটি একটি ক্লায়েন্ট লাইব্রেরি সহ একটি ডিভাইসে একটি শেয়ার অবস্থান অ্যাকশন পাঠায়৷

Node.js

// Reference to RBM API helper
const rbmApiHelper = require('../libs/rbm_api_helper');

// Define a share location suggested action
let suggestions = [
   {
      action: {
         text: 'Share your location',
         postbackData: 'postback_data_1234',
         shareLocationAction: {
         }
      }
   },
];

let params = {
   messageText: 'Hello, world!',
   msisdn: '+12223334444',
   suggestions: suggestions,
};

// Send a simple message with a share location suggested action
rbmApiHelper.sendMessage(params, function(response) {
   console.log(response);
});
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

জাভা

import com.google.api.services.rcsbusinessmessaging.v1.model.ShareLocationAction;
import com.google.api.services.rcsbusinessmessaging.v1.model.SuggestedAction;
import com.google.api.services.rcsbusinessmessaging.v1.model.Suggestion;
import com.google.rbm.samples.lib.RbmApiHelper;
…

try {
   // Create an instance of the RBM API helper
   RbmApiHelper rbmApiHelper = new RbmApiHelper();

   // Create suggestions for chip list
   List<Suggestion> suggestions = new ArrayList<Suggestion>();

   // creating a share location suggested action
   ShareLocationAction shareLocationAction = new ShareLocationAction();

   // creating a suggested action based on a share location action
   SuggestedAction suggestedAction = new SuggestedAction();
   suggestedAction.setText("Share location");
   suggestedAction.setPostbackData("postback_data_1234");
   suggestedAction.setShareLocationAction(shareLocationAction);

   // attaching action to a suggestion
   Suggestion suggestion = new Suggestion();
   suggestion.setAction(suggestedAction);

   suggestions.add(suggestion);

   // Send simple text message with the suggestion action
   rbmApiHelper.sendTextMessage(
      "Hello, world!",
      "+12223334444",
      suggestions
   );
} catch(Exception e) {
   e.printStackTrace();
}
এই কোডটি একটি RBM নমুনা এজেন্টের একটি উদ্ধৃতি।

পাইথন

# Reference to RBM Python client helper and messaging object structure
from rcs_business_messaging import rbm_service
from rcs_business_messaging import messages

# Create a share location suggested action
suggestions = [
      messages.ShareLocationAction('Share location',
            'reply:postback_data_1234')
]

# Create text message to send to user
text_msg = messages.TextMessage('Hello, world!')
cluster = messages.MessageCluster().append_message(text_msg)

# Append suggestions for the message to send to the user
for suggestion in suggestions:
    cluster.append_suggestion_chip(suggestion)

# Send a simple message with suggested action to the device
cluster.send_to_msisdn('+12223334444')
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

সি#

using Google.Apis.RCSBusinessMessaging.v1.Data;
using RCSBusinessMessaging;
…

// Create an instance of the RBM API helper
RbmApiHelper rbmApiHelper = new RbmApiHelper(credentialsFileLocation,
                                                 projectId);

// Create a share location action
ShareLocationAction shareLocationAction = new ShareLocationAction();

// Attach the share location action to a suggested action
SuggestedAction suggestedAction = new SuggestedAction
{
    ShareLocationAction = shareLocationAction,
    Text = "Share location",
    PostbackData = "postback_data_1234"
};

// Attach the action to a suggestion object
Suggestion suggestion = new Suggestion
{
    Action = suggestedAction
};

List<Suggestion> suggestions = new List<Suggestion>
{
    suggestion
};

rbmApiHelper.SendTextMessage(
    "Hello, world!",
    "+12223334444",
    suggestions
);
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

URL খুলুন

নিম্নলিখিত কোডটি একটি ক্লায়েন্ট লাইব্রেরি সহ একটি ডিভাইসে একটি ওপেন URL অ্যাকশন পাঠায়৷

Node.js

// Reference to RBM API helper
const rbmApiHelper = require('../libs/rbm_api_helper');

// Define an open URL suggested action
let suggestions = [
   {
      action: {
         text: 'Open Google',
         postbackData: 'postback_data_1234',
         openUrlAction: {
            url: 'https://www.google.com'
         }
      }
   },
];

let params = {
   messageText: 'Hello, world!',
   msisdn: '+12223334444',
   suggestions: suggestions,
};

// Send a simple message with an open URL suggested action
rbmApiHelper.sendMessage(params, function(response) {
   console.log(response);
});
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

জাভা


import com.google.api.services.rcsbusinessmessaging.v1.model.OpenUrlAction;
import com.google.api.services.rcsbusinessmessaging.v1.model.SuggestedAction;
import com.google.api.services.rcsbusinessmessaging.v1.model.Suggestion;
import com.google.rbm.samples.lib.RbmApiHelper;
…

try {
   // Create an instance of the RBM API helper
   RbmApiHelper rbmApiHelper = new RbmApiHelper();

   // Create suggestions for chip list
   List<Suggestion> suggestions = new ArrayList<Suggestion>();

   // creating an open url suggested action
   OpenUrlAction openUrlAction = new OpenUrlAction();
   openUrlAction.setUrl("https://www.google.com");

   // creating a suggested action based on an open url action
   SuggestedAction suggestedAction = new SuggestedAction();
   suggestedAction.setText("Open Google");
   suggestedAction.setPostbackData("postback_data_1234");
   suggestedAction.setOpenUrlAction(openUrlAction);

   // attaching action to a suggestion
   Suggestion suggestion = new Suggestion();
   suggestion.setAction(suggestedAction);

   suggestions.add(suggestion);

   // Send simple text message with the suggestion action
   rbmApiHelper.sendTextMessage(
      "Hello, world!",
      "+12223334444",
      suggestions
   );
} catch(Exception e) {
   e.printStackTrace();
}
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

পাইথন

# Reference to RBM Python client helper and messaging object structure
from rcs_business_messaging import rbm_service
from rcs_business_messaging import messages

# Create an open url suggested action
suggestions = [
      messages.OpenUrlAction('Open Google',
            'reply:postback_data_1234',
            'https://www.google.com')
]

# Create text message to send to user
text_msg = messages.TextMessage('Hello, world!')
cluster = messages.MessageCluster().append_message(text_msg)

# Append suggestions for the message to send to the user
for suggestion in suggestions:
    cluster.append_suggestion_chip(suggestion)

# Send a simple message with suggested action to the device
cluster.send_to_msisdn('+12223334444')
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

সি#

using Google.Apis.RCSBusinessMessaging.v1.Data;
using RCSBusinessMessaging;
…

// Create an instance of the RBM API helper
RbmApiHelper rbmApiHelper = new RbmApiHelper(credentialsFileLocation,
                                                 projectId);

// Create an open url action
OpenUrlAction openUrlAction = new OpenUrlAction
{
    Url = "https://www.google.com"
};

// Attach the open url action to a suggested action
SuggestedAction suggestedAction = new SuggestedAction
{
    OpenUrlAction = openUrlAction,
    Text = "Open Google",
    PostbackData = "postback_data_1234"
};

// Attach the action to a suggestion object
Suggestion suggestion = new Suggestion
{
    Action = suggestedAction
};

List<Suggestion> suggestions = new List<Suggestion>
{
    suggestion
};

rbmApiHelper.SendTextMessage(
    "Hello, world!",
    "+12223334444",
    suggestions
);
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

একটি ক্যালেন্ডার ইভেন্ট তৈরি করুন

নিম্নলিখিত কোডটি একটি ক্লায়েন্ট লাইব্রেরি সহ একটি ডিভাইসে একটি ক্যালেন্ডার ইভেন্ট তৈরি করুন অ্যাকশন পাঠায়।

Node.js

// Reference to RBM API helper
const rbmApiHelper = require('../libs/rbm_api_helper');

// Define a create calendar event suggested action
let suggestions = [
   {
      action: {
         text: 'Save to calendar',
         postbackData: 'postback_data_1234',
         createCalendarEventAction: {
            startTime: '2020-06-30T19:00:00Z',
            endTime: '2020-06-30T20:00:00Z',
            title: 'My calendar event',
            description: 'Description of the calendar event',
         },
      }
   },
];

let params = {
   messageText: 'Hello, world!',
   msisdn: '+12223334444',
   suggestions: suggestions,
};

// Send a simple message with a create calendar event suggested action
rbmApiHelper.sendMessage(params, function(response) {
   console.log(response);
});
এই কোডটি একটি RBM নমুনা এজেন্টের একটি উদ্ধৃতি।

জাভা


import com.google.api.services.rcsbusinessmessaging.v1.model.CreateCalendarEventAction;
import com.google.api.services.rcsbusinessmessaging.v1.model.SuggestedAction;
import com.google.api.services.rcsbusinessmessaging.v1.model.Suggestion;
import com.google.rbm.samples.lib.RbmApiHelper;
…

try {
   // Create an instance of the RBM API helper
   RbmApiHelper rbmApiHelper = new RbmApiHelper();

   // Create suggestions for chip list
   List<Suggestion> suggestions = new ArrayList<Suggestion>();

   // creating a create calendar event suggested action
   CreateCalendarEventAction createCalendarEventAction = new CreateCalendarEventAction();
   calendarEventAction.setTitle("My calendar event");
   calendarEventAction.setDescription("Description of the calendar event");
   calendarEventAction.setStartTime("2020-06-30T19:00:00Z");
   calendarEventAction.setEndTime("2020-06-30T20:00:00Z");

   // creating a suggested action based on a create calendar event action
   SuggestedAction suggestedAction = new SuggestedAction();
   suggestedAction.setText("Save to calendar");
   suggestedAction.setPostbackData("postback_data_1234");
   suggestedAction.setCreateCalendarEventAction(createCalendarEventAction);

   // attaching action to a suggestion
   Suggestion suggestion = new Suggestion();
   suggestion.setAction(suggestedAction);

   suggestions.add(suggestion);

   // Send simple text message with the suggestion action
   rbmApiHelper.sendTextMessage(
      "Hello, world!",
      "+12223334444",
      suggestions
   );
} catch(Exception e) {
   e.printStackTrace();
}
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

পাইথন

# Reference to RBM Python client helper and messaging object structure
from rcs_business_messaging import rbm_service
from rcs_business_messaging import messages

# Create a calendar event suggested action
suggestions = [
      messages.CreateCalendarEventAction('Save to Calendar',
                             'reply:postback_data_1234',
                             '2020-06-30T19:00:00Z',
                             '2020-06-30T20:00:00Z',
                             'My calendar event',
                             'Description of the calendar event')

]

# Create text message to send to user
text_msg = messages.TextMessage('Hello, world!')
cluster = messages.MessageCluster().append_message(text_msg)

# Append suggestions for the message to send to the user
for suggestion in suggestions:
    cluster.append_suggestion_chip(suggestion)

# Send a simple message with suggested action to the device
cluster.send_to_msisdn('+12223334444')
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

সি#

using Google.Apis.RCSBusinessMessaging.v1.Data;
using RCSBusinessMessaging;
…

// Create an instance of the RBM API helper
RbmApiHelper rbmApiHelper = new RbmApiHelper(credentialsFileLocation,
                                                 projectId);

// Create a calendar event action
CreateCalendarEventAction calendarEventAction = new CreateCalendarEventAction
{
    Title = "My calendar event",
    Description = "Description of the calendar event",
    StartTime = "2020-06-30T19:00:00Z",
    EndTime = "2020-06-30T20:00:00Z"
};

// Attach the calendar event action to a suggested action
SuggestedAction suggestedAction = new SuggestedAction
{
    CreateCalendarEventAction = calendarEventAction,
    Text = "Save to calendar",
    PostbackData = "postback_data_1234"
};

// Attach the action to a suggestion object
Suggestion suggestion = new Suggestion
{
    Action = suggestedAction
};

List<Suggestion> suggestions = new List<Suggestion>
{
    suggestion
};

rbmApiHelper.SendTextMessage(
    "Hello, world!",
    "+12223334444",
    suggestions
);
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

বার্তা প্রত্যাহার করুন

নিম্নলিখিত উদাহরণে, rbm_api_helper.js (পাইথনের জন্য ব্যবহার করা হয় না) অনুমান করে যে আপনি যে ফাইলটি থেকে কাজ করছেন সেটি মূল অ্যাপ ফোল্ডারের নীচে একটি ডিরেক্টরি। আপনার প্রকল্পের কনফিগারেশনের উপর নির্ভর করে আপনাকে অবস্থান সামঞ্জস্য করতে হতে পারে।

নিম্নলিখিত কোডটি একটি ক্লায়েন্ট লাইব্রেরির সাথে একটি বিদ্যমান, অবিলম্বিত বার্তা প্রত্যাহার করে

Node.js

// Reference to RBM API helper
const rbmApiHelper = require('../libs/rbm_api_helper');

// Stop the message associated with messageId from being delivered
rbmApiHelper.revokeMessage('+12223334444', messageId, function(err, response) {
   console.log(response);
});
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

জাভা

import com.google.rbm.samples.lib.RbmApiHelper;
…

try {
   // Create an instance of the RBM API helper
   RbmApiHelper rbmApiHelper = new RbmApiHelper();

   // Stop the message associated with messageId from being delivered
   rbmApiHelper.revokeMessage(messageId, "+12223334444");
} catch(Exception e) {
   e.printStackTrace();
}
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

পাইথন

# Reference to RBM Python client helper and messaging object structure
from rcs_business_messaging import rbm_service

# Stop the message associated with message_id from being delivered
rbm_service.revoke('+12223334444', message_id)
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

সি#

using RCSBusinessMessaging;
…

// Create an instance of the RBM API helper
RbmApiHelper rbmApiHelper = new RbmApiHelper(credentialsFileLocation,
                                                 projectId);

// Stop the message associated with messageId from being delivered
rbmApiHelper.RevokeMessage(messageId, "+12223334444");
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

ঘটনা পাঠান

নিম্নলিখিত উদাহরণগুলিতে, rbm_api_helper.js (পাইথনের জন্য ব্যবহার করা হয় না) অনুমান করে যে আপনি যে ফাইলটি থেকে কাজ করছেন সেটি মূল অ্যাপ ফোল্ডারের নীচে একটি ডিরেক্টরি। আপনার প্রকল্পের কনফিগারেশনের উপর নির্ভর করে আপনাকে অবস্থান সামঞ্জস্য করতে হতে পারে।

ঘটনা পড়ুন

ইভেন্টগুলি পড়ুন ব্যবহারকারীকে জানান যে এজেন্ট বার্তা পেয়েছেন এবং আত্মবিশ্বাস জাগিয়ে তোলে যে RBM প্ল্যাটফর্ম তাদের বার্তা পৌঁছে দিয়েছে। নিম্নলিখিত কোডটি একটি ক্লায়েন্ট লাইব্রেরি সহ একটি ডিভাইসে একটি পঠিত ইভেন্ট পাঠায়।

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);
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

জাভা

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");
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

পাইথন

# 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 নমুনা এজেন্টের একটি অংশ।

সি#

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('../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!');
});
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

জাভা

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");
এই কোডটি একটি RBM নমুনা এজেন্টের একটি অংশ।

পাইথন

# 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 নমুনা এজেন্টের একটি অংশ।

সি#

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 নমুনা এজেন্টের একটি অংশ।

পরবর্তী পদক্ষেপ

প্ল্যাটফর্ম এবং এটি কী করতে পারে তা জানতে RBM এজেন্টের সেরা অনুশীলন এবং নমুনাগুলি দেখুন।