ব্র্যান্ড পরিচালনা করার জন্য এজেন্ট তৈরি করুন, ব্র্যান্ড পরিচালনা করার জন্য এজেন্ট তৈরি করুন, ব্র্যান্ড পরিচালনা করার জন্য এজেন্ট তৈরি করুন

আপনি একটি অংশীদার হিসাবে নিবন্ধন করার পরে, আপনি যে ব্র্যান্ডগুলি পরিচালনা করেন তাদের জন্য ব্যবসা বার্তা এজেন্ট তৈরি করে কথোপকথন সক্ষম করতে পারেন৷

একজন এজেন্ট হল একটি কথোপকথনমূলক সত্তা যার সাথে ব্যবহারকারীরা ইন্টারঅ্যাক্ট করেন। আপনার পরিচালনা করা প্রতিটি ব্র্যান্ডের জন্য আপনি একটি এজেন্ট তৈরি করেন। আপনি বিজনেস কমিউনিকেশন এপিআই এর মাধ্যমে এজেন্ট তৈরি ও পরিচালনা করেন এবং আপনি ব্যবসা বার্তা এপিআই এর মাধ্যমে আপনার এজেন্টদের মেসেজিং নিয়ন্ত্রণ করেন।

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

এজেন্ট/ব্র্যান্ড সম্পর্ক

উদাহরণস্বরূপ, আপনি যদি গ্রোয়িং ট্রি ব্যাঙ্ক ব্র্যান্ড পরিচালনা করেন, যার একটি ওয়েবসাইট এবং দুটি অবস্থান রয়েছে, আপনি একটি একক "গ্রোয়িং ট্রি ব্যাঙ্ক" এজেন্ট তৈরি করেন৷ ব্যবহারকারীরা সাধারণ বা অবস্থান-ভিত্তিক অনুসন্ধানের মাধ্যমে এজেন্টের মুখোমুখি হতে পারেন এবং ব্যবহারকারী যে প্রেক্ষাপটে এজেন্টটিকে খুঁজে পেয়েছেন তা প্রতিটি বার্তার সাথে আপনার ওয়েবহুকে পাঠানো হয়েছে। আপনি সেই প্রসঙ্গটি ব্যবহার করে বার্তাটি হয় একটি অবস্থানের কর্মীদের কাছে বা ওয়েবসাইট সহায়তা দলের কাছে পাঠান, যারা একটি প্রতিক্রিয়া তৈরি করে এবং ব্যবহারকারীর সাথে কথোপকথন চালিয়ে যায়।

প্রত্যাশা

আপনি একটি এজেন্ট তৈরি করার আগে, বিজনেস মেসেজে এজেন্টদের প্রত্যাশা বুঝে নিন।

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

একটি এজেন্ট তৈরি করতে, আপনাকে ব্র্যান্ড সম্পর্কে তথ্য সংগ্রহ করতে হবে এবং জমা দিতে হবে এবং আপনি কীভাবে এজেন্টকে ব্যবহারকারীদের কাছে উপস্থিত করতে চান।

আপনি যদি একাধিক ব্র্যান্ড পরিচালনা করেন, প্রতিটি ব্র্যান্ডের জন্য একটি এজেন্ট তৈরি করার পদক্ষেপগুলি পুনরাবৃত্তি করুন৷

পূর্বশর্ত

আপনি পরিচালনা করেন এমন ব্র্যান্ডগুলির জন্য এজেন্ট তৈরি করার আগে, আপনাকে কিছু তথ্য সংগ্রহ করতে হবে:

উন্নয়ন পরিবেশ

আপনার উন্নয়ন পরিবেশ সম্পর্কে তথ্য.

ব্র্যান্ডের বিবরণ

এজেন্ট যে ব্র্যান্ডের প্রতিনিধিত্ব করে সে সম্পর্কে তথ্য।

  • ব্র্যান্ড নাম
  • ব্র্যান্ড ওয়েবসাইট
  • ওয়েবসাইটে যোগাযোগের বিকল্পগুলি ( OPTION সংজ্ঞায়িত করা হয়েছে)
  • ভোক্তা-মুখী ফোন নম্বর
  • কল ডিফ্লেকশনের জন্য ফোন নম্বর সক্রিয় করা হয়েছে

এজেন্ট চেহারা এবং নীতি

এজেন্ট ব্যবহারকারীদের কাছে কীভাবে উপস্থিত হয় এবং এটি কীভাবে কাজ করে সে সম্পর্কে তথ্য।

  • এজেন্টের নাম, যেমন আপনি ব্যবহারকারীদের সাথে কথোপকথনে প্রদর্শিত হতে চান
  • গোপনীয়তা নীতি, "https://" দিয়ে শুরু হওয়া একটি সর্বজনীনভাবে উপলব্ধ URL হিসাবে
  • (প্রস্তাবিত) এজেন্ট লোগো (1024x1024 px), একটি সর্বজনীনভাবে উপলব্ধ URL হিসাবে

    একটি কথোপকথনে, লোগোগুলি 1024 পিক্সেল ব্যাসের বৃত্ত হিসাবে প্রদর্শিত হয়৷ নিশ্চিত করুন যে আপনার লোগোটি একটি বৃত্তের মতো ভালভাবে প্রদর্শিত হয়।

    ব্যবহারকারীদের কাছে এটি কেমন হবে তা দেখতে আপনার লোগোটির জন্য একটি URL লিখুন৷

  • (ঐচ্ছিক) কাস্টম এজেন্ট আইডি, যা ওয়েবহুক প্রাপ্ত বার্তাগুলিতে ব্র্যান্ডটিকে সনাক্ত করে

এজেন্ট মিথস্ক্রিয়া

আপনার এজেন্ট ব্যবহারকারীদের সাথে কীভাবে যোগাযোগ করে সে সম্পর্কে তথ্য।

  • আপনার এজেন্ট সাধারণত যে লোকেলে কাজ করে, একটি দুই-অক্ষরের ISO 639-1 ভাষা কোড দ্বারা নির্দিষ্ট করা হয়

  • এজেন্ট স্বাগত বার্তা

    ব্যবহারকারীদের শুভেচ্ছা জানাতে এজেন্ট কী বলে?

  • এজেন্ট কথোপকথন শুরু

    পরামর্শের একটি তালিকা, কথোপকথনের চিপ আকারে (যেমন SuggestedReply তে সংজ্ঞায়িত করা হয়েছে), ব্যবহারকারীকে এজেন্টের সাথে জড়িত করার জন্য

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

    • দৈনিক শুরুর সময়, TimeOfDay অবজেক্ট হিসাবে

      উদাহরণস্বরূপ, 8:15 AM হল

      {
        "hours": 8,
        "minutes": 15,
      }
      
    • দৈনিক শেষ সময়, একটি TimeOfDay অবজেক্ট হিসাবে

      উদাহরণস্বরূপ, 7:30 PM হল

      {
        "hours": 19,
        "minutes": 30,
      }
      
    • শুরুর দিন, সপ্তাহের প্রথম দিন এজেন্ট চ্যাটের জন্য উপলব্ধ থাকে (যেমন DayOfWeek -এ সংজ্ঞায়িত করা হয়েছে)

    • শেষের দিন, সপ্তাহের শেষ দিন এজেন্ট চ্যাটের জন্য উপলব্ধ থাকে (যেমন DayOfWeek সংজ্ঞায়িত করা হয়েছে)

    • এজেন্ট যে সময় অঞ্চলে কাজ করে ( IANA টাইম জোন ডেটাবেসে যেমন সংজ্ঞায়িত করা হয়েছে, উদাহরণস্বরূপ "America/Los_Angeles")

এজেন্ট এন্ট্রি পয়েন্ট

ব্যবহারকারীরা কোথায় এজেন্টের সাথে কথোপকথন শুরু করতে পারে সে সম্পর্কে তথ্য।

  • অনুমোদিত এজেন্ট এন্ট্রি পয়েন্ট , যেখানে ব্যবহারকারীরা এজেন্টদের সাথে কথোপকথন শুরু করতে পারে ( NON_LOCAL এবং/অথবা LOCATION )

NON_LOCAL এন্ট্রি পয়েন্ট সম্পর্কে তথ্য ( Google Ads এন্ট্রি পয়েন্টে প্রযোজ্য নয়)।

  • NON_LOCAL এন্ট্রি পয়েন্টগুলিতে আঞ্চলিক অ্যাক্সেস সীমাবদ্ধ করার জন্য অনুমোদিত অঞ্চলগুলি ( CLDR অঞ্চল কোড হিসাবে)৷

    অঞ্চল নির্বিশেষে, একজন এজেন্টের সাথে শুধুমাত্র একটি ফোন নম্বর যুক্ত থাকতে পারে। আপনার যদি অঞ্চলের উপর ভিত্তি করে একটি আলাদা ফোন নম্বরের প্রয়োজন হয় তবে প্রতিটি অঞ্চলের জন্য একটি আলাদা এজেন্ট তৈরি করতে হবে।

    সমস্ত উপলব্ধ অঞ্চলে NON_LOCAL এন্ট্রি পয়েন্টগুলি সক্ষম করতে, বিশ্ব অঞ্চল কোডের জন্য 001 ব্যবহার করুন৷

oauth2l ইনস্টল এবং পরীক্ষা করুন

এই সাইটের ডকুমেন্টেশনে সমস্ত কার্ল অনুরোধ প্রমাণীকরণের জন্য oauth2l ব্যবহার করে। আপনি যদি বিজনেস কমিউনিকেশনস এবং বিজনেস মেসেজ API-এর সাথে সংযোগ করতে কমান্ড লাইন ব্যবহার করতে চান তাহলে oauth2l ইনস্টল করুন।

পাইথন 3 এর সাথে oauth2l ইনস্টল করতে,

  1. oauth2l ডাউনলোড করুন।

  2. ডিরেক্টরিকে "./oauth2l/python" এ পরিবর্তন করুন।

  3. নিম্নলিখিত কমান্ড দিয়ে oauth2l ইনস্টল করুন।

    sudo python setup.sh build && sudo python setup.py install
    
  4. পরীক্ষা করুন যে oauth2l একটি অনুমোদন টোকেন তৈরি করতে পারে।

    oauth2l header --json resources/bm-agent-service-account-credentials.json businesscommunications
  5. যাচাই করুন যে আউটপুট ফর্মের একটি অনুমোদন টোকেন তৈরি করে:

    Authorization: Bearer AUTHORIZATION_BEARER_TOKEN
    

বিভিন্ন অপারেটিং সিস্টেমের জন্য oauth2l ইনস্টল করার অন্যান্য উপায় আছে। আপনার ইনস্টলেশন পদ্ধতি নির্বিশেষে, আপনি এগিয়ে যাওয়ার আগে পরিষেবা অ্যাকাউন্ট JSON শংসাপত্রের উপর ভিত্তি করে একটি অনুমোদন টোকেন তৈরি করতে পারেন তা নিশ্চিত করুন।

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

একবার আপনি আপনার তথ্য সংগ্রহ করলে, আপনার এজেন্ট তৈরি করার সময় এসেছে।

  1. এজেন্ট প্রতিনিধিত্ব করে এমন ব্র্যান্ড তৈরি করুন। যদি ব্র্যান্ডটি ইতিমধ্যেই বিদ্যমান থাকে, ব্র্যান্ডের name পান এবং পরবর্তী ধাপে যান।

    একটি টার্মিনালে, নিম্নলিখিত কমান্ডটি চালান:

    # This code creates a brand.
    # Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/brands/create
    
    # Make sure a service account key file exists at ./service_account_key.json
    
    curl -X POST "https://businesscommunications.googleapis.com/v1/brands" \
    -H "Content-Type: application/json" \
    -H "User-Agent: curl/business-communications" \
    -H "$(oauth2l header --json ./service_account_key.json businesscommunications)" \
    -d '{
      "displayName": "My first brand curl"
    }'
    /**
     * This code snippet creates a brand.
     * Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/brands/create
     *
     * This code is based on the https://github.com/google-business-communications/nodejs-businesscommunications Node.js
     * Business Communications client library.
     */
    
    /**
     * Edit the values below:
     */
    const PATH_TO_SERVICE_ACCOUNT_KEY = './service_account_key.json';
    
    const businesscommunications = require('businesscommunications');
    const {google} = require('googleapis');
    
    // Initialize the Business Communications API
    const bcApi = new businesscommunications.businesscommunications_v1.Businesscommunications({});
    
    // Set the scope that we need for the Business Communications API
    const scopes = [
      'https://www.googleapis.com/auth/businesscommunications',
    ];
    
    // Set the private key to the service account file
    const privatekey = require(PATH_TO_SERVICE_ACCOUNT_KEY);
    
    async function main() {
      const authClient = await initCredentials();
    
      if (authClient) {
        // Setup the parameters for the API call
        const apiParams = {
          auth: authClient,
          resource: {
            displayName: 'My first brand',
          },
        };
    
        bcApi.brands.create(apiParams, {}, (err, response) => {
          if (err !== undefined && err !== null) {
            console.dir(err);
          } else {
            // Brand created
            console.log(response.data);
          }
        });
      }
      else {
        console.log('Authentication failure.');
      }
    }
    
    /**
     * Initializes the Google credentials for calling the
     * Business Communcations API.
     */
     async function initCredentials() {
      // configure a JWT auth client
      const authClient = new google.auth.JWT(
        privatekey.client_email,
        null,
        privatekey.private_key,
        scopes,
      );
    
      return new Promise(function(resolve, reject) {
        // authenticate request
        authClient.authorize(function(err, tokens) {
          if (err) {
            reject('Failed to connect');
          } else {
            resolve(authClient);
          }
        });
      })
    }
    
    main();
    import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
    import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
    import com.google.api.client.http.HttpTransport;
    import com.google.api.client.json.jackson2.JacksonFactory;
    import com.google.api.services.businesscommunications.v1.BusinessCommunications;
    import com.google.api.services.businesscommunications.v1.model.Brand;
    import java.io.FileInputStream;
    import java.util.Arrays;
    import java.util.UUID;
    
    class Main {
      /**
       * Initializes credentials used by the Business Communications API.
       */
      private static BusinessCommunications.Builder getBusinessCommunicationsBuilder() {
        BusinessCommunications.Builder builder = null;
        try {
          GoogleCredential credential = GoogleCredential
                .fromStream(new FileInputStream("PATH_TO_SERVICE_ACCOUNT_KEY"));
    
          credential = credential.createScoped(Arrays.asList(
              "https://www.googleapis.com/auth/businesscommunications"));
    
          credential.refreshToken();
    
          HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport();
          JacksonFactory jsonFactory = JacksonFactory.getDefaultInstance();
    
          // Create instance of the Business Communications API
          builder = new BusinessCommunications
              .Builder(httpTransport, jsonFactory, null)
              .setApplicationName(credential.getServiceAccountProjectId());
    
          // Set the API credentials and endpoint
          builder.setHttpRequestInitializer(credential);
        } catch (Exception e) {
          e.printStackTrace();
        }
    
        return builder;
      }
    
      public static void main(String args[]) {
        try {
          // Create client library reference
          BusinessCommunications.Builder builder = getBusinessCommunicationsBuilder();
    
          // Create a request to create a new brand
          BusinessCommunications.Brands.Create request = builder
              .build().brands().create(new Brand().setDisplayName("BRAND_NAME"));
    
          Brand brand = request.execute();
    
          // Print newly created brand object
          System.out.println(brand.toPrettyString());
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
    }
    এই কোডটি জাভা বিজনেস কমিউনিকেশনস ক্লায়েন্ট লাইব্রেরির উপর ভিত্তি করে।
    """This code creates a brand.
    
    Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/brands/create
    
    This code is based on the https://github.com/google-business-communications/python-businessmessages
    Python Business Messages client library.
    """
    
    from oauth2client.service_account import ServiceAccountCredentials
    from businesscommunications.businesscommunications_v1_client import BusinesscommunicationsV1
    from businesscommunications.businesscommunications_v1_messages import (
        Brand)
    
    # Edit the values below:
    SCOPES = ['https://www.googleapis.com/auth/businesscommunications']
    SERVICE_ACCOUNT_FILE = './service_account_key.json'
    
    credentials = ServiceAccountCredentials.from_json_keyfile_name(
        SERVICE_ACCOUNT_FILE, scopes=SCOPES)
    
    client = BusinesscommunicationsV1(credentials=credentials)
    
    brands_service = BusinesscommunicationsV1.BrandsService(client)
    
    brand = brands_service.Create(Brand(displayName='My first brand'))
    
    print(brand)

    API ফেরত দেওয়া name মান সংরক্ষণ করুন। আপডেট করতে বা এজেন্ট তৈরি করতে আপনার এটির প্রয়োজন হবে।

    ব্র্যান্ডগুলি আপডেট করতে বা দেখতে, brands দেখুন৷

  2. এজেন্ট তৈরি করুন। ব্র্যান্ডের name মানের অংশ দিয়ে BRAND_ID প্রতিস্থাপন করুন যা "brands/" অনুসরণ করে। উদাহরণস্বরূপ, যদি name "brands/12345" হয়, তাহলে ব্র্যান্ড আইডি হবে "12345"।

    একটি টার্মিনালে, নিম্নলিখিত কমান্ডটি চালান:

    # This code creates a Business Messages agent.
    # Read more: https://developers.google.com/business-communications/business-messages/guides/how-to/agents?method=api#create_the_agent
    
    # Replace the __BRAND_ID__ with a brand id that you can create agents for
    # Make sure a service account key file exists at ./service_account_key.json
    
    curl -X POST "https://businesscommunications.googleapis.com/v1/brands/__BRAND_ID__/agents" \
    -H "Content-Type: application/json" \
    -H "User-Agent: curl/business-communications" \
    -H "$(oauth2l header --json ./service_account_key.json businesscommunications)" \
    -d '{
      "displayName": "My first agent",
      "businessMessagesAgent": {
        "logoUrl": "https://developers.google.com/identity/images/g-logo.png",
        "entryPointConfigs": [
          {
            "allowedEntryPoint": "NON_LOCAL"
          }
        ],
        "customAgentId": "'$(uuidgen)'",
        "nonLocalConfig": {
          "regionCodes": [
            "US",
            "CA"
          ],
          "contactOption": {
            "url": "https://www.your-company-website.com",
            "options": [
              "EMAIL",
              "PHONE"
            ]
          },
          "enabledDomains": [
            "your-company-website.com"
          ],
          "phoneNumber": {
            "number": "+10000000000"
          },
          "callDeflectionPhoneNumbers": [
            {
              "number": "+10000000000"
            },
            {
              "number": "+10000000000"
            }
          ]
        },
        "conversationalSettings": {
          "en": {
            "welcomeMessage": {
              "text": "This is a sample welcome message"
            },
            "privacyPolicy": {
              "url": "https://www.your-company-website.com/privacy"
            },
            "conversationStarters": [
              {
                "suggestion": {
                  "reply": {
                    "text": "Option 1",
                    "postbackData": "postback_option_1"
                  }
                }
              }
            ]
          }
        },
        "defaultLocale": "en",
        "primaryAgentInteraction": {
          "interactionType": "HUMAN",
          "humanRepresentative": {
            "humanMessagingAvailability": {
              "hours": [
                {
                  "startTime": {
                    "hours": 8,
                    "minutes": 30
                  },
                  "endTime": {
                    "hours": 20,
                    "minutes": 0
                  },
                  "timeZone": "America/Los_Angeles",
                  "startDay": "MONDAY",
                  "endDay": "SATURDAY"
                }
              ]
            }
          }
        }
      }
    }'
    /**
     * This code snippet creates a Business Messages agent.
     * Read more: https://developers.google.com/business-communications/business-messages/guides/how-to/agents?method=api#create_the_agent
     *
     * This code is based on the https://github.com/google-business-communications/nodejs-businesscommunications Node.js
     * Business Communications client library.
     */
    
    /**
     * Edit the values below:
     */
    const BRAND_ID = 'EDIT_HERE';
    const PATH_TO_SERVICE_ACCOUNT_KEY = './service_account_key.json';
    
    const businesscommunications = require('businesscommunications');
    const {google} = require('googleapis');
    const uuidv4 = require('uuid').v4;
    
    // Initialize the Business Communications API
    const bcApi = new businesscommunications.businesscommunications_v1.Businesscommunications({});
    
    // Set the scope that we need for the Business Communications API
    const scopes = [
      'https://www.googleapis.com/auth/businesscommunications',
    ];
    
    // Set the private key to the service account file
    const privatekey = require(PATH_TO_SERVICE_ACCOUNT_KEY);
    
    async function main() {
      const authClient = await initCredentials();
      const brandName = 'brands/' + BRAND_ID;
    
      if (authClient) {
        const agentObject = {
          displayName: 'My first agent',
          businessMessagesAgent: {
            customAgentId: uuidv4(), // Optional
            logoUrl: 'https://developers.google.com/identity/images/g-logo.png',
            entryPointConfigs: [
              {
                allowedEntryPoint: 'NON_LOCAL',
              }
            ],
            nonLocalConfig: { // Configuration options for launching on non-local entry points
              // List of phone numbers for call deflection, values must be globally unique
              callDeflectionPhoneNumbers: [
                { number: '+10000000000' },
                { number: '+10000000001' },
              ],
              // Contact information for the agent that displays with the messaging button
              contactOption: {
                options: [
                  'EMAIL',
                  'PHONE'
                ],
                url: 'https://www.your-company-website.com',
              },
              // Domains enabled for messaging within Search, values must be globally unique
              enabledDomains: [ 'your-company-website.com' ],
              // Agent's phone number. Overrides the `phone` field
              // for conversations started from non-local entry points
              phoneNumber: { number: '+10000000000' },
              // List of CLDR region codes for countries where the agent is allowed to launch `NON_LOCAL` entry points
              regionCodes: [ 'US', 'CA' ]
            },
            // Must match a conversational setting locale
            defaultLocale: 'en',
            conversationalSettings: {
              en: {
                privacyPolicy: { url: 'https://www.your-company-website.com/privacy' },
                welcomeMessage: { text: 'This is a sample welcome message' },
                conversationStarters: [
                  {
                    suggestion: {
                      reply: {
                        text: 'Option 1',
                        postbackData: 'postback_option_1',
                      },
                    },
                  },
                ],
              },
            },
            primaryAgentInteraction: {
              interactionType: 'HUMAN',
              humanRepresentative: {
                humanMessagingAvailability: {
                  hours: [
                    {
                      startTime: {
                        hours: 8,
                        minutes: 30
                      },
                      startDay: 'MONDAY',
                      endDay: 'SATURDAY',
                      endTime: {
                        hours: 20,
                        minutes: 0
                      },
                      timeZone: 'America/Los_Angeles',
                    },
                  ],
                },
              },
            },
          },
        };
    
        // Setup the parameters for the API call
        const apiParams = {
          auth: authClient,
          parent: brandName,
          resource: agentObject
        };
    
        bcApi.brands.agents.create(apiParams, {}, (err, response) => {
          if (err !== undefined && err !== null) {
            console.dir(err);
          } else {
            // Agent created
            console.log(response.data);
          }
        });
      }
      else {
        console.log('Authentication failure.');
      }
    }
    
    /**
     * Initializes the Google credentials for calling the
     * Business Messages API.
     */
     async function initCredentials() {
      // Configure a JWT auth client
      const authClient = new google.auth.JWT(
        privatekey.client_email,
        null,
        privatekey.private_key,
        scopes,
      );
    
      return new Promise(function(resolve, reject) {
        // Authenticate request
        authClient.authorize(function(err, tokens) {
          if (err) {
            reject(false);
          } else {
            resolve(authClient);
          }
        });
      });
    }
    
    main();

    import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
    import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
    import com.google.api.client.http.HttpTransport;
    import com.google.api.client.json.jackson2.JacksonFactory;
    import com.google.api.services.businesscommunications.v1.BusinessCommunications;
    import com.google.api.services.businesscommunications.v1.model.Brand;
    import com.google.common.collect.ImmutableMap;
    import java.io.FileInputStream;
    import java.util.Arrays;
    import java.util.UUID;
    
    class Main {
      /**
       * Initializes credentials used by the Business Communications API.
       */
      private static BusinessCommunications.Builder getBusinessCommunicationsBuilder() {
        BusinessCommunications.Builder builder = null;
        try {
          GoogleCredential credential = GoogleCredential
                .fromStream(new FileInputStream("PATH_TO_SERVICE_ACCOUNT_KEY"));
    
          credential = credential.createScoped(Arrays.asList(
              "https://www.googleapis.com/auth/businesscommunications"));
    
          credential.refreshToken();
    
          HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport();
          JacksonFactory jsonFactory = JacksonFactory.getDefaultInstance();
    
          // Create instance of the Business Communications API
          builder = new BusinessCommunications
              .Builder(httpTransport, jsonFactory, null)
              .setApplicationName(credential.getServiceAccountProjectId());
    
          // Set the API credentials and endpoint
          builder.setHttpRequestInitializer(credential);
        } catch (Exception e) {
          e.printStackTrace();
        }
    
        return builder;
      }
    
      public static void main(String args[]) {
        try {
          // Create client library reference
          BusinessCommunications.Builder builder = getBusinessCommunicationsBuilder();
    
          String brandName = "BRAND_ID";
    
          BusinessCommunications.Brands.Agents.Create request = builder
              .build().brands().agents().create(brandName,
                  new Agent()
                      .setDisplayName("AGENT_NAME")
                      .setBusinessMessagesAgent(new BusinessMessagesAgent()
                          .setCustomAgentId("CUSTOM_ID") // Optional
                          .setLogoUrl("LOGO_URL")
                          .setEntryPointConfigs(Arrays.asList(
                            new BusinessMessagesEntryPointConfig()
                                .setAllowedEntryPoint(
                                    "ENTRY_POINT_1"),
                            new BusinessMessagesEntryPointConfig()
                                .setAllowedEntryPoint(
                                    "ENTRY_POINT_2")
                          ))
                          // Configuration options for launching on non-local entry points
                          .setNonLocalConfig(new NonLocalConfig()
                            // List of phone numbers for call deflection, values must be globally unique
                            .setCallDeflectionPhoneNumbers(Arrays.asList(new Phone().setNumber("DEFLECTION_PHONE_NUMBER_1"),
                                new Phone().setNumber("DEFLECTION_PHONE_NUMBER_2")))
                            // Contact information for the agent that displays with the messaging button
                            .setContactOption(new ContactOption().setOptions(Arrays.asList(
                                "CONTACT_OPTION_1",
                                "CONTACT_OPTION_2")
                            ).setUrl("WEBSITE_URL"))
                            // Domains enabled for messaging within Search, values must be globally unique
                            .setEnabledDomains(Arrays.asList("ENABLED_DOMAIN_1", "ENABLED_DOMAIN_2"))
                            // Agent's phone number. Overrides the `phone` field for
                            // conversations started from non-local entry points
                            .setPhoneNumber(new Phone().setNumber("CONTACT_PHONE_NUMBER"))
                            // List of regions where this agent will be available
                            .setRegionCodes(Arrays.asList("REGION_CODE")))
                          .setDefaultLocale("LOCALE")
                          // Create a map between the language code and the initial conversation settings
                          .setConversationalSettings(ImmutableMap.of("LOCALE",
                            new ConversationalSetting()
                                .setPrivacyPolicy(new PrivacyPolicy().setUrl("PRIVACY_POLICY_URL"))
                                .setWelcomeMessage(new WelcomeMessage().setText("WELCOME_MESSAGE"))
                                .setConversationStarters(Arrays.asList(
                                    new ConversationStarters().setSuggestion(new Suggestion()
                                        .setReply(new SuggestedReply().setText("SUGGESTION_TEXT").setPostbackData("SUGGESTION_POSTBACK_DATA")))
                                ))))
                          .setPrimaryAgentInteraction(new SupportedAgentInteraction()
                              .setInteractionType(InteractionType.HUMAN.toString())
                              .setHumanRepresentative(new HumanRepresentative()
                                  .setHumanMessagingAvailability(new MessagingAvailability()
                                      // Create a list of available hours
                                      .setHours(Arrays.asList(new Hours()
                                        .setStartTime(new TimeOfDay().setHours(START_TIME_HOURS).setMinutes(START_TIME_MINUTES))
                                        .setStartDay("BEGINNING_DAY_OF_WEEK")
                                        .setEndDay("END_DAY_OF_WEEK")
                                        .setEndTime(new TimeOfDay().setHours(END_TIME_HOURS).setMinutes(END_TIME_MINUTES))
                                        .setTimeZone("TIME_ZONE"))))))
    
                      ));
    
          Agent agent = request.execute();
    
          System.out.println(agent.toPrettyString());
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
    }
    এই কোডটি জাভা বিজনেস কমিউনিকেশনস ক্লায়েন্ট লাইব্রেরির উপর ভিত্তি করে।

    """This code creates a Business Messages agent.
    
    Read more: https://developers.google.com/business-communications/business-messages/guides/how-to/agents?method=api#create_the_agent
    
    This code is based on the https://github.com/google-business-communications/python-businessmessages
    Python Business Messages client library.
    """
    
    from oauth2client.service_account import ServiceAccountCredentials
    from businesscommunications.businesscommunications_v1_client import BusinesscommunicationsV1
    from businesscommunications.businesscommunications_v1_messages import (
        Agent, BusinesscommunicationsBrandsAgentsCreateRequest,
        BusinessMessagesAgent, BusinessMessagesEntryPointConfig,
        ContactOption, ConversationalSetting, ConversationStarters,
        Hours, HumanRepresentative, MessagingAvailability,
        NonLocalConfig, Phone, PrivacyPolicy, Suggestion,
        SuggestedReply, SupportedAgentInteraction,
        TimeOfDay, WelcomeMessage
    )
    
    # Edit the values below:
    BRAND_ID = 'EDIT_HERE'
    SCOPES = ['https://www.googleapis.com/auth/businesscommunications']
    SERVICE_ACCOUNT_FILE = './service_account_key.json'
    
    credentials = ServiceAccountCredentials.from_json_keyfile_name(
        SERVICE_ACCOUNT_FILE, scopes=SCOPES)
    
    client = BusinesscommunicationsV1(credentials=credentials)
    
    agents_service = BusinesscommunicationsV1.BrandsAgentsService(client)
    
    brand_name = 'brands/ '+ BRAND_ID
    
    agent = Agent(
        displayName='My first agent',
        businessMessagesAgent=BusinessMessagesAgent(
            customAgentId='CUSTOM_ID', # Optional
            logoUrl='https://developers.google.com/identity/images/g-logo.png',
            entryPointConfigs=[BusinessMessagesEntryPointConfig(
                allowedEntryPoint=BusinessMessagesEntryPointConfig.AllowedEntryPointValueValuesEnum.LOCATION
            ), BusinessMessagesEntryPointConfig(
                allowedEntryPoint=BusinessMessagesEntryPointConfig.AllowedEntryPointValueValuesEnum.NON_LOCAL
            )],
            nonLocalConfig=NonLocalConfig(
                # List of phone numbers for call deflection, values must be globally unique
                # Generating a random phone number for demonstration purposes
                # This should be replaced with a real brand phone number
                callDeflectionPhoneNumbers=[Phone(number='+10000000000'),
                  Phone(number='+10000000001')],
                # Contact information for the agent that displays with the messaging button
                contactOption=ContactOption(
                        options=[ContactOption.OptionsValueListEntryValuesEnum.EMAIL,
                            ContactOption.OptionsValueListEntryValuesEnum.PHONE],
                        url='https://www.your-company-website.com'
                    ),
                # Domains enabled for messaging within Search, values must be globally unique
                # Generating a random URL for demonstration purposes
                # This should be replaced with a real brand URL
                enabledDomains=['your-company-website.com'],
                # Agent's phone number. Overrides the `phone` field for conversations started from non-local entry points
                phoneNumber=Phone(number='+10000000000'),
                # List of CLDR region codes for countries where the agent is allowed to launch `NON_LOCAL` entry points.
                # Example is for launching in Canada and the USA
                regionCodes=['US', 'CA']
            ),
            defaultLocale='en',
            conversationalSettings=BusinessMessagesAgent.ConversationalSettingsValue(
                additionalProperties=[BusinessMessagesAgent.ConversationalSettingsValue.AdditionalProperty(
                    key='en',
                    value=ConversationalSetting(
                        privacyPolicy=PrivacyPolicy(url='https://www.your-company-website.com/privacy'),
                        welcomeMessage=WelcomeMessage(text='This is a sample welcome message'),
                        conversationStarters=[
                            ConversationStarters(
                                suggestion=Suggestion(
                                    reply=SuggestedReply(text='Option 1',
                                                         postbackData='postback_option_1')
                                )
                            )
                        ]
                    )
                )]
            ),
            primaryAgentInteraction=SupportedAgentInteraction(
                interactionType=SupportedAgentInteraction.InteractionTypeValueValuesEnum.HUMAN,
                humanRepresentative=HumanRepresentative(
                    humanMessagingAvailability=MessagingAvailability(hours=[
                            Hours(
                                startTime=TimeOfDay(hours=8, minutes=30),
                                startDay=Hours.StartDayValueValuesEnum.MONDAY,
                                endDay=Hours.EndDayValueValuesEnum.SATURDAY,
                                endTime=TimeOfDay(hours=20, minutes=0),
                                timeZone='America/Los_Angeles'
                            )
                        ])
                )
            ),
        )
    )
    
    new_agent = agents_service.Create(
        BusinesscommunicationsBrandsAgentsCreateRequest(
            agent=agent,
            parent=brand_name
        )
    )
    
    print(new_agent)

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

  3. যদি ব্র্যান্ডের অবস্থান থাকে যা আপনি আপনার এজেন্টের সাথে যুক্ত করতে চান, তাহলে অবস্থান যোগ করুন দেখুন।

উদাহরণ: গ্রোয়িং ট্রি ব্যাঙ্কের জন্য একটি এজেন্ট তৈরি করুন

curl -X POST "https://businesscommunications.googleapis.com/v1/brands" \
-H "Content-Type: application/json" \
-H "User-Agent: curl/business-communications" \
-H "$(oauth2l header --json /path/to/service/account/key.json businesscommunications)" \
-d "{
    'displayName': 'Growing Tree Bank'
}"

# Fetch returned brand name value of "brands/12345"

curl -X POST "https://businesscommunications.googleapis.com/v1/brands/12345/agents" \
-H "Content-Type: application/json" \
-H "User-Agent: curl/business-communications" \
-H "$(oauth2l header --json /path/to/service/account/key.json businesscommunications)" \
-d "{
    'displayName': 'Growing Tree Bank',
    'businessMessagesAgent': {
        'logoUrl': 'https://www.growingtreebank.com/images/logo.png',
        'entryPointConfigs': [
          {
            'allowedEntryPoint': 'NON_LOCAL',
          },
          {
            'allowedEntryPoint': 'LOCATION',
          },
        ],
        'customAgentId': 'growing-tree-bank',
        'nonLocalConfig': {
            'regionCodes': ['001'],
            'contactOption': {
                'url': 'https://www.growingtreebank.com',
                'options': [
                    'EMAIL',
                    'PHONE',
                ],
            },
            'enabledDomains': [
                'https://www.growingtreebank.com',
            ],
            'phoneNumber': {
                'number': '+12223334444',
            },
            'callDeflectionPhoneNumbers': [
                {
                    'number': '+12223334444',
                },
                {
                    'number': '+56667778888',
                },
            ],
        },
        'conversationalSettings': {
            'en': {
                'welcomeMessage': {
                    'text': 'Thanks for contacting Growing Tree Bank. What can I help with today?',
                },
                'privacyPolicy': {
                    'url': 'https://www.growingtreebank.com/privacy',
                },
                'conversationStarters': [
                    {
                        'suggestion': {
                            'reply': {
                                'text': 'Set up an account',
                                'postbackData': 'new-account',
                            },
                        },
                    },
                ],
            },
        },
        'defaultLocale': 'en',
        'primaryAgentInteraction': {
            'interactionType': 'BOT',
            'botRepresentative': {
                'botMessagingAvailability': {
                    'hours': [
                        {
                            'startTime': {
                                'hours': '8',
                                'minutes': '00',
                            },
                            'endTime': {
                                'hours': '17',
                                'minutes': '30',
                            },
                            'timeZone': 'America/Los_Angeles',
                            'startDay': 'MONDAY',
                            'endDay': 'FRIDAY',
                        },
                    ],
                },
            },
        },
    },
}"

গুরুত্বপূর্ণ তথ্য সংরক্ষণ করুন

যখন আপনি একটি এজেন্ট তৈরি করেন, তখন বিজনেস কমিউনিকেশন এপিআই name এবং testUrls সহ আপনার এজেন্টের মান প্রদান করে।

একটি এজেন্ট-স্তরের ওয়েবহুক সেট করুন

আপনি আপনার ওয়েবহুকে আপনার এজেন্টকে পাঠানো বার্তা পাবেন। আপনি যদি চান যে কোনও নির্দিষ্ট এজেন্টের বার্তাগুলি অন্য ওয়েবহুকে পৌঁছাতে, তাহলে আপনি একটি এজেন্ট-স্তরের ওয়েবহুক সেট করতে পারেন।

একটি এজেন্ট-স্তরের ওয়েবহুক সেট করতে, বিকাশকারী কনসোল ব্যবহার করুন৷

একটি এজেন্ট পরীক্ষা করুন

প্রতিটি এজেন্টের পরীক্ষার URL রয়েছে যা আপনাকে দেখতে দেয় যে সেই এজেন্টের সাথে কথোপকথন ব্যবহারকারীদের কাছে কীভাবে উপস্থিত হয় এবং আপনাকে আপনার মেসেজিং পরিকাঠামো যাচাই করার সুযোগ দেয়।

একটি TestUrl এর url এবং surface বৈশিষ্ট্য আছে। একটি iOS ডিভাইস দিয়ে পরীক্ষা করতে, SURFACE_IOS_MAPS এর পৃষ্ঠের মান সহ পরীক্ষার URL ব্যবহার করুন। Google Maps অ্যাপ ইনস্টল করা iOS ডিভাইসে URL খুললে এজেন্টের সাথে একটি সম্পূর্ণ কার্যকরী কথোপকথন খুলে যায়।

অ্যান্ড্রয়েড ডিভাইস দুটি পরীক্ষা URL আছে. SURFACE_ANDROID_MAPS এর surface ভ্যালু সহ ইউআরএলগুলি Google ম্যাপে কথোপকথন খুলে দেয় এবং কথোপকথনমূলক এন্ট্রি পয়েন্টগুলিকে উপস্থাপন করে যা Google মানচিত্রে প্রদর্শিত হয়। SURFACE_ANDROID_WEB এর surface ভ্যালু সহ ইউআরএলগুলি একটি ওভারলে কথোপকথনমূলক দৃশ্যে কথোপকথন খোলে এবং অন্যান্য সমস্ত এন্ট্রি পয়েন্টগুলিকে উপস্থাপন করে।

একবার কথোপকথন সারফেস খোলে, কথোপকথনে সমস্ত ব্র্যান্ডিং তথ্য অন্তর্ভুক্ত থাকে যা ব্যবহারকারীরা দেখতে পাবেন এবং আপনি যখন এজেন্টকে একটি বার্তা পাঠান, তখন আপনার ওয়েবহুক বার্তাটি গ্রহণ করে , যার মধ্যে সম্পূর্ণ JSON পেলোড আপনি ব্যবহারকারীদের সাথে যোগাযোগ করার সময় আশা করতে পারেন৷

একটি এজেন্টের পরীক্ষার URL খুলতে, একটি লিঙ্কে আলতো চাপুন বা একটি মোবাইল ডিভাইসে ব্যবসা বার্তা এজেন্ট লঞ্চার ব্যবহার করুন৷

এজেন্ট তথ্য পান

একটি এজেন্ট সম্পর্কে তথ্য পেতে, যেমন agentTestUrl , আপনি বিজনেস কমিউনিকেশন API থেকে তথ্য পেতে পারেন, যতক্ষণ না আপনার কাছে এজেন্টের name মান থাকে।

একক এজেন্টের জন্য তথ্য পান

এজেন্ট তথ্য পেতে, নিম্নলিখিত কমান্ড চালান। এজেন্টের name অনন্য মান দিয়ে BRAND_ID এবং AGENT_ID প্রতিস্থাপন করুন।

# This code gets the agent.
# Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/brands.agents/get

# Replace the __BRAND_ID__ and __AGENT_ID__
# Make sure a service account key file exists at ./service_account_key.json

curl -X GET \
"https://businesscommunications.googleapis.com/v1/brands/__BRAND_ID__/agents/__AGENT_ID__" \
-H "Content-Type: application/json" \
-H "User-Agent: curl/business-communications" \
-H "$(oauth2l header --json ./service_account_key.json businesscommunications)"
/**
 * This code snippet gets an agent.
 * Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/brands.agents/get
 *
 * This code is based on the https://github.com/google-business-communications/nodejs-businesscommunications Node.js
 * Business Communications client library.
 */

/**
 * Edit the values below:
 */
const BRAND_ID = 'EDIT_HERE';
const AGENT_ID = 'EDIT_HERE';
const PATH_TO_SERVICE_ACCOUNT_KEY = './service_account_key.json';

const businesscommunications = require('businesscommunications');
const {google} = require('googleapis');

// Initialize the Business Communications API
const bcApi = new businesscommunications.businesscommunications_v1.Businesscommunications({});

// Set the scope that we need for the Business Communications API
const scopes = [
  'https://www.googleapis.com/auth/businesscommunications',
];

// Set the private key to the service account file
const privatekey = require(PATH_TO_SERVICE_ACCOUNT_KEY);

async function main() {
  const authClient = await initCredentials();

  const agentName = 'brands/' + BRAND_ID + '/agents/' + AGENT_ID;

  if (authClient) {
    // Setup the parameters for the API call
    const apiParams = {
      auth: authClient,
      name: agentName,
    };

    bcApi.brands.agents.get(apiParams, {}, (err, response) => {
      if (err !== undefined && err !== null) {
        console.dir(err);
      } else {
        // Agent found
        console.log(response.data);
      }
    });
  }
  else {
    console.log('Authentication failure.');
  }
}

/**
 * Initializes the Google credentials for calling the
 * Business Messages API.
 */
 async function initCredentials() {
  // Configure a JWT auth client
  const authClient = new google.auth.JWT(
    privatekey.client_email,
    null,
    privatekey.private_key,
    scopes,
  );

  return new Promise(function(resolve, reject) {
    // Authenticate request
    authClient.authorize(function(err, tokens) {
      if (err) {
        reject(false);
      } else {
        resolve(authClient);
      }
    });
  });
}

main();
import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.services.businesscommunications.v1.BusinessCommunications;
import com.google.api.services.businesscommunications.v1.model.Agent;
import java.io.FileInputStream;
import java.util.Arrays;

class Main {
  /**
   * Initializes credentials used by the Business Communications API.
   */
  private static BusinessCommunications.Builder getBusinessCommunicationsBuilder() {
    BusinessCommunications.Builder builder = null;
    try {
      GoogleCredential credential = GoogleCredential
            .fromStream(new FileInputStream("PATH_TO_SERVICE_ACCOUNT_KEY"));

      credential = credential.createScoped(Arrays.asList(
          "https://www.googleapis.com/auth/businesscommunications"));

      credential.refreshToken();

      HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport();
      JacksonFactory jsonFactory = JacksonFactory.getDefaultInstance();

      // Create instance of the Business Communications API
      builder = new BusinessCommunications
          .Builder(httpTransport, jsonFactory, null)
          .setApplicationName(credential.getServiceAccountProjectId());

      // Set the API credentials and endpoint
      builder.setHttpRequestInitializer(credential);
    } catch (Exception e) {
      e.printStackTrace();
    }

    return builder;
  }

  public static void main(String args[]) {
    try {
      // Create client library reference
      BusinessCommunications.Builder builder = getBusinessCommunicationsBuilder();

      String agentName = "brands/BRAND_ID/agents/AGENT_ID";

      BusinessCommunications.Brands.Agents.Get request = builder
        .build().brands().agents().get(agentName);

      Agent agent = request.execute();

      System.out.println(agent.toPrettyString());
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}
এই কোডটি জাভা বিজনেস কমিউনিকেশনস ক্লায়েন্ট লাইব্রেরির উপর ভিত্তি করে।
"""This code gets the agent.

Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/brands.agents/get

This code is based on the https://github.com/google-business-communications/python-businessmessages
Python Business Messages client library.
"""

from oauth2client.service_account import ServiceAccountCredentials
from businesscommunications.businesscommunications_v1_client import BusinesscommunicationsV1
from businesscommunications.businesscommunications_v1_messages import (
    Agent,
    BusinesscommunicationsBrandsAgentsGetRequest,
)

# Edit the values below:
BRAND_ID = 'EDIT_HERE'
AGENT_ID = 'EDIT_HERE'
SCOPES = ['https://www.googleapis.com/auth/businesscommunications']
SERVICE_ACCOUNT_FILE = './service_account_key.json'

credentials = ServiceAccountCredentials.from_json_keyfile_name(
    SERVICE_ACCOUNT_FILE, scopes=SCOPES)

client = BusinesscommunicationsV1(credentials=credentials)

agents_service = BusinesscommunicationsV1.BrandsAgentsService(client)

agent_name = 'brands/' + BRAND_ID + '/agents/' + AGENT_ID

agent = agents_service.Get(BusinesscommunicationsBrandsAgentsGetRequest(
        name=agent_name
    ))

print(agent)

একটি ব্র্যান্ডের জন্য সমস্ত এজেন্টদের তালিকা করুন

আপনি যদি এজেন্টের name না জানেন, তাহলে আপনি একটি GET অনুরোধ URL থেকে AGENT_ID মান বাদ দিয়ে একটি ব্র্যান্ডের সাথে যুক্ত সমস্ত এজেন্টের তথ্য পেতে পারেন৷

# This code lists all agents from a brand.
# Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/brands.agents/list

# Replace the __BRAND_ID__
# Make sure a service account key file exists at ./service_account_key.json

curl -X GET \
"https://businesscommunications.googleapis.com/v1/brands/__BRAND_ID__/agents/" \
-H "Content-Type: application/json" \
-H "User-Agent: curl/business-communications" \
-H "$(oauth2l header --json ./service_account_key.json businesscommunications)"
/**
 * This code snippet lists the agents of a brand.
 * Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/brands.agents/list
 *
 * This code is based on the https://github.com/google-business-communications/nodejs-businesscommunications Node.js
 * Business Communications client library.
 */

/**
 * Edit the values below:
 */
const BRAND_ID = 'EDIT_HERE';
const PATH_TO_SERVICE_ACCOUNT_KEY = './service_account_key.json';

const businesscommunications = require('businesscommunications');
const {google} = require('googleapis');

// Initialize the Business Communications API
const bcApi = new businesscommunications.businesscommunications_v1.Businesscommunications({});

// Set the scope that we need for the Business Communications API
const scopes = [
  'https://www.googleapis.com/auth/businesscommunications',
];

// Set the private key to the service account file
const privatekey = require(PATH_TO_SERVICE_ACCOUNT_KEY);

async function main() {
  const authClient = await initCredentials();

  const brandName = 'brands/' + BRAND_ID;

  if (authClient) {
    // Setup the parameters for the API call
    const apiParams = {
      auth: authClient,
      parent: brandName,
    };

    bcApi.brands.agents.list(apiParams, {}, (err, response) => {
      if (err !== undefined && err !== null) {
        console.dir(err);
      } else {
        // Agent found
        console.log(response.data);
      }
    });
  }
  else {
    console.log('Authentication failure.');
  }
}

/**
 * Initializes the Google credentials for calling the
 * Business Messages API.
 */
 async function initCredentials() {
  // Configure a JWT auth client
  const authClient = new google.auth.JWT(
    privatekey.client_email,
    null,
    privatekey.private_key,
    scopes,
  );

  return new Promise(function(resolve, reject) {
    // Authenticate request
    authClient.authorize(function(err, tokens) {
      if (err) {
        reject(false);
      } else {
        resolve(authClient);
      }
    });
  });
}

main();
import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.services.businesscommunications.v1.BusinessCommunications;
import com.google.api.services.businesscommunications.v1.model.Agent;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;

class Main {
  /**
   * Initializes credentials used by the Business Communications API.
   */
  private static BusinessCommunications.Builder getBusinessCommunicationsBuilder() {
    BusinessCommunications.Builder builder = null;
    try {
      GoogleCredential credential = GoogleCredential
            .fromStream(new FileInputStream("PATH_TO_SERVICE_ACCOUNT_KEY"));

      credential = credential.createScoped(Arrays.asList(
          "https://www.googleapis.com/auth/businesscommunications"));

      credential.refreshToken();

      HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport();
      JacksonFactory jsonFactory = JacksonFactory.getDefaultInstance();

      // Create instance of the Business Communications API
      builder = new BusinessCommunications
          .Builder(httpTransport, jsonFactory, null)
          .setApplicationName(credential.getServiceAccountProjectId());

      // Set the API credentials and endpoint
      builder.setHttpRequestInitializer(credential);
    } catch (Exception e) {
      e.printStackTrace();
    }

    return builder;
  }

  public static void main(String args[]) {
    try {
      // Create client library reference
      BusinessCommunications.Builder builder = getBusinessCommunicationsBuilder();

      String brandName = "brands/BRAND_ID";

      BusinessCommunications.Brands.Agents.List request = builder
          .build().brands().agents().list(brandName);

      List agents = request.execute().getAgents();
      agents.stream().forEach(agent -> {
        try {
          System.out.println(agent.toPrettyString());
        } catch (IOException e) {
          e.printStackTrace();
        }
      });
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}
এই কোডটি জাভা বিজনেস কমিউনিকেশনস ক্লায়েন্ট লাইব্রেরির উপর ভিত্তি করে।
"""This code lists all agents from a brand.

Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/brands.agents/list

This code is based on the https://github.com/google-business-communications/python-businessmessages
Python Business Messages client library.
"""

from oauth2client.service_account import ServiceAccountCredentials
from businesscommunications.businesscommunications_v1_client import BusinesscommunicationsV1
from businesscommunications.businesscommunications_v1_messages import (
    Agent,
    BusinesscommunicationsBrandsAgentsGetRequest,
)

# Edit the values below:
BRAND_ID = 'EDIT_HERE'
SCOPES = ['https://www.googleapis.com/auth/businesscommunications']
SERVICE_ACCOUNT_FILE = './service_account_key.json'

credentials = ServiceAccountCredentials.from_json_keyfile_name(
    SERVICE_ACCOUNT_FILE, scopes=SCOPES)

client = BusinesscommunicationsV1(credentials=credentials)

agents_service = BusinesscommunicationsV1.BrandsAgentsService(client)

brand_name = 'brands/' + BRAND_ID

agents = agents_service.List(BusinesscommunicationsBrandsAgentsListRequest(
        parent=brand_name
    ))

print(agents)

এজেন্ট তথ্য আপডেট করুন

একটি এজেন্ট আপডেট করার জন্য, আপনি বিজনেস কমিউনিকেশন এপিআই-এর সাথে একটি প্যাচ অনুরোধ করেন। আপনি যখন API কল করেন, তখন আপনি "updateMask" URL প্যারামিটারের মান হিসাবে সম্পাদনা করছেন এমন ক্ষেত্রগুলির নাম অন্তর্ভুক্ত করেন।

উদাহরণস্বরূপ, আপনি যদি displayName এবং customAgentId ক্ষেত্রগুলি আপডেট করেন তবে "updateMask" URL প্যারামিটারটি হল "updateMask=displayName,businessMessagesAgent.customAgentId"।

বিন্যাস এবং মান বিকল্পের জন্য, brands.agents.patch দেখুন।

আপনি যদি একজন এজেন্টের name না জানেন তবে একটি ব্র্যান্ডের জন্য সমস্ত এজেন্টদের তালিকা দেখুন৷

আপনি একটি এজেন্ট যাচাই করার পরে, আপনি শুধুমাত্র নিম্নলিখিত ক্ষেত্র আপডেট করতে পারেন:

  • conversationalSetting

  • customAgentId

  • defaultLocale

  • primaryAgentInteraction

  • additionalAgentInteractions

  • phone

আপনার এজেন্ট যাচাই করার পরে যদি আপনার অন্যান্য ক্ষেত্র আপডেট করার প্রয়োজন হয়,আমাদের সাথে যোগাযোগ করুন (আপনাকে প্রথমে একটি ব্যবসায়িক বার্তা Google অ্যাকাউন্ট দিয়ে সাইন ইন করতে হবে৷ একটি অ্যাকাউন্টের জন্য নিবন্ধন করতে, ব্যবসা বার্তাগুলির সাথে নিবন্ধন করুন দেখুন৷)

উদাহরণ: প্রদর্শনের নাম আপডেট করুন

curl -X PATCH \
"https://businesscommunications.googleapis.com/v1/brands/BRAND_ID/agents/AGENT_ID?updateMask=displayName" \
-H "Content-Type: application/json" \
-H "User-Agent: curl/business-communications" \
-H "$(oauth2l header --json PATH_TO_SERVICE_ACCOUNT_KEY businesscommunications)" \
-d "{
    'displayName': 'Growing Tree Bank',
}"
const businesscommunications = require('businesscommunications');
const {google} = require('googleapis');

// Initialize the Business Communications API
let bcApi = new businesscommunications.businesscommunications_v1.Businesscommunications({});

// Set the scope that we need for the Business Communications API
const scopes = [
  'https://www.googleapis.com/auth/businesscommunications',
];

// Set the private key to the service account file
const privatekey = require('PATH_TO_SERVICE_ACCOUNT_KEY');

/**
 * Initializes the Google credentials for calling the
 * Business Messages API.
 */
async function initCredentials() {
  // Configure a JWT auth client
  let authClient = new google.auth.JWT(
    privatekey.client_email,
    null,
    privatekey.private_key,
    scopes,
  );

  return new Promise(function(resolve, reject) {
    // Authenticate request
    authClient.authorize(function(err, tokens) {
      if (err) {
        reject(false);
      } else {
        resolve(authClient);
      }
    });
  });
}

async function main() {
  let authClient = await initCredentials();

  let agentName = 'brands/BRAND_ID/agents/AGENT_ID';

  if (authClient) {
    // Setup the parameters for the API call
    const apiParams = {
      auth: authClient,
      name: agentName,
      updateMask: 'displayName',
      resource: {
        displayName: 'Growing Tree Bank',
      }
    };

    bcApi.brands.agents.patch(apiParams, {}, (err, response) => {
      if (err !== undefined && err !== null) {
        console.dir(err);
      } else {
        // Agent found
        console.log(response.data);
      }
    });
  }
  else {
    console.log('Authentication failure.');
  }
}

main();
এই কোডটি Node.js বিজনেস কমিউনিকেশনস ক্লায়েন্ট লাইব্রেরির উপর ভিত্তি করে।
import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.services.businesscommunications.v1.BusinessCommunications;
import com.google.api.services.businesscommunications.v1.model.Agent;
import java.io.FileInputStream;
import java.util.Arrays;

class Main {
  /**
   * Initializes credentials used by the Business Communications API.
   */
  private static BusinessCommunications.Builder getBusinessCommunicationsBuilder() {
    BusinessCommunications.Builder builder = null;
    try {
      GoogleCredential credential = GoogleCredential
            .fromStream(new FileInputStream("PATH_TO_SERVICE_ACCOUNT_KEY"));

      credential = credential.createScoped(Arrays.asList(
          "https://www.googleapis.com/auth/businesscommunications"));

      credential.refreshToken();

      HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport();
      JacksonFactory jsonFactory = JacksonFactory.getDefaultInstance();

      // Create instance of the Business Communications API
      builder = new BusinessCommunications
          .Builder(httpTransport, jsonFactory, null)
          .setApplicationName(credential.getServiceAccountProjectId());

      // Set the API credentials and endpoint
      builder.setHttpRequestInitializer(credential);
    } catch (Exception e) {
      e.printStackTrace();
    }

    return builder;
  }

  public static void main(String args[]) {
    try {
      // Create client library reference
      BusinessCommunications.Builder builder = getBusinessCommunicationsBuilder();

      String agentName = "brands/BRAND_ID/agents/AGENT_ID";

      Agent agent = new Agent().setDisplayName("Growing Tree Bank");

      BusinessCommunications.Brands.Agents.Patch request = builder
          .build().brands().agents().patch(agentName, agent);

      request.setUpdateMask("displayName");

      Agent updatedAgent = request.execute();
      System.out.println(updatedAgent.toPrettyString());
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}
এই কোডটি জাভা বিজনেস কমিউনিকেশনস ক্লায়েন্ট লাইব্রেরির উপর ভিত্তি করে।
from oauth2client.service_account import ServiceAccountCredentials
from businesscommunications.businesscommunications_v1_client import (
    BusinesscommunicationsV1
)
from businesscommunications.businesscommunications_v1_messages import (
    Agent,
    BusinesscommunicationsBrandsAgentsPatchRequest,
)

SCOPES = ['https://www.googleapis.com/auth/businesscommunications']
SERVICE_ACCOUNT_FILE = 'PATH_TO_SERVICE_ACCOUNT_KEY'

credentials = ServiceAccountCredentials.from_json_keyfile_name(
    SERVICE_ACCOUNT_FILE, scopes=SCOPES)

client = BusinesscommunicationsV1(credentials=credentials)

agents_service = BusinesscommunicationsV1.BrandsAgentsService(client)

agent_name = 'brands/BRAND_ID/agents/AGENT_ID'

agent=Agent(
          displayName='Growing Tree Bank'
      )

updated_agent = agents_service.Patch(
        BusinesscommunicationsBrandsAgentsPatchRequest(
            agent=agent,
            name=agent_name,
            updateMask='displayName'
        )
    )

print(updated_agent)
এই কোডটি পাইথন বিজনেস কমিউনিকেশনস ক্লায়েন্ট লাইব্রেরির উপর ভিত্তি করে।

উদাহরণ: NON_LOCAL এবং LOCATION এন্ট্রি পয়েন্ট গ্রুপ নির্দিষ্ট করুন

curl -X PATCH \
"https://businesscommunications.googleapis.com/v1/brands/BRAND_ID/agents/AGENT_ID?updateMask=businessMessagesAgent.entryPointConfigs" \
-H "Content-Type: application/json" \
-H "User-Agent: curl/business-communications" \
-H "$(oauth2l header --json PATH_TO_SERVICE_ACCOUNT_KEY businesscommunications)" \
-d "{
  'businessMessagesAgent': {
    'entryPointConfigs': [
      {
        'allowedEntryPoint': 'NON_LOCAL',
      },
      {
        'allowedEntryPoint': 'LOCATION',
      },
    ],
  },
}"
const businesscommunications = require('businesscommunications');
const {google} = require('googleapis');

// Initialize the Business Communications API
let bcApi = new businesscommunications.businesscommunications_v1.Businesscommunications({});

// Set the scope that we need for the Business Communications API
const scopes = [
  'https://www.googleapis.com/auth/businesscommunications',
];

// Set the private key to the service account file
const privatekey = require('PATH_TO_SERVICE_ACCOUNT_KEY');

/**
 * Initializes the Google credentials for calling the
 * Business Messages API.
 */
async function initCredentials() {
  // Configure a JWT auth client
  let authClient = new google.auth.JWT(
    privatekey.client_email,
    null,
    privatekey.private_key,
    scopes,
  );

  return new Promise(function(resolve, reject) {
    // Authenticate request
    authClient.authorize(function(err, tokens) {
      if (err) {
        reject(false);
      } else {
        resolve(authClient);
      }
    });
  });
}

async function main() {
  let authClient = await initCredentials();

  let agentName = 'brands/BRAND_ID/agents/AGENT_ID';

  if (authClient) {
    // Setup the parameters for the API call
    const apiParams = {
      auth: authClient,
      name: agentName,
      updateMask: 'businessMessagesAgent.entryPointConfigs',
      resource: {
        businessMessagesAgent: {
          entryPointConfigs: [
            {
              allowedEntryPoint: 'LOCATION',
            },
            {
              allowedEntryPoint: 'NON_LOCAL',
            },
          ],
        }
      }
    };

    bcApi.brands.agents.patch(apiParams, {}, (err, response) => {
      if (err !== undefined && err !== null) {
        console.dir(err);
      } else {
        // Agent found
        console.log(response.data);
      }
    });
  }
  else {
    console.log('Authentication failure.');
  }
}

main();
এই কোডটি Node.js বিজনেস কমিউনিকেশনস ক্লায়েন্ট লাইব্রেরির উপর ভিত্তি করে।
import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.services.businesscommunications.v1.BusinessCommunications;
import com.google.api.services.businesscommunications.v1.model.*;
import java.io.FileInputStream;
import java.util.Arrays;

class Main {
  /**
   * Initializes credentials used by the Business Communications API.
   */
  private static BusinessCommunications.Builder getBusinessCommunicationsBuilder() {
    BusinessCommunications.Builder builder = null;
    try {
      GoogleCredential credential = GoogleCredential
            .fromStream(new FileInputStream("PATH_TO_SERVICE_ACCOUNT_KEY"));

      credential = credential.createScoped(Arrays.asList(
          "https://www.googleapis.com/auth/businesscommunications"));

      credential.refreshToken();

      HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport();
      JacksonFactory jsonFactory = JacksonFactory.getDefaultInstance();

      // Create instance of the Business Communications API
      builder = new BusinessCommunications
          .Builder(httpTransport, jsonFactory, null)
          .setApplicationName(credential.getServiceAccountProjectId());

      // Set the API credentials and endpoint
      builder.setHttpRequestInitializer(credential);
    } catch (Exception e) {
      e.printStackTrace();
    }

    return builder;
  }

  public static void main(String args[]) {
    try {
      // Create client library reference
      BusinessCommunications.Builder builder = getBusinessCommunicationsBuilder();

      String agentName = "brands/BRAND_ID/agents/AGENT_ID";

      Agent agent = new Agent().setBusinessMessagesAgent(
          new BusinessMessagesAgent().setEntryPointConfigs(Arrays.asList(
              new BusinessMessagesEntryPointConfig()
                  .setAllowedEntryPoint(
                      "NON_LOCAL"),
              new BusinessMessagesEntryPointConfig()
                  .setAllowedEntryPoint(
                      "LOCATION"))));

      BusinessCommunications.Brands.Agents.Patch request = builder
          .build().brands().agents().patch(agentName, agent);

      request.setUpdateMask("businessMessagesAgent.entryPointConfigs");

      Agent updatedAgent = request.execute();
      System.out.println(updatedAgent.toPrettyString());
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}
এই কোডটি জাভা বিজনেস কমিউনিকেশনস ক্লায়েন্ট লাইব্রেরির উপর ভিত্তি করে।
from oauth2client.service_account import ServiceAccountCredentials
from businesscommunications.businesscommunications_v1_client import (
    BusinesscommunicationsV1
)
from businesscommunications.businesscommunications_v1_messages import (
    Agent,
    BusinessMessagesAgent,
    BusinessMessagesEntryPointConfig,
    BusinesscommunicationsBrandsAgentsPatchRequest,
)

SCOPES = ['https://www.googleapis.com/auth/businesscommunications']
SERVICE_ACCOUNT_FILE = 'PATH_TO_SERVICE_ACCOUNT_KEY'

credentials = ServiceAccountCredentials.from_json_keyfile_name(
    SERVICE_ACCOUNT_FILE, scopes=SCOPES)

client = BusinesscommunicationsV1(credentials=credentials)

agents_service = BusinesscommunicationsV1.BrandsAgentsService(client)

agent_name = 'brands/BRAND_ID/agents/AGENT_ID'

agent=Agent(
    businessMessagesAgent=BusinessMessagesAgent(
        entryPointConfigs=[BusinessMessagesEntryPointConfig(
            allowedEntryPoint=BusinessMessagesEntryPointConfig.AllowedEntryPointValueValuesEnum.NON_LOCAL
        ), BusinessMessagesEntryPointConfig(
            allowedEntryPoint=BusinessMessagesEntryPointConfig.AllowedEntryPointValueValuesEnum.LOCATION
        )]
    )
)

updated_agent = agents_service.Patch(
        BusinesscommunicationsBrandsAgentsPatchRequest(
            agent=agent,
            name=agent_name,
            updateMask='businessMessagesAgent.entryPointConfigs'
        )
    )

print(updated_agent)
এই কোডটি পাইথন বিজনেস কমিউনিকেশনস ক্লায়েন্ট লাইব্রেরির উপর ভিত্তি করে।

উদাহরণ: স্বাগতম বার্তা আপডেট করুন

আপনি যদি conversationalSettings মধ্যে কোনো ক্ষেত্র আপডেট করেন — যেমন welcomeMessage — আপনাকে অবশ্যই অবজেক্টের মধ্যে সমস্ত ক্ষেত্র আপডেট করতে হবে, এবং আপনাকে অবশ্যই সেটিংসের লোকেল নির্দিষ্ট করতে হবে (একটি দুই-অক্ষরের ISO 639-1 ভাষা কোড হিসাবে)।

curl -X PATCH \
"https://businesscommunications.googleapis.com/v1/brands/BRAND_ID/agents/AGENT_ID?updateMask=businessMessagesAgent.conversationalSettings.en" \
-H "Content-Type: application/json" \
-H "User-Agent: curl/business-communications" \
-H "$(oauth2l header --json PATH_TO_SERVICE_ACCOUNT_KEY businesscommunications)" \
-d "{
    'businessMessagesAgent': {
        'conversationalSettings': {
            'en': {
                'welcomeMessage': {
                    'text': 'Thanks for contacting Growing Tree Bank. What can I help with today?',
                },
                'offlineMessage': {
                    'text': 'We\'re closed for the night. Please reach out to us again tomorrow.',
                },
                'privacyPolicy': {
                    'url': 'https://www.growingtreebank.com/privacy',
                },
                'conversationStarters': [
                    {
                        'suggestion': {
                            'reply': {
                                'text': 'Set up an account',
                                'postbackData': 'new-account',
                            },
                        },
                    },
                    {
                        'suggestion': {
                            'reply': {
                                'text': 'Look up account information',
                                'postbackData': 'account-lookup',
                            },
                        },
                    },
                ],
            },
        },
    },
}"
const businesscommunications = require('businesscommunications');
const {google} = require('googleapis');

// Initialize the Business Communications API
let bcApi = new businesscommunications.businesscommunications_v1.Businesscommunications({});

// Set the scope that we need for the Business Communications API
const scopes = [
  'https://www.googleapis.com/auth/businesscommunications',
];

// Set the private key to the service account file
const privatekey = require('PATH_TO_SERVICE_ACCOUNT_KEY');

/**
 * Initializes the Google credentials for calling the
 * Business Messages API.
 */
async function initCredentials() {
  // Configure a JWT auth client
  let authClient = new google.auth.JWT(
    privatekey.client_email,
    null,
    privatekey.private_key,
    scopes,
  );

  return new Promise(function(resolve, reject) {
    // Authenticate request
    authClient.authorize(function(err, tokens) {
      if (err) {
        reject(false);
      } else {
        resolve(authClient);
      }
    });
  });
}

async function main() {
  let authClient = await initCredentials();

  let agentName = 'brands/BRAND_ID/agents/AGENT_ID';

  if (authClient) {
    // Setup the parameters for the API call
    const apiParams = {
      auth: authClient,
      name: agentName,
      updateMask: 'businessMessagesAgent.conversationalSettings.en',
      resource: {
        businessMessagesAgent: {
          conversationalSettings: {
            en: {
              privacyPolicy: { url: 'https://www.growingtreebank.com/privacy' },
              welcomeMessage: { text: 'Thanks for contacting Growing Tree Bank. What can I help with today?' },
              offlineMessage: { text: 'We\'re closed for the night. Please reach out to us again tomorrow.' },
              conversationStarters: [
                {
                  suggestion: {
                    reply: {
                      text: 'Set up an account',
                      postbackData: 'new-account',
                    },
                  },
                },
                {
                  suggestion: {
                    reply: {
                      text: 'Look up account information',
                      postbackData: 'account-lookup',
                    },
                  },
                },
              ],
            },
          }
        }
      }
    };

    bcApi.brands.agents.patch(apiParams, {}, (err, response) => {
      if (err !== undefined && err !== null) {
        console.dir(err);
      } else {
        // Agent found
        console.log(response.data);
      }
    });
  }
  else {
    console.log('Authentication failure.');
  }
}

main();
এই কোডটি Node.js বিজনেস কমিউনিকেশনস ক্লায়েন্ট লাইব্রেরির উপর ভিত্তি করে।
import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.services.businesscommunications.v1.BusinessCommunications;
import com.google.api.services.businesscommunications.v1.model.*;
import com.google.common.collect.ImmutableMap;
import java.io.FileInputStream;
import java.util.Arrays;

class Main {
  /**
   * Initializes credentials used by the Business Communications API.
   */
  private static BusinessCommunications.Builder getBusinessCommunicationsBuilder() {
    BusinessCommunications.Builder builder = null;
    try {
      GoogleCredential credential = GoogleCredential
            .fromStream(new FileInputStream("PATH_TO_SERVICE_ACCOUNT_KEY"));

      credential = credential.createScoped(Arrays.asList(
          "https://www.googleapis.com/auth/businesscommunications"));

      credential.refreshToken();

      HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport();
      JacksonFactory jsonFactory = JacksonFactory.getDefaultInstance();

      // Create instance of the Business Communications API
      builder = new BusinessCommunications
          .Builder(httpTransport, jsonFactory, null)
          .setApplicationName(credential.getServiceAccountProjectId());

      // Set the API credentials and endpoint
      builder.setHttpRequestInitializer(credential);
    } catch (Exception e) {
      e.printStackTrace();
    }

    return builder;
  }

  public static void main(String args[]) {
    try {
      // Create client library reference
      BusinessCommunications.Builder builder = getBusinessCommunicationsBuilder();

      String agentName = "brands/BRAND_ID/agents/AGENT_ID";

      Agent agent = new Agent().setBusinessMessagesAgent(
          new BusinessMessagesAgent().setConversationalSettings(ImmutableMap.of("en",
              new ConversationalSetting()
                  .setPrivacyPolicy(new PrivacyPolicy().setUrl("https://www.growingtreebank.com/privacy"))
                  .setWelcomeMessage(new WelcomeMessage().setText("Thanks for contacting Growing Tree Bank. What can I help with today?"))
                  .setOfflineMessage(new OfflineMessage().setText("We're closed for the night. Please reach out to us again tomorrow."))
                  .setConversationStarters(Arrays.asList(
                      new ConversationStarters().setSuggestion(new Suggestion()
                          .setReply(new SuggestedReply()
                              .setText("Set up an account")
                              .setPostbackData("new-account"))),
                      new ConversationStarters().setSuggestion(new Suggestion()
                          .setReply(new SuggestedReply()
                              .setText("Look up account information")
                              .setPostbackData("account-lookup")))
                      )))));

      BusinessCommunications.Brands.Agents.Patch request = builder
          .build().brands().agents().patch(agentName, agent);

      request.setUpdateMask("businessMessagesAgent.conversationalSettings.en");

      Agent updatedAgent = request.execute();
      System.out.println(updatedAgent.toPrettyString());
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}
এই কোডটি জাভা বিজনেস কমিউনিকেশনস ক্লায়েন্ট লাইব্রেরির উপর ভিত্তি করে।
from oauth2client.service_account import ServiceAccountCredentials
from businesscommunications.businesscommunications_v1_client import (
    BusinesscommunicationsV1
)
from businesscommunications.businesscommunications_v1_messages import (
    Agent,
    BusinessMessagesAgent,
    ConversationStarters,
    ConversationalSetting,
    OfflineMessage,
    PrivacyPolicy,
    WelcomeMessage,
    BusinesscommunicationsBrandsAgentsPatchRequest,
)

SCOPES = ['https://www.googleapis.com/auth/businesscommunications']
SERVICE_ACCOUNT_FILE = 'PATH_TO_SERVICE_ACCOUNT_KEY'

credentials = ServiceAccountCredentials.from_json_keyfile_name(
    SERVICE_ACCOUNT_FILE, scopes=SCOPES)

client = BusinesscommunicationsV1(credentials=credentials)

agents_service = BusinesscommunicationsV1.BrandsAgentsService(client)

agent_name = 'brands/BRAND_ID/agents/AGENT_ID'

agent=Agent(
		businessMessagesAgent=BusinessMessagesAgent(
		  	conversationalSettings=BusinessMessagesAgent.ConversationalSettingsValue(
		        additionalProperties=[BusinessMessagesAgent.ConversationalSettingsValue.AdditionalProperty(
		            key='en',
		            value=ConversationalSetting(
		                privacyPolicy=PrivacyPolicy(url='https://www.growingtreebank.com/privacy'),
		                welcomeMessage=WelcomeMessage(text='Thanks for contacting Growing Tree Bank. What can I help with today?'),
		                offlineMessage=OfflineMessage(text='We\'re closed for the night. Please reach out to us again tomorrow.'),
		                conversationStarters=[
		                    ConversationStarters(
		                        suggestion=Suggestion(
		                            reply=SuggestedReply(text='Set up an account',
		                                postbackData='new-account')
		                        )
		                    ),
		                    ConversationStarters(
		                        suggestion=Suggestion(
		                            reply=SuggestedReply(text='Look up account information',
		                                postbackData='account-lookup')
		                        )
		                    )]
		                )
		            )
		        ]
		    )
		)
)

updated_agent = agents_service.Patch(
        BusinesscommunicationsBrandsAgentsPatchRequest(
            agent=agent,
            name=agent_name,
            updateMask='businessMessagesAgent.conversationalSettings.en'
        )
    )

print(updated_agent)
এই কোডটি পাইথন বিজনেস কমিউনিকেশনস ক্লায়েন্ট লাইব্রেরির উপর ভিত্তি করে।

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

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

যদি এজেন্টের একটি সংশ্লিষ্ট অবস্থান থাকে বা আপনি যদি এক বা একাধিকবার এজেন্ট যাচাই করার চেষ্টা করেন তাহলে অনুরোধগুলি মুছে ফেলতে ব্যর্থ হয়৷ অবস্থান আপডেট করতে, অবস্থান যোগ করুন দেখুন।

আপনি যাচাই করা একটি এজেন্ট মুছে ফেলতে পারবেন না। আপনি যাচাই বা যাচাই করার চেষ্টা করেছেন এমন একটি এজেন্ট মুছে ফেলতে,আমাদের সাথে যোগাযোগ করুন (আপনাকে প্রথমে একটি ব্যবসায়িক বার্তা Google অ্যাকাউন্ট দিয়ে সাইন ইন করতে হবে৷ একটি অ্যাকাউন্টের জন্য নিবন্ধন করতে, ব্যবসা বার্তাগুলির সাথে নিবন্ধন করুন দেখুন৷)

একটি এজেন্ট মুছে ফেলার জন্য, নিম্নলিখিত কমান্ডটি চালান। এজেন্টের name অনন্য মান দিয়ে BRAND_ID এবং AGENT_ID প্রতিস্থাপন করুন।

# This code deletes an agent.
# Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/brands.agents/delete

# Replace the __BRAND_ID__ and __AGENT_ID__
# Make sure a service account key file exists at ./service_account_key.json

curl -X DELETE "https://businesscommunications.googleapis.com/v1/brands/__BRAND_ID__/agents/__AGENT_ID__" \
-H "Content-Type: application/json" \
-H "User-Agent: curl/business-communications" \
-H "$(oauth2l header --json ./service_account_key.json businesscommunications)"
/**
 * This code snippet deletes an agent.
 * Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/brands.agents/delete
 *
 * This code is based on the https://github.com/google-business-communications/nodejs-businesscommunications Node.js
 * Business Communications client library.
 */

/**
 * Edit the values below:
 */
const BRAND_ID = 'EDIT_HERE';
const AGENT_ID = 'EDIT_HERE';
const PATH_TO_SERVICE_ACCOUNT_KEY = './service_account_key.json';

const businesscommunications = require('businesscommunications');
const {google} = require('googleapis');

// Initialize the Business Communications API
const bcApi = new businesscommunications.businesscommunications_v1.Businesscommunications({});

// Set the scope that we need for the Business Communications API
const scopes = [
  'https://www.googleapis.com/auth/businesscommunications',
];

// Set the private key to the service account file
const privatekey = require(PATH_TO_SERVICE_ACCOUNT_KEY);

async function main() {
  const authClient = await initCredentials();

  const agentName = 'brands/' + BRAND_ID + '/agents/' + AGENT_ID;

  if (authClient) {
    // Setup the parameters for the API call
    const apiParams = {
      auth: authClient,
      name: agentName,
    };

    bcApi.brands.agents.delete(apiParams, {}, (err, response) => {
      if (err !== undefined && err !== null) {
        console.dir(err);
      } else {
        // Agent removed
        console.log(response.data);
      }
    });
  }
  else {
    console.log('Authentication failure.');
  }
}

/**
 * Initializes the Google credentials for calling the
 * Business Messages API.
 */
 async function initCredentials() {
  // Configure a JWT auth client
  const authClient = new google.auth.JWT(
    privatekey.client_email,
    null,
    privatekey.private_key,
    scopes,
  );

  return new Promise(function(resolve, reject) {
    // Authenticate request
    authClient.authorize(function(err, tokens) {
      if (err) {
        reject(false);
      } else {
        resolve(authClient);
      }
    });
  });
}

main();
import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.services.businesscommunications.v1.BusinessCommunications;
import com.google.api.services.businesscommunications.v1.model.*;
import java.io.FileInputStream;
import java.util.Arrays;

class Main {
  /**
   * Initializes credentials used by the Business Communications API.
   */
  private static BusinessCommunications.Builder getBusinessCommunicationsBuilder() {
    BusinessCommunications.Builder builder = null;
    try {
      GoogleCredential credential = GoogleCredential
            .fromStream(new FileInputStream("PATH_TO_SERVICE_ACCOUNT_KEY"));

      credential = credential.createScoped(Arrays.asList(
          "https://www.googleapis.com/auth/businesscommunications"));

      credential.refreshToken();

      HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport();
      JacksonFactory jsonFactory = JacksonFactory.getDefaultInstance();

      // Create instance of the Business Communications API
      builder = new BusinessCommunications
          .Builder(httpTransport, jsonFactory, null)
          .setApplicationName(credential.getServiceAccountProjectId());

      // Set the API credentials and endpoint
      builder.setHttpRequestInitializer(credential);
    } catch (Exception e) {
      e.printStackTrace();
    }

    return builder;
  }

  public static void main(String args[]) {
    try {
      // Create client library reference
      BusinessCommunications.Builder builder = getBusinessCommunicationsBuilder();

      String agentName = "brands/BRAND_ID/agents/AGENT_ID";

      BusinessCommunications.Brands.Agents.Delete request
         = builder.build().brands().agents().delete(agentName);

      System.out.println(request.execute());
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}
এই কোডটি জাভা বিজনেস কমিউনিকেশনস ক্লায়েন্ট লাইব্রেরির উপর ভিত্তি করে।
"""This code deletes an agent.

Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/brands.agents/delete

This code is based on the https://github.com/google-business-communications/python-businessmessages
Python Business Messages client library.
"""

from oauth2client.service_account import ServiceAccountCredentials
from businesscommunications.businesscommunications_v1_client import BusinesscommunicationsV1
from businesscommunications.businesscommunications_v1_messages import (
    Agent,
    BusinesscommunicationsBrandsAgentsDeleteRequest,
)

# Edit the values below:
BRAND_ID = 'EDIT_HERE'
AGENT_ID = 'EDIT_HERE'
SCOPES = ['https://www.googleapis.com/auth/businesscommunications']
SERVICE_ACCOUNT_FILE = './service_account_key.json'

credentials = ServiceAccountCredentials.from_json_keyfile_name(
    SERVICE_ACCOUNT_FILE, scopes=SCOPES)

client = BusinesscommunicationsV1(credentials=credentials)

agents_service = BusinesscommunicationsV1.BrandsAgentsService(client)

agent_name = 'brands/' + BRAND_ID + '/agents/' + AGENT_ID

agent = agents_service.Delete(BusinesscommunicationsBrandsAgentsDeleteRequest(
        name=agent_name
    ))

print(agent)

বিন্যাস এবং মান বিকল্পের জন্য, brands.agents.delete দেখুন।

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

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

একটি ব্র্যান্ড মুছে ফেলতে, নিম্নলিখিত কমান্ডটি চালান। ব্র্যান্ডের name থেকে অনন্য মান দিয়ে BRAND_ID প্রতিস্থাপন করুন।

# This code deletes a brand.
# Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/brands/delete

# Replace the __BRAND_ID__
# Make sure a service account key file exists at ./service_account_key.json

curl -X DELETE "https://businesscommunications.googleapis.com/v1/brands/__BRAND_ID__" \
-H "Content-Type: application/json" \
-H "User-Agent: curl/business-communications" \
-H "$(oauth2l header --json ./service_account_key.json businesscommunications)"
/**
 * This code snippet deletes a brand.
 * Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/brands/delete
 *
 * This code is based on the https://github.com/google-business-communications/nodejs-businesscommunications Node.js
 * Business Communications client library.
 */

/**
 * Edit the values below:
 */
const BRAND_ID = 'EDIT_HERE';
const PATH_TO_SERVICE_ACCOUNT_KEY = './service_account_key.json';

const businesscommunications = require('businesscommunications');
const {google} = require('googleapis');

// Initialize the Business Communications API
const bcApi = new businesscommunications.businesscommunications_v1.Businesscommunications({});

// Set the scope that we need for the Business Communications API
const scopes = [
  'https://www.googleapis.com/auth/businesscommunications',
];

// Set the private key to the service account file
const privatekey = require(PATH_TO_SERVICE_ACCOUNT_KEY);

async function main() {
  const authClient = await initCredentials();

  const brandName = 'brands/' + BRAND_ID;

  if (authClient) {
    // Setup the parameters for the API call
    const apiParams = {
      auth: authClient,
      name: brandName,
    };

    bcApi.brands.delete(apiParams, {}, (err, response) => {
      if (err !== undefined && err !== null) {
        console.dir(err);
      } else {
        // Brand removed
        console.log(response.data);
      }
    });
  }
  else {
    console.log('Authentication failure.');
  }
}

/**
 * Initializes the Google credentials for calling the
 * Business Messages API.
 */
 async function initCredentials() {
  // Configure a JWT auth client
  const authClient = new google.auth.JWT(
    privatekey.client_email,
    null,
    privatekey.private_key,
    scopes,
  );

  return new Promise(function(resolve, reject) {
    // Authenticate request
    authClient.authorize(function(err, tokens) {
      if (err) {
        reject(false);
      } else {
        resolve(authClient);
      }
    });
  });
}

main();
import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.services.businesscommunications.v1.BusinessCommunications;
import com.google.api.services.businesscommunications.v1.model.*;
import java.io.FileInputStream;
import java.util.Arrays;

class Main {
  /**
   * Initializes credentials used by the Business Communications API.
   */
  private static BusinessCommunications.Builder getBusinessCommunicationsBuilder() {
    BusinessCommunications.Builder builder = null;
    try {
      GoogleCredential credential = GoogleCredential
            .fromStream(new FileInputStream("PATH_TO_SERVICE_ACCOUNT_KEY"));

      credential = credential.createScoped(Arrays.asList(
          "https://www.googleapis.com/auth/businesscommunications"));

      credential.refreshToken();

      HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport();
      JacksonFactory jsonFactory = JacksonFactory.getDefaultInstance();

      // Create instance of the Business Communications API
      builder = new BusinessCommunications
          .Builder(httpTransport, jsonFactory, null)
          .setApplicationName(credential.getServiceAccountProjectId());

      // Set the API credentials and endpoint
      builder.setHttpRequestInitializer(credential);
    } catch (Exception e) {
      e.printStackTrace();
    }

    return builder;
  }

  public static void main(String args[]) {
    try {
      // Create client library reference
      BusinessCommunications.Builder builder = getBusinessCommunicationsBuilder();

      String brandName = "brands/BRAND_ID";

      BusinessCommunications.Brands.Delete request = builder.build().brands().delete(brandName);

      System.out.println(request.execute());
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}
এই কোডটি জাভা বিজনেস কমিউনিকেশনস ক্লায়েন্ট লাইব্রেরির উপর ভিত্তি করে।
"""This code deletes a brand.

Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/brands/delete

This code is based on the https://github.com/google-business-communications/python-businessmessages
Python Business Messages client library.
"""

from oauth2client.service_account import ServiceAccountCredentials
from businesscommunications.businesscommunications_v1_client import BusinesscommunicationsV1
from businesscommunications.businesscommunications_v1_messages import (
    BusinesscommunicationsBrandsAgentsDeleteRequest
)

# Edit the values below:
BRAND_ID = 'EDIT_HERE'
SCOPES = ['https://www.googleapis.com/auth/businesscommunications']
SERVICE_ACCOUNT_FILE = './service_account_key.json'

credentials = ServiceAccountCredentials.from_json_keyfile_name(
    SERVICE_ACCOUNT_FILE, scopes=SCOPES)

client = BusinesscommunicationsV1(credentials=credentials)

agents_service = BusinesscommunicationsV1.BrandsAgentsService(client)

brand_name = 'brands/' + BRAND_ID

agent = agents_service.Delete(BusinesscommunicationsBrandsAgentsDeleteRequest(
        name=brand_name
    ))

print(agent)

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

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

এখন যেহেতু আপনার এজেন্ট আছে, আপনি নিম্নলিখিত পদক্ষেপগুলি নিতে পারেন: