सभी एजेंट किसी ब्रैंड (कारोबार, संगठन या ग्रुप) से जुड़े होते हैं. एजेंट बनाने से पहले, मालिकाना हक वाला ब्रैंड बनाना ज़रूरी है. ब्रैंड पूरी तरह से संगठन के हिसाब से होते हैं, ताकि मिलते-जुलते एजेंट को एक साथ ग्रुप किया जा सके
इस पेज पर दिए गए कोड स्निपेट, Java सैंपल और Node.js सैंपल से लिए गए हैं.
कोई एजेंट बनाएं
आरबीएम एजेंट बनाने के लिए, आपको उसकी बुनियादी जानकारी देनी होगी. ज़्यादा जानकारी के लिए, brands.agents.create
देखें.
Node.js
const businessCommunicationsApiHelper = require('@google/rbm-businesscommunications'); const privateKey = require('../../resources/businesscommunications-service-account-credentials.json'); businessCommunicationsApiHelper.initBusinessCommunucationsApi(privateKey); const newAgentDetails = { displayName: 'My new agent', name: brandId + '/agents/', rcsBusinessMessagingAgent: { description: 'This is the agent description that will be displayed in the Agent info tab in Messages', logoUri: 'https://agent-logos.storage.googleapis.com/_/kt90w53vzw2QSxK6PG1uCeJf', heroUri: 'https://agent-logos.storage.googleapis.com/_/kt90vzob74GQcfeHoEQbVRTP', phoneNumbers: [ { phoneNumber: { number: '+12223334444' }, label: 'Call support' } ], // It's recommended to provide at least one contact method (phone or email) because // this is required for launch. For any phone, email, or website provided, a corresponding label // must also be included. privacy: { "uri": 'https://policies.google.com/privacy', "label": 'Our privacy policy' }, termsConditions: { "uri": 'https://policies.google.com/terms', "label": 'Our Terms and Conditions' }, color: '#0B78D0', billingConfig: { billingCategory: 'BASIC_MESSAGE' }, agentUseCase: 'TRANSACTIONAL', hostingRegion: 'EUROPE' } }; businessCommunicationsApiHelper.createAgent(brandId, newAgentDetails).then((response) => { }).catch((err) => { console.log(err); });
Java
Brand brand = api.getBrand(brandId); logger.info("Brand to operate on: " + brand); String displayName = flags.getOrDefault("agent_name", "Test RBM Agent: " + now.getSecond()); String suffix = flags.getOrDefault("agent_data_suffix", "API"); RcsBusinessMessagingAgent agentData = AgentFactory.createRbmAgent(suffix); Agent agent = api.createRbmAgent(brand, displayName, agentData); logger.info("RBM agent has been created: " + agent);
यह कोड, एजेंट की नई जानकारी और एजेंट को असाइन किया गया यूनीक आइडेंटिफ़ायर दिखाता है:
{
name: 'brands/40bd963f-ff92-425c-b273-8f0892d2d017/agents/my_new_agent_dxuewtvy_agent',
displayName: 'My new agent',
rcsBusinessMessagingAgent: {
description: 'This is the agent description that will be displayed in the Agent info tab in Messages',
logoUri: 'https://agent-logos.storage.googleapis.com/_/kt90w53vzw2QSxK6PG1uCeJf',
heroUri: 'https://agent-logos.storage.googleapis.com/_/kt90vzob74GQcfeHoEQbVRTP',
phoneNumbers: [ [Object] ],
privacy: {
uri: 'https://policies.google.com/privacy',
label: 'Our privacy policy'
},
termsConditions: {
uri: 'https://policies.google.com/terms',
label: 'Our Terms and Conditions'
},
color: '#0B78D0',
billingConfig: { billingCategory: 'BASIC_MESSAGE' },
agentUseCase: 'MULTI_USE',
hostingRegion: 'EUROPE'
}
}
एजेंट की परिभाषा देखना
किसी एजेंट को उसके यूनीक आइडेंटिफ़ायर (name
) की मदद से वापस लाया जा सकता है. ज़्यादा जानकारी के लिए, brands.agents.list
देखें.
Node.js
const businessCommunicationsApiHelper = require('@google/rbm-businesscommunications'); const privateKey = require('../../resources/businesscommunications-service-account-credentials.json'); businessCommunicationsApiHelper.initBusinessCommunucationsApi(privateKey); // Retrieve details of the first agent (if one has already been created) businessCommunicationsApiHelper.getAgent(agent.name).then((response) => { }).catch((err) => { console.log(err); });
Java
Agent agent = api.getAgent(flags.get("agent_id")); logger.info("Agent: " + agent);
यह कोड एजेंट की जानकारी दिखाता है:
{
name: 'brands/40bd963f-ff92-425c-b273-8f0892d2d017/agents/my_new_agent_dxuewtvy_agent',
displayName: 'My new agent',
rcsBusinessMessagingAgent: {
description: 'This is the agent description that will be displayed in the Agent info tab in Messages',
logoUri: 'https://agent-logos.storage.googleapis.com/_/kt90w53vzw2QSxK6PG1uCeJf',
heroUri: 'https://agent-logos.storage.googleapis.com/_/kt90vzob74GQcfeHoEQbVRTP',
phoneNumbers: [ [Object] ],
privacy: {
uri: 'https://policies.google.com/privacy',
label: 'Our privacy policy'
},
termsConditions: {
uri: 'https://policies.google.com/terms',
label: 'Our Terms and Conditions'
},
color: '#0B78D0',
billingConfig: { billingCategory: 'BASIC_MESSAGE' },
agentUseCase: 'MULTI_USE',
hostingRegion: 'EUROPE'
}
}
पुष्टि करने की जानकारी सबमिट करना
एजेंट लॉन्च करने के लिए, ब्रैंड की पुष्टि करना ज़रूरी है. लॉन्च का अनुरोध करने से पहले, आपको पुष्टि करने की जानकारी सबमिट करनी होगी. ध्यान दें कि लॉन्च का अनुरोध करने से पहले, आपको ब्रैंड की मंज़ूरी का इंतज़ार नहीं करना पड़ता. ब्रैंड की मंज़ूरी, लॉन्च की मंज़ूरी की प्रोसेस के तहत मिलती है.
ज़्यादा जानकारी के लिए, brands.agents.requestVerification
देखें.
Node.js
const businessCommunicationsApiHelper = require('@google/rbm-businesscommunications'); const privateKey = require('../../resources/businesscommunications-service-account-credentials.json'); businessCommunicationsApiHelper.initBusinessCommunucationsApi(privateKey); let agentVerificationContact = { partnerName: 'Alice', partnerEmailAddress: 'alice@thepartner.com', brandContactName: 'Bob', brandContactEmailAddress: 'bob@thebrand.com', brandWebsiteUrl: 'https://thebrand.com/' }; businessCommunicationsApiHelper.verifyAgent(agent.name, agentVerificationContact).then((response) => { }).catch((err) => { console.log(err); });
Java
AgentVerificationContact contact = AgentFactory.createRbmAgentVerification(); AgentVerification verification = api.requestAgentVerification(agent.getName(), contact); logger.info("Verification requested: " + verification);
यह कोड, पुष्टि करने से जुड़ी जानकारी दिखाता है:
{
"name": "brands/40bd963f-ff92-425c-b273-8f0892d2d017/agents/my_new_agent_ciymyd2b_agent",
"verificationState": "VERIFICATION_STATE_UNVERIFIED",
"agentVerificationContact": {
"partnerName": "Alice",
"partnerEmailAddress": "alice@thepartner.com",
"brandContactName": "Bob",
"brandContactEmailAddress": "bob@thebrand.com",
"brandWebsiteUrl": "https://thebrand.com/"
}
}
किसी एजेंट की पुष्टि करने के लिए दी गई जानकारी देखना
किसी एजेंट के ब्रैंड की पुष्टि की स्थिति देखी जा सकती है. ज़्यादा जानकारी के लिए,
brands.agents.getVerification
देखें.
Node.js
const businessCommunicationsApiHelper = require('@google/rbm-businesscommunications'); const privateKey = require('../../resources/businesscommunications-service-account-credentials.json'); businessCommunicationsApiHelper.initBusinessCommunucationsApi(privateKey); businessCommunicationsApiHelper.getAgentVerification(agent.name).then((response) => { }).catch((err) => { console.log(err); });
Java
AgentVerification verification = api.getAgentVerification(agent.getName()); logger.info("RBM agent verification: " + verification);
यह कोड, पुष्टि के स्टेटस और पार्टनर की जानकारी दिखाता है:
{
"name": "brands/40bd963f-ff92-425c-b273-8f0892d2d017/agents/my_new_agent_ciymyd2b_agent/verification",
"verificationState": "VERIFICATION_STATE_UNVERIFIED",
"agentVerificationContact": {
"partnerName": "John Doe",
"partnerEmailAddress": "john.doe@gmail.com",
"brandContactName": "Bob",
"brandContactEmailAddress": "bob@brand.com",
"brandWebsiteUrl": "https://www.brand.com"
}
}
लॉन्च के लिए एजेंट सबमिट करना
एक या उससे ज़्यादा कैरियर पर लॉन्च करने के लिए, एजेंट सबमिट किया जा सकता है. कुछ लॉन्च को Google मैनेज करता है और कुछ को मोबाइल और इंटरनेट सेवा देने वाली कंपनियां मैनेज करती हैं. कैरियर के मैनेज किए जाने वाले लॉन्च के लिए, कुछ और ज़रूरी शर्तें हो सकती हैं. ज़्यादा जानकारी के लिए, Google के मैनेज किए गए लॉन्च बनाम कैरियर के मैनेज किए गए लॉन्च देखें.
पहली बार एजेंट लॉन्च करने से पहले, आपको पुष्टि के लिए जानकारी सबमिट करनी होगी. इससे Google, मोबाइल और इंटरनेट सेवा देने वाली कंपनियां या दोनों, आपके ब्रैंड के संपर्क से पुष्टि कर पाएंगे कि आपके पास एजेंट को मैनेज करने का अधिकार है. ज़्यादा जानकारी के लिए, ब्रैंड की पुष्टि देखें.
पुष्टि करने के लिए जानकारी सबमिट करने और लॉन्च से जुड़ी ज़रूरी शर्तें पूरी करने के बाद, लॉन्च का अनुरोध सबमिट किया जा सकता है.
एक या उससे ज़्यादा मोबाइल और इंटरनेट सेवा देने वाली कंपनियों पर लॉन्च करने के लिए, एजेंट सबमिट किया जा सकता है. लॉन्च के अनुरोध के हिस्से के तौर पर, लॉन्च से जुड़े सवालों की सूची को पूरा करना ज़रूरी है. ज़्यादा जानकारी के लिए, brands.agents.requestLaunch
देखें.
Node.js
const businessCommunicationsApiHelper = require('@google/rbm-businesscommunications'); const privateKey = require('../../resources/businesscommunications-service-account-credentials.json'); businessCommunicationsApiHelper.initBusinessCommunucationsApi(privateKey); let agentLaunch = { questionnaire: { contacts: [ { name: 'James Bond', title: 'Mr 0 0 7', email: 'someone@somewhere.com' } ], optinDescription: 'Users accepted our terms of service online.', triggerDescription: 'We are reaching preregistered users', interactionsDescription: 'This agent does not do much.', optoutDescription: 'Reply stop and we stop.', agentAccessInstructions: 'This is a a simple agent that reaches registered users.', videoUris: [ 'https://www.google.com/a/video' ], screenshotUris: [ 'https://www.google.com/a/screenshot' ] }, launchDetails: {} }; businessCommunicationsApiHelper.launchAgent(agent.name, agentLaunch).then((response) => { }).catch((err) => { console.log(err); });
Java
Optional<Questionnaire> q = Optional.of(AgentFactory.createRbmQuestionnaire()); AgentLaunch launch = api.requestRbmAgentLaunch(agent.getName(), regionIds, q); logger.info("RBM agent updated launch: " + launch);
यह कोड, एजेंट लॉन्च की जानकारी दिखाता है:
{
"name": "brands/40bd963f-ff92-425c-b273-8f0892d2d017/agents/my_new_agent_7jo0trhw_agent/launch",
"rcsBusinessMessaging": {
"questionnaire": {
"contacts": [
{
"name": "James Bond",
"title": "Mr O O 7",
"email": "someone@somewhere.com"
}
],
"optinDescription": "Users accepted our terms of service online.",
"triggerDescription": "We are reaching preregistered users",
"interactionsDescription": "This agent does not do much.",
"optoutDescription": "Reply stop and we stop.",
"agentAccessInstructions": "This is a a simple agent that reaches registered users.",
"videoUris": [
"https://www.google.com/a/video"
],
"screenshotUris": [
"https://www.google.com/a/screenshot"
]
},
"launchDetails": {
"/v1/regions/some-carrier": {
"launchState": "LAUNCH_STATE_PENDING",
"updateTime": "2023-02-24T15:02:13.903554Z"
}
},
"launchRegion": "NORTH_AMERICA"
}
}
ध्यान दें कि launchRegion
अब काम नहीं करता. इसे जल्द ही हटा दिया जाएगा.
किसी एजेंट के लॉन्च की स्थिति देखना
किसी एजेंट के लॉन्च की मौजूदा स्थिति देखी जा सकती है. ज़्यादा जानकारी के लिए,
brands.agents.getLaunch
देखें.
Node.js
const businessCommunicationsApiHelper = require('@google/rbm-businesscommunications'); const privateKey = require('../../resources/businesscommunications-service-account-credentials.json'); businessCommunicationsApiHelper.initBusinessCommunucationsApi(privateKey); businessCommunicationsApiHelper.getAgentLaunch(agent.name).then((response) => { }).catch((err) => { console.log(err); });
Java
AgentLaunch launch = api.getAgentLaunch(agent.getName()); logger.info("RBM agent launch: " + launch);
यह कोड, टारगेट की गई हर कैरियर कंपनी के लिए, लॉन्च की जानकारी और लॉन्च का स्टेटस दिखाता है:
{
"name": "brands/40bd963f-ff92-425c-b273-8f0892d2d017/agents/my_new_agent_7jo0trhw_agent/launch",
"rcsBusinessMessaging": {
"questionnaire": {
"contacts": [
{
"name": "James Bond",
"title": "Mr O O 7",
"email": "someone@somewhere.com"
}
],
"optinDescription": "Users accepted our terms of service online.",
"triggerDescription": "We are reaching preregistered users",
"interactionsDescription": "This agent does not do much.",
"optoutDescription": "Reply stop and we stop.",
"agentAccessInstructions": "This is a a simple agent that reaches registered users.",
"videoUris": [
"https://www.google.com/a/video"
],
"screenshotUris": [
"https://www.google.com/a/screenshot"
]
},
"launchDetails": {
"/v1/regions/some-carrier": {
"launchState": "LAUNCH_STATE_PENDING",
"updateTime": "2023-02-24T15:02:13.903554Z"
}
},
"launchRegion": "NORTH_AMERICA"
}
}
ध्यान दें कि launchRegion
अब काम नहीं करता. इसे जल्द ही हटा दिया जाएगा.
एजेंट के लॉन्च में मोबाइल और इंटरनेट सेवा देने वाली अन्य कंपनियां जोड़ना
brands.agents.getLaunch
एपीआई कॉल का इस्तेमाल करके, अपने एजेंट के लिए लॉन्च की मौजूदा जानकारी हासिल करने के बाद, अपने एजेंट की पहुंच बढ़ाने के लिए टारगेट किए गए ज़्यादा कैरियर जोड़े जा सकते हैं. ज़्यादा जानकारी के लिए, brands.agents.updateLaunch
देखें.
Node.js
const businessCommunicationsApiHelper = require('@google/rbm-businesscommunications'); const privateKey = require('../../resources/businesscommunications-service-account-credentials.json'); businessCommunicationsApiHelper.initBusinessCommunucationsApi(privateKey);'); // To launch an agent to further carriers, we need to first obtain the existing // launch information and extend it with the new carrier(s). businessCommunicationsApiHelper.getAgentLaunch(agent.name).then((response) => { let existingLaunch = response.data.rcsBusinessMessaging; // Now we add the new carrier to the existing launch existingLaunch.launchDetails[config.launchCarrier2] = null; // And we submit the launch again businessCommunicationsApiHelper.launchAgent(agent.name, existingLaunch).then((response) => { console.log('Launch details are:'); console.log(JSON.stringify(response.data, null, 2)); }).catch((err) => { console.log(err); }); }).catch((err) => { console.log(err); });
यह कोड, लॉन्च की अपडेट की गई जानकारी दिखाता है:
{
"name": "brands/40bd963f-ff92-425c-b273-8f0892d2d017/agents/my_new_agent_7jo0trhw_agent/launch",
"rcsBusinessMessaging": {
"questionnaire": {
"contacts": [
{
"name": "James Bond",
"title": "Mr O O 7",
"email": "someone@somewhere.com"
}
],
"optinDescription": "Users accepted our terms of service online.",
"triggerDescription": "We are reaching preregistered users",
"interactionsDescription": "This agent does not do much.",
"optoutDescription": "Reply stop and we stop.",
"agentAccessInstructions": "This is a a simple agent that reaches registered users.",
"videoUris": [
"https://www.google.com/a/video"
],
"screenshotUris": [
"https://www.google.com/a/screenshot"
]
},
"launchDetails": {
"/v1/regions/some-carrier": {
"launchState": "LAUNCH_STATE_PENDING",
"updateTime": "2023-02-24T15:02:13.903554Z"
},
"/v1/regions/another-carrier": {
"launchState": "LAUNCH_STATE_PENDING",
"updateTime": "2023-02-24T15:04:50.456552Z"
}
},
"launchRegion": "NORTH_AMERICA"
}
}
किसी ब्रैंड के लिए बनाए गए सभी एजेंट की सूची बनाना
डेवलपर, किसी ब्रैंड के लिए बनाए गए सभी एजेंट की सूची देख सकता है.
ज़्यादा जानकारी के लिए, brands.agents.list
देखें.
Node.js
const businessCommunicationsApiHelper = require('@google/rbm-businesscommunications'); const privateKey = require('../../resources/businesscommunications-service-account-credentials.json'); businessCommunicationsApiHelper.initBusinessCommunucationsApi(privateKey); businessCommunicationsApiHelper.listAgents(brand.name).then((response) => { console.log('Current agents are:'); console.log(response.data); datastore.saveJsonData('agents', response.data.agents); }).catch((err) => { console.log(err); });
Java
Brand brand = api.getBrand(brandId); logger.info("Brand: " + brand); ListAgentsResponse response = api.listAllAgents(brand); List<Agent> agents = response.getAgents().stream() .sorted(Comparator.comparing(Agent::getName)).collect(Collectors.toList()); logger.info(String.format("Found %d agents", response.getAgents().size())); for (Agent agent : agents) { logger.info(String.format("Agent [%s]: '%s'", agent.getName(), agent.getDisplayName())); }
यह कोड, उन सभी एजेंट की सूची दिखाता है जिनका मालिकाना हक ब्रांड के पास है:
{
agents: [
{
name: 'brands/40bd963f-ff92-425c-b273-8f0892d2d017/agents/my_new_agent_4fpd1psz_agent',
displayName: 'My new agent',
rcsBusinessMessagingAgent: [Object]
},
{
name: 'brands/40bd963f-ff92-425c-b273-8f0892d2d017/agents/my_new_agent_ciymyd2b_agent',
displayName: 'My second agent',
rcsBusinessMessagingAgent: [Object]
},
{
name: 'brands/40bd963f-ff92-425c-b273-8f0892d2d017/agents/my_new_agent_helof85o_agent',
displayName: 'My third agent',
rcsBusinessMessagingAgent: [Object]
}
]
}
एजेंट मिटाना
सुरक्षा की वजहों से, आरबीएम एजेंट अब मिटाए नहीं जा सकते. मदद पाने के लिए, आरबीएम सहायता टीम से संपर्क करें.