携帯通信会社向けの 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": "NON_CONVERSATIONAL"
},
"agentUseCase": "MULTI_USE",
"hostingRegion": "NORTH_AMERICA",
"partner": {
"partnerId": "unique-identifier-for-my-partner",
"displayName": "My partner",
"company": "Public name of the company for my partner"
}
}
},
{
"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"
},
"agentUseCase": "PROMOTIONAL",
"hostingRegion": "NORTH_AMERICA",
"partner": {
"partnerId": "unique-identifier-for-my-partner",
"displayName": "My partner",
"company": "Public name of the company for my partner"
}
}
}
]
}
結果は 1 ページずつ取得できます。詳細については、 API リファレンス を参照してください。
エージェントの確認情報を取得する
携帯通信会社は、エージェントのブランド確認のステータスを取得できます。詳細については、
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`"
呼び出し元は、ブランド名を含む完全なエージェント名を必ずしも必要としません。
ブランド名を - に設定したエージェント ID(@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`"
呼び出し元は、ブランド名を含む完全なエージェント名を必ずしも必要としません。
ブランド名を - に設定したエージェント ID(@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`"
呼び出し元は、ブランド名を含む完全なエージェント名を必ずしも必要としません。
ブランド名を - に設定したエージェント ID(@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": "NON_CONVERSATIONAL"
},
"agentUseCase": "MULTI_USE",
"hostingRegion": "NORTH_AMERICA",
"partner": {
"partnerId": "unique-identifier-for-my-partner",
"displayName": "My partner",
"company": "Public name of the company for my partner"
}
}
}
エージェントの起動ステータスを変更する
携帯通信会社は、エージェントの起動ステータスを更新し、ステータスの変更理由を説明するコメントを含めることができます。
ステータスは次のように変更する必要があります。
LAUNCH_STATE_PENDINGからLAUNCH_STATE_LAUNCHEDまたはLAUNCH_STATE_REJECTEDLAUNCH_STATE_LAUNCHEDからLAUNCH_STATE_SUSPENDEDLAUNCH_STATE_SUSPENDEDからLAUNCH_STATE_LAUNCHEDまたはLAUNCH_STATE_UNLAUNCHED
呼び出し元は、ブランド名を含む完全なエージェント名を必ずしも必要としません。
ブランド名を - に設定したエージェント ID(@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": "John Doe",
"title": "Contact manager",
"email": "john.doe@gmail.com"
}
],
"optinDescription": "Users accepted our terms of service online.",
"triggerDescription": "We are reaching pre-registered users",
"interactionsDescription": "This agent sends notifications and processes suggested replies.",
"optoutDescription": "Reply stop and we stop.",
"agentAccessInstructions": "This is 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.", // Note: The field is optional only for launch approval; otherwise, required.
"updateTime": "2023-04-28T15:22:10.221191Z"
}
}
}
}
エージェントを表示または非表示にする
ワークスペースを整理整頓するために、ネットワークで使用されなくなったエージェントを非表示にできます。エージェントを非表示にすると、デフォルトの API 検出結果から削除されます。
非表示は表示のみの変更です。特定の携帯通信会社のビューにのみ影響し、パートナーや他の携帯通信会社のエージェントのステータスには影響しません。エージェントはいつでも再表示して、表示を復元し、管理を続行できます。
アクティブなエージェントが誤って非表示にならないように、次のルールが適用されます。
- 対象: ネットワーク上で非アクティブな状態(一時停止 または拒否 )のエージェントのみを非表示にできます。
- 制限事項: ネットワークでの起動ステータスが [起動済み] または [確認待ち] の場合、エージェントを非表示にすることはできません。このようなエージェントを非表示にしようとすると、リクエストは
FAILED_PRECONDITIONエラーで拒否されます。
非表示ステータスを更新する
携帯通信会社のエージェントの起動を表示または非表示にするには、起動リソースの setAgentLaunchVisibility メソッドを使用します。非表示にするには、isHidden ブール値を true に設定し、再表示するには false に設定します。
メソッド:
POST /v1/brands/{brandId}/agents/{agentId}/launch:setAgentLaunchVisibility
curl -v -X POST "https://businesscommunications.googleapis.com/v1/brands/$BRAND_ID/agents/$AGENT_ID/launch:setAgentLaunchVisibility" \
-H "Content-Type: application/json" \
-H "User-Agent: curl/business-messaging" \
-H "$(oauth2l header --json serviceAccount.json businesscommunications)" \
--data '{
"name": "brands/$BRAND_ID/agents/$AGENT_ID/launch",
"isHidden": true
}'
{
"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_SUSPENDED",
"updateTime": "2026-02-20T15:10:36.528669Z",
"isHidden": true
}
}
}
}
フィルタを使用してエージェントを一覧表示する
デフォルトでは、list メソッドは携帯通信会社によって非表示にされたエージェントを除外します。結果に含めるには、includeHidden パラメータを使用します。
エージェントを削除する
セキュリティ上の理由から、RBM エージェントを削除することはできなくなりました。サポートが必要な場合は、 RCS for Business サポートチームにお問い合わせください。