Quản lý nhân viên hỗ trợ bằng RBM Operations API

Quy trình công việc RBM chính của nhà mạng bao gồm việc xem xét thông tin về nhân viên hỗ trợ mới và phê duyệt hoặc từ chối cho phép họ khởi chạy trên mạng của nhà mạng và nhắn tin cho người đăng ký.

Đoạn mã trên trang này được lấy từ các mẫu JavaScriptCurl của chúng tôi.

Liệt kê tất cả nhân viên hỗ trợ mà bạn gửi cho nhà mạng

Nhà mạng có thể lấy danh sách tất cả các nhân viên hỗ trợ mà nhà phát triển đã gửi để ra mắt trên mạng của nhà mạng.

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`"

Thương hiệu được đặt thành - vì không bắt buộc khi truy xuất danh sách mọi tác nhân.

Mã này trả về danh sách tất cả các nhân viên hỗ trợ được gửi để ra mắt tại nhà mạng:

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

Kết quả có thể được truy xuất từng trang một. Hãy xem Tài liệu tham khảo API để biết thông tin chi tiết.

Nhận bảng câu hỏi và trạng thái ra mắt nhân viên hỗ trợ

Nhà mạng có thể biết trạng thái phát hành hiện tại của một nhân viên hỗ trợ và bộ câu hỏi về việc ra mắt của nhà phát triển.

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`"

Người gọi không nhất thiết phải có tên nhân viên hỗ trợ đầy đủ, bao gồm cả tên thương hiệu. Bạn chỉ bắt buộc phải có mã nhân viên hỗ trợ (trước @rbm.goog), với tên thương hiệu được đặt thành -.

Mã này trả về thông tin khởi chạy:

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

Truy xuất định nghĩa về tác nhân

Bạn có thể truy xuất thông tin của một nhân viên hỗ trợ bằng cách sử dụng giá trị nhận dạng duy nhất của nhân viên hỗ trợ đó (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`"

Người gọi không nhất thiết phải có tên đầy đủ của nhân viên hỗ trợ, bao gồm cả tên thương hiệu. Bạn chỉ bắt buộc phải có mã nhân viên hỗ trợ (trước @rbm.goog), với tên thương hiệu được đặt thành -.

Mã này trả về thông tin của nhân viên hỗ trợ:

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

Thay đổi trạng thái ra mắt của nhân viên hỗ trợ

Nhà mạng có thể cập nhật trạng thái ra mắt của nhân viên hỗ trợ và thêm thông báo sẽ được gửi qua email cho nhà phát triển.

Trạng thái sẽ được thay đổi như sau:

  • LAUNCH_STATE_PENDING đến LAUNCH_STATE_LAUNCHED hoặc LAUNCH_STATE_REJECTED
  • LAUNCH_STATE_LAUNCHED đến LAUNCH_STATE_SUSPENDED
  • LAUNCH_STATE_SUSPENDED đến LAUNCH_STATE_LAUNCHED hoặc LAUNCH_STATE_REJECTED

Người gọi không nhất thiết phải có tên đầy đủ của nhân viên hỗ trợ, bao gồm cả tên thương hiệu. Bạn chỉ bắt buộc phải có mã nhân viên hỗ trợ (trước @rbm.goog), với tên thương hiệu được đặt thành -.

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',
        }
      }
    }
  }"

Mã này trả về thông tin phát hành đã cập nhật khi trạng thái phát hành đã thay đổi:

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

Xoá nhân viên hỗ trợ

Vì lý do bảo mật, nhân viên hỗ trợ RBM không thể bị xoá được nữa. Hãy liên hệ với Bộ phận hỗ trợ RBM để được trợ giúp.