إدارة الوكلاء باستخدام واجهة برمجة تطبيقات عمليات RBM

يتضمّن سير عمل 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": "BASIC_MESSAGE"
        },
        "agentUseCase": "MULTI_USE",
        "hostingRegion": "NORTH_AMERICA"
      }
    },
    {
      "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_LEGACY"
        },
        "agentUseCase": "PROMOTIONAL",
        "hostingRegion": "NORTH_AMERICA"
      }
    }
  ]
}

يمكن استرجاع صفحة واحدة من النتائج في كل مرة. اطّلِع على مرجع واجهة برمجة التطبيقات للحصول على التفاصيل.

الحصول على معلومات التأكّد من الوكيل

يمكن للشركة الناقلة الحصول على حالة إثبات ملكية العلامة التجارية للوكيل. لمزيد من التفاصيل، يُرجى الاطّلاع على 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": "BASIC_MESSAGE"
    },
    "agentUseCase": "MULTI_USE",
    "hostingRegion": "NORTH_AMERICA"
  }
}

تغيير حالة إطلاق الوكيل

يمكن لمشغّل شبكة الجوّال تعديل حالة إطلاق موظّف الدعم وإضافة رسالة ستتم إرسالها بالبريد الإلكتروني إلى المطوّر.

يجب تغيير الحالة على النحو التالي:

  • LAUNCH_STATE_PENDING إلى LAUNCH_STATE_LAUNCHED أو LAUNCH_STATE_REJECTED
  • من LAUNCH_STATE_LAUNCHED إلى LAUNCH_STATE_SUSPENDED
  • LAUNCH_STATE_SUSPENDED إلى LAUNCH_STATE_LAUNCHED أو LAUNCH_STATE_REJECTED

لا يحتاج المتصل بالضرورة إلى اسم موظّف الدعم بالكامل، بما في ذلك اسم العلامة التجارية. يجب إدخال معرّف موظّف الدعم فقط (قبل @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": "Ian",
          "title": "The Boss",
          "email": "someone@somewhere.com"
        }
      ],
      "optinDescription": "Users accepted our terms of service online.",
      "triggerDescription": "We are reaching preregistered users",
      "interactionsDescription": "This agent does not do much.",
      "optoutDescription": "Reply stop and we stop.",
      "agentAccessInstructions": "This is a a simple agent that reaches registered users.",
      "videoUris": [
        "https://www.google.com/a/video"
      ],
      "screenshotUris": [
        "https://www.google.com/a/screenshot"
      ]
    },
    "launchDetails": {
      "/v1/regions/thecarrier": {
        "launchState": "LAUNCH_STATE_REJECTED",
        "comment": "We don't have a billing contract in place with you.",
        "updateTime": "2023-04-28T15:22:10.221191Z"
      }
    }
  }
}

حذف وكيل

لأسباب تتعلق بالأمان، لم يعُد بإمكانك حذف عملاء RBM. يُرجى التواصل مع فريق دعم ميزة "مراسلة الأنشطة التجارية من خلال خدمات الاتصالات التفاعلية (RCS)" للحصول على المساعدة.