列出运营商(区域)

RBM 管理 API 中将可启动 RBM 代理的运营商网络定义为“地区”。

RBM 支持团队会维护最新的运营商列表,随着越来越多的运营商采用 RBM,该列表也会不断扩大。

本页面上的代码段摘自 Java 示例Node.js 示例

列出区域

您需要先检索可发布地区的列表,然后才能提交代理以供发布。如需了解详情,请参阅 regions.list

cURL

curl -v "https://businesscommunications.googleapis.com/v1/regions" \
  -H "Content-Type: application/json" \
  -H "User-Agent: curl/business-messaging" \
  -H "`oauth2l header --json rbm-developer-service-account-credentials.json businesscommunications`"
此代码摘自我们的 RBM 管理 API 示例

Node.js

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

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

businessCommunicationsApiHelper.initBusinessCommunucationsApi(privateKey);

businessCommunicationsApiHelper.listRegions().then((response) => {
  console.log(response.data);
}).catch((err) => {
  console.log(err);
});  

Java

List<RcsBusinessMessagingRegion> regions = api.listAllRbmLaunchRegions();
List<String> regionIds = regions.stream().map(RcsBusinessMessagingRegion::getName).sorted()
  .collect(Collectors.toList());
logger.info("Fetched region Ids: " + regionIds);

此代码会返回可提交代理以供发布的所有运营商的列表:

{
  regions: [
    {
      name: '/v1/regions/dt-germany',
      displayName: 'Germany: DT',
      managementType: 'CARRIER_MANAGED'
    },
   {
      name: '/v1/regions/9mobile-nigeria',
      displayName: 'Nigeria: 9 Mobile',
      managementType: 'GOOGLE_MANAGED'
    },
    ...
    ...
  ]
}

如果运营商被列为 CARRIER_MANAGED,则表示其自行负责审批流程,并向订阅者收取 RBM 消息递送费用。您需要先与这些运营商直接签订商业协议,然后才能向其订阅者传送 RBM 消息。