เวิร์กโฟลว์ 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"
}
}
}
]
}
คุณสามารถดึงข้อมูลผลลัพธ์ได้ทีละหน้า ดูรายละเอียดได้ที่ เอกสารอ้างอิง 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`"
ผู้เรียกไม่จำเป็นต้องระบุชื่อตัวแทนแบบเต็ม รวมถึงชื่อแบรนด์
โดยต้องระบุเฉพาะรหัสตัวแทน (ก่อน @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`"
ผู้เรียกไม่จำเป็นต้องระบุชื่อตัวแทนแบบเต็ม รวมถึงชื่อแบรนด์
โดยต้องระบุเฉพาะรหัสตัวแทน (ก่อน @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`"
ผู้เรียกไม่จำเป็นต้องระบุชื่อตัวแทนแบบเต็ม รวมถึงชื่อแบรนด์
โดยต้องระบุเฉพาะรหัสตัวแทน (ก่อน @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
ผู้เรียกไม่จำเป็นต้องระบุชื่อตัวแทนแบบเต็ม รวมถึงชื่อแบรนด์
โดยต้องระบุเฉพาะรหัสตัวแทน (ก่อน @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