گردش کار اصلی RBM برای اپراتورها شامل بررسی اطلاعات مربوط به نمایندگان جدید و تأیید یا رد مجوز آنها برای راهاندازی در شبکه اپراتور و ارسال پیام به مشترکینشان است.
قطعه کدهای این صفحه از نمونههای جاوااسکریپت و کرل ما گرفته شدهاند.
تمام نمایندگانی که به یک شرکت حمل و نقل ارائه شدهاند را فهرست کنید
اپراتور میتواند فهرستی از تمام نمایندگانی که توسعهدهندگان برای راهاندازی در شبکه اپراتور ارائه کردهاند، دریافت کند.
نود جی اس
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 -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 مراجعه کنید.
نود جی اس
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 -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"
}
}
وضعیت راهاندازی نمایندگی و پرسشنامه را دریافت کنید
شرکت مخابراتی میتواند وضعیت راهاندازی فعلی یک نماینده و پرسشنامه راهاندازی توسعهدهنده را دریافت کند.
نود جی اس
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 -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 ) بازیابی کند.
نود جی اس
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 -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_REJECTED -
LAUNCH_STATE_LAUNCHEDتاLAUNCH_STATE_SUSPENDED -
LAUNCH_STATE_SUSPENDEDبهLAUNCH_STATE_LAUNCHEDیاLAUNCH_STATE_UNLAUNCHEDتغییر دهید.
تماسگیرنده لزوماً به نام کامل نماینده، شامل نام تجاری، نیاز ندارد. فقط شناسه نماینده (قبل از @rbm.goog ) به همراه نام تجاری که روی - تنظیم شده باشد، مورد نیاز است.
نود جی اس
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 -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 حذف میکند.
پنهان کردن یک تغییر فقط برای قابلیت مشاهده است. این تغییر فقط روی نمای اپراتور خاص شما تأثیر میگذارد و بر وضعیت اپراتور برای اپراتور همکار یا سایر اپراتورها تأثیری ندارد. میتوانید در هر زمان یک اپراتور را از حالت پنهان خارج کنید تا قابلیت مشاهده آن بازیابی شود و مدیریت ادامه یابد.
برای اطمینان از اینکه عوامل فعال به طور تصادفی از دید خارج نشوند، قوانین زیر اعمال میشود:
- واجد شرایط بودن : شما فقط میتوانید عاملهایی را که در شبکه شما در حالت غیرفعال هستند ( معلق یا رد شده ) پنهان کنید.
- محدودیتها : اگر وضعیت راهاندازی یک عامل در شبکه شما Launched یا Pending باشد، نمیتوانید آن را پنهان کنید. اگر سعی کنید چنین عاملی را پنهان کنید، درخواست با خطای
FAILED_PRECONDITIONرد خواهد شد.
بهروزرسانی وضعیت پنهان
برای مخفی کردن یا نمایش دادن یک agent launch برای حامل خود، از متد setAgentLaunchVisibility در منبع launch استفاده کنید. برای مخفی کردن، مقدار بولی 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 تماس بگیرید .