आरबीएम ऑपरेशंस एपीआई की मदद से एजेंट मैनेज करें

मोबाइल और इंटरनेट सेवा देने वाली कंपनियों के लिए, RBM के मुख्य वर्कफ़्लो में नए एजेंटों के बारे में जानकारी की समीक्षा करना शामिल है. साथ ही, उन्हें मोबाइल और इंटरनेट सेवा देने वाली कंपनी के नेटवर्क पर लॉन्च करने की अनुमति देना या अस्वीकार करना और अपने सदस्यों को मैसेज भेजना शामिल है.

इस पेज पर दिए गए कोड स्निपेट, हमारे JavaScript और Curl के सैंपल से लिए गए हैं.

किसी मोबाइल और इंटरनेट सेवा देने वाली कंपनी को सबमिट किए गए सभी एजेंटों की सूची देखना

मोबाइल और इंटरनेट सेवा देने वाली कंपनी, उन सभी एजेंटों की सूची पा सकती है जिन्हें डेवलपर ने कंपनी के नेटवर्क पर लॉन्च करने के लिए सबमिट किया है.

Node.js

const businessCommunicationsApiHelper =
  require('@google/rbm-businesscommunications');

const privateKey =
  require('../../resources/businesscommunications-service-account-credentials.json');

businessCommunicationsApiHelper.initBusinessCommunucationsApi(privateKey);

// Retrieve all agents targeting the carrier
businessCommunicationsApiHelper.listAgents('brands/-').then((response) => {
  console.log('Current agents are:');
  console.log(JSON.stringify(response.data, null, 2));
}).catch((err) => {
  console.log(err);
});

cURL

curl -v "https://businesscommunications.googleapis.com/v1/brands/-/agents" \
  -H "Content-Type: application/json" \
  -H "User-Agent: curl/business-messaging" \
  -H "`oauth2l header --json serviceAccount.json businesscommunications`"

ब्रैंड को - पर सेट किया जाता है, क्योंकि सभी एजेंटों की सूची पाने के लिए इसकी ज़रूरत नहीं होती.

यह कोड, मोबाइल और इंटरनेट सेवा देने वाली कंपनी को लॉन्च करने के लिए सबमिट किए गए सभी एजेंटों की सूची दिखाता है:

{
  "agents": [
    {
      "name": "brands/40bd963f-ff92-425c-b273-8f0892d2d017/agents/my_new_agent_4fpd1psz_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": [
          {
            "phoneNumber": {
              "number": "+12223334444"
            },
            "label": "Call support"
          }
        ],
        "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": "NON_CONVERSATIONAL"
        },
        "agentUseCase": "MULTI_USE",
        "hostingRegion": "NORTH_AMERICA",
        "partner": {
          "partnerId": "unique-identifier-for-my-partner",
          "displayName": "My partner",
          "company": "Public name of the company for my partner"
        }
      }
    },
    {
      "name": "brands/40bd963f-ff92-425c-b273-8f0892d2d017/agents/my_new_agent_7jo0trhw_agent",
      "displayName": "My second agent",
      "rcsBusinessMessagingAgent": {
        "description": "Another agent description",
        "logoUri": "https://agent-logos.storage.googleapis.com/_/kt90w53vzw2QSxK6PG1uCeJf",
        "heroUri": "https://agent-logos.storage.googleapis.com/_/kt90vzob74GQcfeHoEQbVRTP",
        "phoneNumbers": [
          {
            "phoneNumber": {
              "number": "+12228885768"
            },
            "label": "Call support"
          }
        ],
        "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": "CONVERSATIONAL"
        },
        "agentUseCase": "PROMOTIONAL",
        "hostingRegion": "NORTH_AMERICA",
        "partner": {
          "partnerId": "unique-identifier-for-my-partner",
          "displayName": "My partner",
          "company": "Public name of the company for my partner"
        }
      }
    }
  ]
}

नतीजे एक बार में एक पेज के हिसाब से पाए जा सकते हैं. ज़्यादा जानकारी के लिए, एपीआई के बारे में जानकारी देखें.

एजेंट की पुष्टि करने के लिए दी गई जानकारी पाना

मोबाइल और इंटरनेट सेवा देने वाली कंपनी, किसी एजेंट के ब्रैंड की पुष्टि की स्थिति पा सकती है. ज़्यादा जानकारी के लिए, देखें 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(agents[0].name).then((response) => {
  }).catch((err) => {
    console.log(err);
  });
  

cURL

  curl -v "https://businesscommunications.googleapis.com/v1/brands/-/agents/AGENT ID/verification" \
    -H "Content-Type: application/json" \
    -H "User-Agent: curl/business-messaging" \
    -H "`oauth2l header --json serviceAccount.json businesscommunications`"
  

ज़रूरी नहीं है कि कॉल करने वाले व्यक्ति के पास एजेंट का पूरा नाम हो. इसमें ब्रैंड का नाम भी शामिल है. सिर्फ़ एजेंट आईडी (@rbm.goog से पहले) की ज़रूरत होती है. साथ ही, ब्रैंड का नाम - पर सेट होना चाहिए.

यह कोड, पुष्टि की स्थिति और पार्टनर की जानकारी दिखाता है:

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

एजेंट के लॉन्च की स्थिति और सवालों की सूची पाना

मोबाइल और इंटरनेट सेवा देने वाली कंपनी, किसी एजेंट के लॉन्च की मौजूदा स्थिति और डेवलपर के लॉन्च से जुड़े सवालों की सूची पा सकती है.

Node.js

const businessCommunicationsApiHelper =
  require('@google/rbm-businesscommunications');

const privateKey =
  require('../../resources/businesscommunications-service-account-credentials.json');

businessCommunicationsApiHelper.initBusinessCommunucationsApi(privateKey);

businessCommunicationsApiHelper.getAgentLaunch(agents[0].name).then((response) => {
  console.log('Launch details are:');
  console.log(JSON.stringify(response.data, null, 2));
}).catch((err) => {
  console.log(err);
});

cURL

curl -v "https://businesscommunications.googleapis.com/v1/brands/-/agents/AGENT ID/launch" \
  -H "Content-Type: application/json" \
  -H "User-Agent: curl/business-messaging" \
  -H "`oauth2l header --json serviceAccount.json businesscommunications`"

ज़रूरी नहीं है कि कॉल करने वाले व्यक्ति के पास एजेंट का पूरा नाम हो. इसमें ब्रैंड का नाम भी शामिल है. सिर्फ़ एजेंट आईडी (@rbm.goog से पहले) की ज़रूरत होती है. साथ ही, ब्रैंड का नाम - पर सेट होना चाहिए.

यह कोड, लॉन्च की जानकारी दिखाता है:

{
  "name": "brands/8b5c7f80-b025-486b-bc8a-2d0797559711/agents/my-agent-demo/launch",
  "rcsBusinessMessaging": {
    "questionnaire": {
      "contacts": [
        {
          "name": "John Doe",
          "title": "Mr",
          "email": "johndoe@developer.com"
        }
      ],
      "optinDescription": "Messages are sent to known MSISDNs",
      "triggerDescription": "We respond to any interaction",
      "interactionsDescription": "Simple conversations with a chatbot",
      "optoutDescription": "User sends stop"
    },
    "launchDetails": {
      "/v1/regions/thecarrier": {
        "launchState": "LAUNCH_STATE_LAUNCHED",
        "updateTime": "2023-02-20T15:10:36.528669Z"
      }
    }
  }
}

एजेंट की परिभाषा देखना

मोबाइल और इंटरनेट सेवा देने वाली कंपनी, एजेंट के खास आइडेंटिफ़ायर (name) का इस्तेमाल करके उसकी जानकारी पा सकती है.

Node.js

const businessCommunicationsApiHelper =
  require('@google/rbm-businesscommunications');

const privateKey =
  require('../../resources/businesscommunications-service-account-credentials.json');

businessCommunicationsApiHelper.initBusinessCommunucationsApi(privateKey);

businessCommunicationsApiHelper.getAgent(agent[0].name).then((response) => {
  console.log('Agent details are:');
  console.log(JSON.stringify(response.data, null, 2));
}).catch((err) => {
  console.log(err);
});

cURL

curl -v "https://businesscommunications.googleapis.com/v1/brands/-/agents/AGENT ID" \
  -H "Content-Type: application/json" \
  -H "User-Agent: curl/business-messaging" \
  -H "`oauth2l header --json serviceAccount.json businesscommunications`"

ज़रूरी नहीं है कि कॉल करने वाले व्यक्ति के पास एजेंट का पूरा नाम हो. इसमें ब्रैंड का नाम भी शामिल है. सिर्फ़ एजेंट आईडी (@rbm.goog से पहले) की ज़रूरत होती है. साथ ही, ब्रैंड का नाम - पर सेट होना चाहिए.

यह कोड, एजेंट की जानकारी दिखाता है:

{
  "name": "brands/40bd963f-ff92-425c-b273-8f0892d2d017/agents/my_new_agent_4fpd1psz_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": [
      {
        "phoneNumber": {
          "number": "+12223334444"
        },
        "label": "Call support"
      }
    ],
    "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": "NON_CONVERSATIONAL"
    },
    "agentUseCase": "MULTI_USE",
    "hostingRegion": "NORTH_AMERICA",
    "partner": {
      "partnerId": "unique-identifier-for-my-partner",
      "displayName": "My partner",
      "company": "Public name of the company for my partner"
    }
  }
}

एजेंट के लॉन्च की स्थिति बदलना

मोबाइल और इंटरनेट सेवा देने वाली कंपनी, किसी एजेंट के लॉन्च की स्थिति को अपडेट कर सकती है. साथ ही, स्थिति में बदलाव की वजह बताने के लिए एक टिप्पणी शामिल कर सकती है.

स्थिति को इस तरह बदला जाना चाहिए:

  • LAUNCH_STATE_PENDING से LAUNCH_STATE_LAUNCHED या LAUNCH_STATE_REJECTED
  • LAUNCH_STATE_LAUNCHED से LAUNCH_STATE_SUSPENDED
  • LAUNCH_STATE_SUSPENDED से LAUNCH_STATE_LAUNCHED या LAUNCH_STATE_UNLAUNCHED

ज़रूरी नहीं है कि कॉल करने वाले व्यक्ति के पास एजेंट का पूरा नाम हो. इसमें ब्रैंड का नाम भी शामिल है. सिर्फ़ एजेंट आईडी (@rbm.goog से पहले) की ज़रूरत होती है. साथ ही, ब्रैंड का नाम - पर सेट होना चाहिए.

Node.js

const businessCommunicationsApiHelper =
  require('@google/rbm-businesscommunications');

const privateKey =
  require('../../resources/businesscommunications-service-account-credentials.json');

businessCommunicationsApiHelper.initBusinessCommunucationsApi(privateKey);

businessCommunicationsApiHelper
	.updateAgentLaunchState(agentId, 'LAUNCH_STATE_LAUNCHED').then((response) => {
		console.log('Updated launch details are:');
		console.log(JSON.stringify(response.data, null, 2));
	});

cURL

curl -v -X PATCH "https://businesscommunications.googleapis.com/v1/brands/-/agents/AGENT ID/launch" \
  -H "Content-Type: application/json" \
  -H "User-Agent: curl/business-messaging" \
  -H "`oauth2l header --json serviceAccount.json businesscommunications`" \
  -d "{
    'rcsBusinessMessaging': {
      'launchDetails': {
        '': {
          'launchState': 'LAUNCH_STATE_LAUNCHED',
        }
      }
    }
  }"

यह कोड, लॉन्च की अपडेट की गई जानकारी दिखाता है. इसमें लॉन्च की स्थिति में बदलाव किया गया है:

{
  "name": "brands/40bd963f-ff92-425c-b273-8f0892d2d017/agents/my_new_agent_4fpd1psz_agent/launch",
  "rcsBusinessMessaging": {
    "questionnaire": {
      "contacts": [
        {
          "name": "John Doe",
          "title": "Contact manager",
          "email": "john.doe@gmail.com"
        }
      ],
      "optinDescription": "Users accepted our terms of service online.",
      "triggerDescription": "We are reaching pre-registered users",
      "interactionsDescription": "This agent sends notifications and processes suggested replies.",
      "optoutDescription": "Reply stop and we stop.",
      "agentAccessInstructions": "This is a simple agent that reaches registered users.",
      "videoUris": [
        "https://www.google.com/a/video"
      ],
      "screenshotUris": [
        "https://www.google.com/a/screenshot"
      ]
    },
    "launchDetails": {
      "/v1/regions/thecarrier": {
        "launchState": "LAUNCH_STATE_REJECTED",
        "comment": "We don't have a billing contract in place with you.", // Note: The field is optional only for launch approval; otherwise, required.
        "updateTime": "2023-04-28T15:22:10.221191Z"
      }
    }
  }
}

एजेंटों को छिपाना या दिखाना

अपने वर्कस्पेस को साफ़-सुथरा और व्यवस्थित रखने के लिए, उन एजेंटों को छिपाया जा सकता है जिनका इस्तेमाल अब आपके नेटवर्क पर नहीं किया जा रहा है. किसी एजेंट को छिपाने पर, वह डिफ़ॉल्ट एपीआई डिस्कवरी के नतीजों से हट जाता है.

छिपाना, सिर्फ़ दिखने से जुड़ा बदलाव है. इसका असर सिर्फ़ आपकी मोबाइल और इंटरनेट सेवा देने वाली कंपनी के व्यू पर पड़ता है. साथ ही, इससे पार्टनर या अन्य मोबाइल और इंटरनेट सेवा देने वाली कंपनियों के लिए एजेंट की स्थिति पर कोई असर नहीं पड़ता. किसी एजेंट को कभी भी दिखाया जा सकता है, ताकि वह फिर से दिखने लगे और उसे मैनेज किया जा सके.

यह पक्का करने के लिए कि चालू एजेंट गलती से न हटें, ये नियम लागू होते हैं:

  • पात्रता: सिर्फ़ उन एजेंटों को छिपाया जा सकता है जो आपके नेटवर्क पर इनऐक्टिव हैं: निलंबित या अस्वीकार किए गए.
  • पाबंदियां: अगर आपके नेटवर्क पर किसी एजेंट का लॉन्च स्टेटस लॉन्च किया गया या लॉन्च होने वाला है, तो उसे छिपाया नहीं जा सकता. अगर ऐसे एजेंट को छिपाने की कोशिश की जाती है, तो अनुरोध को FAILED_PRECONDITION गड़बड़ी के साथ अस्वीकार कर दिया जाएगा.

छिपाने की स्थिति अपडेट करना

अपनी मोबाइल और इंटरनेट सेवा देने वाली कंपनी के लिए, किसी एजेंट के लॉन्च को छिपाने या दिखाने के लिए, लॉन्च रिसॉर्स पर setAgentLaunchVisibility तरीके का इस्तेमाल करें. छिपाने के लिए, isHidden बूलियन को true पर सेट करें. दिखाने के लिए, इसे false पर सेट करें.

तरीका: POST /v1/brands/{brandId}/agents/{agentId}/launch:setAgentLaunchVisibility

curl -v -X POST "https://businesscommunications.googleapis.com/v1/brands/$BRAND_ID/agents/$AGENT_ID/launch:setAgentLaunchVisibility" \
  -H "Content-Type: application/json" \
  -H "User-Agent: curl/business-messaging" \
  -H "$(oauth2l header --json serviceAccount.json businesscommunications)" \
  --data '{
    "name": "brands/$BRAND_ID/agents/$AGENT_ID/launch",
    "isHidden": true
  }'
{
  "name": "brands/8b5c7f80-b025-486b-bc8a-2d0797559711/agents/my-agent-demo/launch",
  "rcsBusinessMessaging": {
    "questionnaire": {
      "contacts": [
        {
          "name": "John Doe",
          "title": "Mr",
          "email": "johndoe@developer.com"
        }
      ],
      "optinDescription": "Messages are sent to known MSISDNs",
      "triggerDescription": "We respond to any interaction",
      "interactionsDescription": "Simple conversations with a chatbot",
      "optoutDescription": "User sends stop"
    },
    "launchDetails": {
      "/v1/regions/thecarrier": {
        "launchState": "LAUNCH_STATE_SUSPENDED",
        "updateTime": "2026-02-20T15:10:36.528669Z",
        "isHidden": true
      }
    }
  }
}

फ़िल्टर के साथ एजेंटों की सूची देखना

डिफ़ॉल्ट रूप से, list तरीके में आपकी मोबाइल और इंटरनेट सेवा देने वाली कंपनी के छिपाए गए एजेंट शामिल नहीं होते. इन्हें अपने नतीजों में शामिल करने के लिए, includeHidden पैरामीटर का इस्तेमाल करें.

किसी एजेंट को मिटाना

सुरक्षा कारणों से, अब RBM एजेंटों को मिटाया नहीं जा सकता. मदद पाने के लिए, RCS for Business की सहायता टीम से संपर्क करें.