এজেন্টদের পরিচালনা করুন

সমস্ত এজেন্ট একটি ব্র্যান্ডের (ব্যবসা, সংস্থা বা গোষ্ঠী) অন্তর্গত। একটি এজেন্ট তৈরি করার আগে, একটি মালিকানাধীন ব্র্যান্ড তৈরি করা প্রয়োজন৷ ব্র্যান্ডগুলি আপনাকে একত্রে সম্পর্কিত এজেন্টদের গ্রুপ করতে সহায়তা করার জন্য সম্পূর্ণরূপে সাংগঠনিক

এই পৃষ্ঠার কোড স্নিপেটগুলি জাভা নমুনা এবং Node.js নমুনা থেকে নেওয়া হয়েছে।

একটি এজেন্ট তৈরি করুন

একটি RBM এজেন্ট তৈরি করতে, আপনাকে এর প্রাথমিক তথ্য সংজ্ঞায়িত করতে হবে। আরো বিস্তারিত জানার জন্য, 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);
});

জাভা

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);
});

জাভা

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);
});

জাভা

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);
});

জাভা

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);
});

জাভা

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);
});

জাভা

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 API কল ব্যবহার করে আপনার এজেন্টের জন্য বর্তমান লঞ্চ তথ্য পুনরুদ্ধার করার পরে, আপনি আপনার এজেন্টের নাগাল প্রসারিত করতে আরও টার্গেট ক্যারিয়ার যোগ করতে পারেন। আরো বিস্তারিত জানার জন্য, 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);
});

জাভা

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

একটি এজেন্ট মুছুন

নিরাপত্তার কারণে, RBM এজেন্টদের আর মুছে ফেলা যাবে না। সহায়তার জন্য RBM সহায়তার সাথে যোগাযোগ করুন।