在 RBM Management 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`"
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 訊息,您必須先與這些電信業者簽訂商業協議。