모든 에이전트는 브랜드 (비즈니스, 조직 또는 그룹)에 속합니다. 에이전트를 만들려면 먼저 소유 브랜드를 만들어야 합니다. 브랜드는 관련 에이전트를 함께 그룹화하는 데 도움이 되는 순전히 조직적인 것입니다.
이 페이지의 코드 스니펫은 Java 샘플 및 Node.js 샘플에서 가져온 것입니다.
에이전트 생성 및 정의
에이전트 만들기
RBM 에이전트를 만들려면 기본 정보를 정의해야 합니다.
자세한 내용은 brands.agents.create를 참고하세요.
cURL
curl -v -X POST "https://businesscommunications.googleapis.com/v1/$BRAND_ID/agents" \ -H "Content-Type: application/json" \ -H "User-Agent: curl/business-messaging" \ -H "`oauth2l header --json rbm-developer-service-account-credentials.json businesscommunications`" \ -d "{ 'displayName': 'My test agent', 'rcsBusinessMessagingAgent': { 'description': 'My agent description', 'logoUri': 'https://agent-logos.storage.googleapis.com/_/kt90w53vzw2QSxK6PG1uCeJf', 'heroUri': 'https://agent-logos.storage.googleapis.com/_/kt90vzob74GQcfeHoEQbVRTP', 'phoneNumbers': [ { 'phoneNumber': { 'number': '+44800088088' }, 'label': 'My number' } ], 'emails': [ { 'address': 'support@demo.test', 'label': 'My email' } ], 'websites': [ { 'uri': 'https://a.demo.test/', 'label': 'My site' } ], 'privacy': { 'uri': 'https://a.demo.test/privacy', 'label': 'My privacy policy' }, 'termsConditions': { 'uri': 'https://a.demo.test/terms', 'label': 'My terms' }, 'color': '#FFFFFF', 'billingConfig': { 'billingCategory': 'CONVERSATIONAL' }, 'agentUseCase': 'TRANSACTIONAL', 'hostingRegion': 'EUROPE' } }"
Node.js
const businessCommunicationsApiHelper = require('@google/rbm-businesscommunications'); const privateKey = require('../../resources/businesscommunications-service-account-credentials.json'); businessCommunicationsApiHelper.initBusinessCommunucationsApi(privateKey); const newAgentDetails = { displayName: 'My new agent', name: brandId + '/agents/', 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' } ], // It's recommended to provide at least one contact method (phone or email) because // this is required for launch. For any phone, email, or website provided, a corresponding label // must also be included. 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: 'TRANSACTIONAL', hostingRegion: 'EUROPE' } }; businessCommunicationsApiHelper.createAgent(brandId, newAgentDetails).then((response) => { }).catch((err) => { console.log(err); });
자바
Brand brand = api.getBrand(brandId); logger.info("Brand to operate on: " + brand); String displayName = flags.getOrDefault("agent_name", "Test RBM Agent: " + now.getSecond()); String suffix = flags.getOrDefault("agent_data_suffix", "API"); RcsBusinessMessagingAgent agentData = AgentFactory.createRbmAgent(suffix); Agent agent = api.createRbmAgent(brand, displayName, agentData); logger.info("RBM agent has been created: " + agent);
이 코드는 새 에이전트 정보와 에이전트에 할당된 고유 식별자를 반환합니다.
{
name: 'brands/40bd963f-ff92-425c-b273-8f0892d2d017/agents/my_new_agent_dxuewtvy_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: [ [Object] ],
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: 'EUROPE'
}
}
에이전트 정의 조회
고유 식별자 (name)를 지정하여 에이전트를 검색할 수 있습니다. 자세한 내용은 brands.agents.list를 참고하세요.
Node.js
const businessCommunicationsApiHelper = require('@google/rbm-businesscommunications'); const privateKey = require('../../resources/businesscommunications-service-account-credentials.json'); businessCommunicationsApiHelper.initBusinessCommunucationsApi(privateKey); // Retrieve details of the first agent (if one has already been created) businessCommunicationsApiHelper.getAgent(agent.name).then((response) => { }).catch((err) => { console.log(err); });
자바
Agent agent = api.getAgent(flags.get("agent_id")); logger.info("Agent: " + agent);
이 코드는 에이전트 정보를 반환합니다.
{
name: 'brands/40bd963f-ff92-425c-b273-8f0892d2d017/agents/my_new_agent_dxuewtvy_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: [ [Object] ],
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: 'EUROPE'
}
}
인증 및 출시
인증 정보 제출
브랜드 인증 은 에이전트 출시를 위해 필요합니다. 출시 요청을 하기 전에 인증 정보를 제출해야 합니다. 출시 요청을 하기 전에 브랜드 승인을 기다릴 필요는 없습니다. 브랜드 승인은 출시 승인 절차의 일부로 진행됩니다. 일부 이동통신사의 경우 인증 기관에서 발급한 유효한 인증 토큰도 제공해야 합니다.
자세한 내용은 brands.agents.requestVerification을 참고하세요.
cURL
curl -v "https://businesscommunications.googleapis.com/v1/brands/$BRAND_ID/agents/$AGENT_ID:requestVerification" \ -H "Content-Type: application/json" \ -H "x-http-method-override: POST" \ -H "User-Agent: curl/business-messaging" \ -H "$(oauth2l header --json PATH_TO_SERVICE_ACCOUNT_KEY businesscommunications)" \ -d "{ 'agentVerificationContact': { ... }, 'agentVerificationToken': {'tokenBase64Encoded': '$TOKEN'} }"
Node.js
const businessCommunicationsApiHelper = require('@google/rbm-businesscommunications'); const privateKey = require('../../resources/businesscommunications-service-account-credentials.json'); businessCommunicationsApiHelper.initBusinessCommunucationsApi(privateKey); let agentVerificationContact = { partnerName: 'Alice', partnerEmailAddress: 'alice@thepartner.com', brandContactName: 'Bob', brandContactEmailAddress: 'bob@thebrand.com', brandWebsiteUrl: 'https://thebrand.com/' }; businessCommunicationsApiHelper.verifyAgent(agent.name, agentVerificationContact).then((response) => { }).catch((err) => { console.log(err); });
자바
AgentVerificationContact contact = AgentFactory.createRbmAgentVerification(); AgentVerification verification = api.requestAgentVerification(agent.getName(), contact); logger.info("Verification requested: " + verification);
이 코드는 인증 정보를 반환합니다.
{
"name": "brands/40bd963f-ff92-425c-b273-8f0892d2d017/agents/my_new_agent_ciymyd2b_agent",
"verificationState": "VERIFICATION_STATE_UNVERIFIED",
"agentVerificationContact": {
"partnerName": "Alice",
"partnerEmailAddress": "alice@thepartner.com",
"brandContactName": "Bob",
"brandContactEmailAddress": "bob@thebrand.com",
"brandWebsiteUrl": "https://thebrand.com/"
},
"agentVerificationTokens": [
{
"verificationAuthorityDisplayName": "Example Verification Authority",
"expirationTime": "2027-06-16T13:45:14Z",
"status": "ACTIVE",
"countryCode": "US",
"tokenBase64Encoded": "...",
"certificateChainUri": "https://rbm.goog/certificates?v=5&kid=6CAE185529AABAC216565E99A8DE22504B086209"
}
]
}
에이전트의 인증 정보 조회
에이전트의 브랜드 인증 상태를 검색할 수 있습니다. 자세한 내용은
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(agent.name).then((response) => { }).catch((err) => { console.log(err); });
자바
AgentVerification verification = api.getAgentVerification(agent.getName()); logger.info("RBM agent verification: " + verification);
이 코드는 인증 상태와 파트너 정보를 반환합니다.
{
"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"
},
"agentVerificationTokens": [
{
"verificationAuthorityDisplayName": "Example Verification Authority",
"expirationTime": "2027-06-16T13:45:14Z",
"status": "ACTIVE",
"countryCode": "US",
"tokenBase64Encoded": "...",
"certificateChainUri": "https://rbm.goog/certificates?v=5&kid=6CAE185529AABAC216565E99A8DE22504B086209"
}
]
}
인증 토큰 업데이트 및 삭제
이미 출시된 에이전트가 있는 경우 인증 토큰으로 업데이트할 수 있습니다. 토큰을 추가하거나 업데이트하려면 updateVerification 메서드를 호출하고 (PATCH 요청 사용) agent_verification_tokens 업데이트 마스크를 지정합니다.
cURL
curl -v -X PATCH "https://businesscommunications.googleapis.com/v1/brands/$BRAND_ID/agents/$AGENT_ID/verification?updateMask=agent_verification_tokens" \ -H "Content-Type: application/json" \ -H "x-http-method-override: PATCH" \ -H "User-Agent: curl/business-messaging" \ -H "$(oauth2l header --json PATH_TO_SERVICE_ACCOUNT_KEY businesscommunications)" \ -d "{ 'agentVerificationTokens': [ {'tokenBase64Encoded': '$TOKEN'} ] }"
에이전트가 여러 국가에서 출시된 경우 해당 리전의 승인된 인증 기관에서 발급한 토큰을 여러 개 (국가별로 하나씩) 지정해야 할 수 있습니다. 추가 토큰을 지정하려면 updateVerification 메서드를 호출하고 이미 연결된 토큰을 포함하여 에이전트와 연결할 모든 토큰을 제공합니다.
에이전트와 연결된 모든 토큰을 삭제하려면 PATCH 요청에서 빈 목록을 전송합니다.
cURL
curl -v -X PATCH "https://businesscommunications.googleapis.com/v1/brands/$BRAND_ID/agents/$AGENT_ID/verification?updateMask=agent_verification_tokens" \ -H "Content-Type: application/json" \ -H "x-http-method-override: PATCH" \ -H "User-Agent: curl/business-messaging" \ -H "$(oauth2l header --json PATH_TO_SERVICE_ACCOUNT_KEY businesscommunications)" \ -d "{}"
인증 토큰 오류 문제 해결
인증 토큰을 관리하고 출시를 요청할 때 다음과 같은 오류가 발생할 수 있습니다.
- 출시를 위한 토큰 누락: 토큰이 필요한 이동통신사에서 출시를 요청했지만 에이전트에 토큰이 없는 경우
400 error(예:"Verification token matching agent <...> and carrier country US is missing")가 표시됩니다. - 에이전트 데이터 불일치: 에이전트 프로필의 에이전트 ID, 에이전트 이름, 로고, 배너는 토큰에 삽입된 데이터와 정확히 일치해야 합니다. 일치하지 않는 토큰을 연결하려고 하거나 일치하지 않는 토큰으로 출시를 요청하면
400 error(예:"Agent ID mismatch. Request agent ID: <...>, Token agent ID: <...>").
출시를 위해 에이전트 제출
하나 이상의 이동통신사에서 출시를 위해 에이전트를 제출할 수 있습니다. 일부 출시는 Google에서 관리하고 일부는 이동통신사에서 직접 관리합니다. 이동통신사에서 관리하는 출시에는 추가 요구사항이 있을 수 있습니다. 자세한 내용은 Google 관리 출시와 이동통신사 관리 출시 를 참고하세요.
에이전트를 처음 출시하려면 인증 정보를 제출해야 합니다. 이렇게 하면 Google, 이동통신사 또는 둘 다 브랜드 담당자에게 귀하가 대리인으로 에이전트를 관리할 권한이 있는지 확인할 수 있습니다. 자세한 내용은 브랜드 인증 을 참고하세요.
인증 정보를 제출하고 출시 사전 요구사항을 완료하면 출시 요청을 제출할 수 있습니다.
하나 이상의 이동통신사에서 출시를 위해 에이전트를 제출할 수 있습니다. 완료된 출시 설문지는 출시 요청의 일부로 제공되어야 합니다. 자세한 내용은 brands.agents.requestLaunch를 참고하세요.
cURL
curl -v -X POST "https://businesscommunications.googleapis.com/v1/$AGENT_ID:requestLaunch" \ -H "Content-Type: application/json" \ -H "User-Agent: curl/business-messaging" \ -H "`oauth2l header --json rbm-developer-service-account-credentials.json businesscommunications`" \ -d "{ 'agentLaunch': { 'rcsBusinessMessaging': { 'questionnaire': { 'contacts': [ { 'name': 'John Doe', 'title': 'Product Owner', 'email': 'support@demo.test' } ], 'optinDescription': 'Thanks for your request.', 'triggerDescription': 'Promotional messages will be triggered in a timely manner.', 'interactionsDescription': 'Promotional messages are one way.', 'optoutDescription': 'Sorry to see you go.', 'agentAccessInstructions': 'Thanks for your request.', 'videoUris': [ 'https://d2q4iodazzzt8b.cloudfront.net/MicrosoftTeamsvideo2_1758533835.mp4' ], 'screenshotUris': [ 'https://rm.virbm.com/Il9ChvVEhS1na5mr/ee9bc94b468a40688fb7fc71cb1c069c.png' ] }, 'launchDetails': { '/v1/regions/$CARRIER_ID': {} } } } }"
Node.js
const businessCommunicationsApiHelper = require('@google/rbm-businesscommunications'); const privateKey = require('../../resources/businesscommunications-service-account-credentials.json'); businessCommunicationsApiHelper.initBusinessCommunucationsApi(privateKey); let agentLaunch = { questionnaire: { contacts: [ { name: 'James Bond', title: 'Mr 0 0 7', 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: {} }; businessCommunicationsApiHelper.launchAgent(agent.name, agentLaunch).then((response) => { }).catch((err) => { console.log(err); });
자바
Optional<Questionnaire> q = Optional.of(AgentFactory.createRbmQuestionnaire()); AgentLaunch launch = api.requestRbmAgentLaunch(agent.getName(), regionIds, q); logger.info("RBM agent updated launch: " + launch);
이 코드는 에이전트 출시 정보를 반환합니다.
{
"name": "brands/40bd963f-ff92-425c-b273-8f0892d2d017/agents/my_new_agent_7jo0trhw_agent/launch",
"rcsBusinessMessaging": {
"questionnaire": {
"contacts": [
{
"name": "James Bond",
"title": "Mr O O 7",
"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/some-carrier": {
"launchState": "LAUNCH_STATE_PENDING",
"updateTime": "2023-02-24T15:02:13.903554Z"
}
},
"launchRegion": "NORTH_AMERICA"
}
}
launchRegion은 지원 중단되었으며 곧 삭제될 예정입니다.
하나 이상의 리전에 에이전트 출시
에이전트가 이전에 출시되지 않은 경우 하나 이상의 리전에 에이전트를 출시하려면 에이전트를 출시할 모든 리전의
키만 포함된 맵이 포함된 객체로 requestLaunch 메서드를 호출합니다. 빈 맵을 사용하면 API 호출 간에 사용되는 객체에서 내부 API 일관성을 유지할 수 있습니다.
curl -X POST \ "https://businesscommunications.googleapis.com/v1/brands/BRAND_ID/agents/AGENT_ID:requestLaunch" \ -H "Content-Type: application/json" \ -H "$(oauth2l header --json PATH_TO_SERVICE_ACCOUNT_KEY businesscommunications)" \ -d "{ 'name': 'brands/BRAND_ID/agents/AGENT_ID/launch', 'rcsBusinessMessaging': { 'questionnaire': { 'contacts': [ { 'name': 'Contact person 000', 'title': 'Contact manager 000', 'email': 'user@domain.com000' } ], 'optinDescription': 'Opt-in description 0', 'triggerDescription': 'Trigger description 0', 'optoutDescription': 'Opt-out description 0', 'agentAccessInstructions': 'Agent instructions 0', 'videoUris': [ 'https://www.youtube.com/watch?v=NN75im_us4k' ], 'screenshotUris': [ 'https://www.youtube.com/watch?v=NN75im_us4k' ] }, 'launchDetails': { '/v1/regions/fi-rcs': {} } } }"
에이전트가 이전에 출시된 경우 하나 이상의 리전에 에이전트를 출시하려면 에이전트가 이미 출시된 모든 리전 및 에이전트를 출시하려는 모든 리전의 키만 포함된 맵이 포함된 객체로 requestLaunch 메서드를 호출합니다. 빈 맵을 사용하면 API 호출 간에 사용되는 객체에서 내부 API 일관성을 유지할 수 있습니다.
curl -X POST \ "https://businesscommunications.googleapis.com/v1/brands/BRAND_ID/agents/AGENT_ID:requestLaunch" \ -H "Content-Type: application/json" \ -H "$(oauth2l header --json PATH_TO_SERVICE_ACCOUNT_KEY businesscommunications)" \ -d "{ 'name': 'brands/BRAND_ID/agents/AGENT_ID/launch', 'rcsBusinessMessaging': { 'launchDetails': { '/v1/regions/fi-rcs': {}, '/v1/regions/vodafone-idea-india': {} } } }"
에이전트가 requestLaunch 메서드를 호출하지만 에이전트가 이미 출시된 모든 리전을 키로 포함하지 않으면 400 - Bad Request 오류가 발생합니다.
에이전트의 출시 상태 조회
에이전트의 현재 출시 상태를 검색할 수 있습니다. 자세한 내용은,
brands.agents.getLaunch를 참고하세요.
Node.js
const businessCommunicationsApiHelper = require('@google/rbm-businesscommunications'); const privateKey = require('../../resources/businesscommunications-service-account-credentials.json'); businessCommunicationsApiHelper.initBusinessCommunucationsApi(privateKey); businessCommunicationsApiHelper.getAgentLaunch(agent.name).then((response) => { }).catch((err) => { console.log(err); });
자바
AgentLaunch launch = api.getAgentLaunch(agent.getName()); logger.info("RBM agent launch: " + launch);
이동통신사에서 출시를 거부하면 파트너가 이동통신사에서 출시를 다시 요청할 수 있습니다 (요청에 UNSPECIFIED 상태가 있고 백엔드에 REJECTED 상태가 있음).
이 코드는 각 타겟 이동통신사의 출시 정보와 출시 상태를 반환합니다.
{
"name": "brands/40bd963f-ff92-425c-b273-8f0892d2d017/agents/my_new_agent_7jo0trhw_agent/launch",
"rcsBusinessMessaging": {
"questionnaire": {
"contacts": [
{
"name": "James Bond",
"title": "Mr O O 7",
"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/some-carrier": {
"launchState": "LAUNCH_STATE_PENDING",
"updateTime": "2023-02-24T15:02:13.903554Z"
}
},
"launchRegion": "NORTH_AMERICA"
}
}
launchRegion은 지원 중단되었으며 곧 삭제될 예정입니다.
에이전트의 출시에 이동통신사 추가
brands.agents.getLaunch API 호출을 사용하여 에이전트의 현재 출시 정보를 검색한 후 타겟 이동통신사를 더 추가하여 에이전트의 도달범위를 넓힐 수 있습니다. 자세한 내용은
brands.agents.updateLaunch를 참고하세요.
Node.js
const businessCommunicationsApiHelper = require('@google/rbm-businesscommunications'); const privateKey = require('../../resources/businesscommunications-service-account-credentials.json'); businessCommunicationsApiHelper.initBusinessCommunucationsApi(privateKey);'); // To launch an agent to further carriers, we need to first obtain the existing // launch information and extend it with the new carrier(s). businessCommunicationsApiHelper.getAgentLaunch(agent.name).then((response) => { let existingLaunch = response.data.rcsBusinessMessaging; // Now we add the new carrier to the existing launch existingLaunch.launchDetails[config.launchCarrier2] = null; // And we submit the launch again businessCommunicationsApiHelper.launchAgent(agent.name, existingLaunch).then((response) => { console.log('Launch details are:'); console.log(JSON.stringify(response.data, null, 2)); }).catch((err) => { console.log(err); }); }).catch((err) => { console.log(err); });
이 코드는 업데이트된 출시 정보를 반환합니다.
{
"name": "brands/40bd963f-ff92-425c-b273-8f0892d2d017/agents/my_new_agent_7jo0trhw_agent/launch",
"rcsBusinessMessaging": {
"questionnaire": {
"contacts": [
{
"name": "James Bond",
"title": "Mr O O 7",
"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/some-carrier": {
"launchState": "LAUNCH_STATE_PENDING",
"updateTime": "2023-02-24T15:02:13.903554Z"
},
"/v1/regions/another-carrier": {
"launchState": "LAUNCH_STATE_PENDING",
"updateTime": "2023-02-24T15:04:50.456552Z"
}
},
"launchRegion": "NORTH_AMERICA"
}
}
출시 후 및 유지보수
브랜드에 생성된 모든 에이전트 나열
개발자는 브랜드에 생성한 모든 에이전트 목록을 검색할 수 있습니다.
자세한 내용은
brands.agents.list를 참고하세요.
Node.js
const businessCommunicationsApiHelper = require('@google/rbm-businesscommunications'); const privateKey = require('../../resources/businesscommunications-service-account-credentials.json'); businessCommunicationsApiHelper.initBusinessCommunucationsApi(privateKey); businessCommunicationsApiHelper.listAgents(brand.name).then((response) => { console.log('Current agents are:'); console.log(response.data); datastore.saveJsonData('agents', response.data.agents); }).catch((err) => { console.log(err); });
자바
Brand brand = api.getBrand(brandId); logger.info("Brand: " + brand); ListAgentsResponse response = api.listAllAgents(brand); List<Agent> agents = response.getAgents().stream() .sorted(Comparator.comparing(Agent::getName)).collect(Collectors.toList()); logger.info(String.format("Found %d agents", response.getAgents().size())); for (Agent agent : agents) { logger.info(String.format("Agent [%s]: '%s'", agent.getName(), agent.getDisplayName())); }
이 코드는 브랜드가 소유한 모든 에이전트 목록을 반환합니다.
{
agents: [
{
name: 'brands/40bd963f-ff92-425c-b273-8f0892d2d017/agents/my_new_agent_4fpd1psz_agent',
displayName: 'My new agent',
rcsBusinessMessagingAgent: [Object]
},
{
name: 'brands/40bd963f-ff92-425c-b273-8f0892d2d017/agents/my_new_agent_ciymyd2b_agent',
displayName: 'My second agent',
rcsBusinessMessagingAgent: [Object]
},
{
name: 'brands/40bd963f-ff92-425c-b273-8f0892d2d017/agents/my_new_agent_helof85o_agent',
displayName: 'My third agent',
rcsBusinessMessagingAgent: [Object]
}
]
}
보관처리된 에이전트 포함
기본적으로 모든 에이전트 목록에는 파트너가 보관처리한 에이전트가 제외됩니다.
보관처리된 에이전트를 결과에 포함하려면 includeArchived 매개변수를 true로 설정합니다.
Node.js
`listAgents` 메서드는 보관처리된 에이전트를 포함하기 위한 선택적 구성 객체를 허용합니다.const businessCommunicationsApiHelper = require('@google/rbm-businesscommunications'); const privateKey = require('../../resources/businesscommunications-service-account-credentials.json'); businessCommunicationsApiHelper.initBusinessCommunicationsApi(privateKey); // To list all agents including archived ones, set includeArchived to true const listOptions = { includeArchived: true }; businessCommunicationsApiHelper.listAgents(brand.name, listOptions).then((response) => { console.log('Current agents (including archived) are:'); console.log(response.data); datastore.saveJsonData('agents', response.data.agents); }).catch((err) => { console.log(err); });
자바
`listAllAgents` 메서드에는 공개 상태 제어를 위한 불리언 매개변수가 포함되어 있습니다.// To list all agents including archived ones, pass 'true' for the includeArchived parameter boolean includeArchived = true; Brand brand = api.getBrand(brandId); logger.info("Brand: " + brand); // Call listAllAgents with the brand and the includeArchived flag ListAgentsResponse response = api.listAllAgents(brand, includeArchived); Listagents = response.getAgents().stream() .sorted(Comparator.comparing(Agent::getName)).collect(Collectors.toList()); logger.info(String.format("Found %d agents (including archived)", response.getAgents().size())); for (Agent agent : agents) { logger.info(String.format("Agent [%s]: '%s' (Archived: %s)", agent.getName(), agent.getDisplayName(), agent.getIsArchived())); }
에이전트 사용 중지
특정 리전에서 에이전트 출시를 취소하려면 updateLaunch 메서드를 호출하고
호출의 맵에서 타겟 리전을 지정하고 launchState을
LAUNCH_STATE_UNLAUNCHED로 설정합니다.
curl -X PATCH \ "https://businesscommunications.googleapis.com/v1/brands/BRAND_ID/agents/AGENT_ID/launch" \ -H "Content-Type: application/json" \ -H "$(oauth2l header --json PATH_TO_SERVICE_ACCOUNT_KEY businesscommunications)" \ -d "{ 'rcsBusinessMessaging': { 'launchDetails': { '/v1/regions/fi-rcs': { 'launchState': 'LAUNCH_STATE_UNLAUNCHED' }, '/v1/regions/vodafone-idea-india': { 'launchState': 'LAUNCH_STATE_UNLAUNCHED' } } } }"
에이전트 삭제
보안상의 이유로 더 이상 RBM 에이전트를 삭제할 수 없습니다. 도움이 필요하면 RCS for Business 지원팀에 문의하세요.
에이전트 보관처리 또는 보관 취소
정리되고 체계적인 작업공간을 유지하기 위해 더 이상 사용하지 않는 에이전트를 보관처리할 수 있습니다. 에이전트를 보관처리하면 기본 API 검색 결과에서 숨겨집니다.
보관처리는 공개 상태만 변경합니다. 에이전트를 삭제하거나 기본 출시 상태에 영향을 미치지 않습니다. 언제든지 에이전트 보관처리를 취소하여 공개 상태를 복원하고 관리를 계속할 수 있습니다.
활성 에이전트가 실수로 숨겨지지 않도록 다음 규칙이 적용됩니다.
- 자격 요건: 비활성 상태(
UNLAUNCHED,SUSPENDED또는REJECTED)인 에이전트만 보관처리할 수 있습니다. - 제한사항: 이동통신사에서
LAUNCHED또는PENDING인 에이전트는 보관처리할 수 없습니다. 이러한 에이전트를 보관처리하려고 하면 요청이 거부되고 오류가 발생합니다.
보관 상태 업데이트
에이전트를 보관처리하거나 보관 취소하려면 패치 메서드를 사용합니다. 업데이트되는 필드를 지정하려면 URL에 updateMask=is_archived 매개변수를 포함해야 합니다. 보관처리하려면 isArchived 불리언을 true로 설정하고 보관 취소하려면 false로 설정합니다.
메서드: PATCH /v1/brands/{brandId}/agents/{agentId}
업데이트 마스크에 is_archived를 추가합니다.
{
"isArchived": true
}
필터를 사용하여 에이전트 나열
기본적으로 list 메서드는 보관처리된 에이전트를 숨깁니다. 결과에 포함하려면 include_archived 매개변수를 사용합니다.
메서드: GET /v1/brands/{brandId}/agents?include_archived=true