إدارة روابط الرد التلقائي على الويب

يستخدم جميع الوكلاء الذين تم إنشاؤهم من خلال RBM Management API ردًا تلقائيًا واحدًا على الويب للإشعارات. يتم ضبط هذا الرد التلقائي على الويب على مستوى الشريك في وحدة تحكّم Business Communications Developer Console، وينطبق على جميع الوكلاء في حساب الشريك الخاص بك.

بدلاً من ذلك، يمكنك استخدام RBM Management API لضبط الردود التلقائية على الويب على مستوى الوكيل. وقد يكون هذا خيارًا جيدًا إذا كنت تدير العديد من الوكلاء ذوي السلوك المميز.

يتم الحصول على مقتطفات الرمز في هذه الصفحة من عيّنات Java وعيّنات Node.js.

إنشاء دمج ردّ تلقائي على الويب

لإضافة دمج الردّ التلقائي على الويب للوكيل، عليك أولاً تحديد عنوان URL للردّ التلقائي على الويب وتحديد الرمز المميّز للتحقق. بعد ذلك، اضبط الرد التلقائي على الويب لاتّباع خطوات التحقّق. بعد الضبط، يمكنك استدعاء الإجراء createWebhookIntegration باستخدام قيم عنوان URL والرمز المميّز. إذا نجحت المكالمة، يمكنك متابعة التحقّق من الرسائل الواردة ومعالجتها.

Node.js


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

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

businessCommunicationsApiHelper.initBusinessCommunucationsApi(privateKey);

const url = 'https://myrbmserviceendpoint.somewhere.com/callback';

const token = '123456';

businessCommunicationsApiHelper
  .createWebhookIntegration(agent.name, url, token)
  .then((response) => {
    console.log(JSON.stringify(response.data, null, 2));
  }).catch((err) => {
    console.log(err);
  }
);

يعرض هذا الرمز كائن الردّ التلقائي على الويب الجديد:

{
  "name": "brands/40bd963f-ff92-425c-b273-8f0892d2d017/agents/my_new_agent_hfaoplpu_agent/integrations/4efdb82f-fd6d-4ba4-8ea3-f2f4a60d1547",
  "status": "ENABLED",
  "agentWebhookIntegration": {
    "webhookUri": "https://myrbmserviceendpoint.somewhere.com/callback"
  }
}

البحث عن عمليات دمج الردّ التلقائي على الويب الخاص بالوكيل

يمكنك استرداد قائمة بجميع عمليات دمج الردّ التلقائي على الويب التي تخص أحد موظّفي الدعم. من الناحية العملية، يتوفّر لوكيل RBM فقط عملية دمج واحدة للردّ التلقائي على الويب.

Node.js


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

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

businessCommunicationsApiHelper.initBusinessCommunucationsApi(privateKey);

businessCommunicationsApiHelper
  .listAgentIntegrations(agent.name)
  .then((response) => {
    console.log(JSON.stringify(response.data, null, 2));
    datastore.saveJsonData('integrations', response.data);
  }).catch((err) => {
    console.log(err);
  });

يعرض هذا الرمز قائمة بعمليات دمج الرد التلقائي على الويب للوكيل:

{
  "integrations": [
    {
      "name": "brands/40bd963f-ff92-425c-b273-8f0892d2d017/agents/my_new_agent_hfaoplpu_agent/integrations/4efdb82f-fd6d-4ba4-8ea3-f2f4a60d1547",
      "status": "ENABLED",
      "agentWebhookIntegration": {
        "webhookUri": "https://myrbmserviceendpoint.somewhere.com/callback"
      }
    }
  ]
}

البحث عن تفاصيل عملية دمج

يمكن استرداد تفاصيل عملية الدمج استنادًا إلى المرجع.

Node.js


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

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

businessCommunicationsApiHelper.initBusinessCommunucationsApi(privateKey);

businessCommunicationsApiHelper
  .getAgentIntegration(integrations.integrations[0].name)
  .then((response) => {
    console.log(JSON.stringify(response.data, null, 2));
  }).catch((err) => {
    console.log(err);
  });

يعرض هذا الرمز تفاصيل دمج الردّ التلقائي على الويب:

{
  "name": "brands/40bd963f-ff92-425c-b273-8f0892d2d017/agents/my_new_agent_hfaoplpu_agent/integrations/4efdb82f-fd6d-4ba4-8ea3-f2f4a60d1547",
  "status": "ENABLED",
  "agentWebhookIntegration": {
    "webhookUri": "https://myrbmserviceendpoint.somewhere.com/callback"
  }
}

إزالة ردّ تلقائي على الويب

يمكن إزالة ردّ تلقائي على الويب من وكيل باستخدام مرجعه:

Node.js


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

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

businessCommunicationsApiHelper.initBusinessCommunucationsApi(privateKey);

businessCommunicationsApiHelper
  .deleteAgentIntegration(integrations.integrations[0].name)
  .then((response) => {
    console.log(JSON.stringify(response.data, null, 2));
  }).catch((err) => {
    console.log(err);
  });

يتم إرجاع كائن فارغ:

{}