Business Messages एजेंट, डायरेक्ट इंटिग्रेशन के साथ काम करते हैं
- Dialogflow ES: इंटेंट मैचिंग और अक्सर पूछे जाने वाले सवाल के बॉट
- Dialogflow CX: इंटेंट मैचिंग और लाइव एजेंट हैंडऑफ़
Business Messages एजेंट को Dialogflow ES या Dialogflow CX की दूसरी सुविधाओं के साथ इंटिग्रेट करने के लिए, हर प्रॉडक्ट के दस्तावेज़ देखें.
जब कोई उपयोगकर्ता किसी ऐसे एजेंट को मैसेज भेजता है जिसमें Dialogflow के साथ काम करने की सुविधा शामिल होती है,
तो Business Messages उपयोगकर्ता को Dialogflow के मैसेज भेजता है. साथ ही, Dialogflow's का जवाब, मैसेज में मौजूद dialogflowResponse
ऑब्जेक्ट को भेजता है. एजेंट को इस तरह कॉन्फ़िगर किया जा सकता है कि वे आपकी ओर से किसी कार्रवाई के बिना, Dialogflow'के जवाब को अपने-आप भेजें. ज़्यादा जानकारी के लिए, अपने-आप दिए जाने वाले जवाब देखें.
Dialogflow के साथ काम करने की सुविधा
Business Messages की मदद से, Dialogflow के आधार पर ऑटोमेशन का इस्तेमाल करने से पहले, आपको Dialogflow के साथ काम करने की सुविधा को चालू करना होगा.
ज़रूरी शर्तें
शुरू करने के लिए, आपको इनकी ज़रूरत होगी
- Business Messages एजेंट
- ग्लोबल इलाके में Dialogflow एजेंट की मूल भाषा अंग्रेज़ी है (en)
अगर आपके पास Dialogflow एजेंट नहीं है, तो एक बनाएं.
Dialogflow ES
Dialogflow ES के इंटिग्रेशन को चालू करने से पहले, आपको अपने Dialogflow एजेंट और प्रोजेक्ट आईडी की ज़रूरत होगी. प्रोजेक्ट आईडी का पता लगाने के लिए.
- Dialogflow कंसोल पर जाएं.
- वह Dialogflow एजेंट चुनें जिसे आप Business Messages से कनेक्ट करना चाहते हैं, फिर एजेंट के नाम के बगल में दिए गए गियर आइकॉन पर क्लिक करें.
- Google प्रोजेक्ट में, प्रोजेक्ट आईडी की वैल्यू को नोट करें.
Dialogflow CX
Dialogflow CX इंटिग्रेशन को चालू करने से पहले, आपको अपने Dialogflow एजेंट और प्रोजेक्ट आईडी की ज़रूरत होगी. इन आईडी का पता लगाने के लिए.
- Dialogflow CX कंसोल पर जाएं.
- अपना Dialogflow प्रोजेक्ट चुनें.
- एजेंट सिलेक्टर में, अपने Dialogflow एजेंट के बगल में मौजूद ओवरफ़्लो मेन्यू पर क्लिक करें.
- नाम कॉपी करें पर क्लिक करें. इससे आपके एजेंट का पूरा नाम इस फ़ॉर्मैट में कॉपी होता है:
projects/PROJECT_ID/locations/REGION_ID/agents/AGENT_ID
. - प्रोजेक्ट आईडी और एजेंट आईडी की वैल्यू नोट करें.
इंटिग्रेशन बनाएं
dialogflowServiceAccountEmail
से पार्टनर के Dialogflow की सेवा खाते का ईमेल पाएं. PARTNER_ID को अपने पार्टनर आईडी से बदलें.cURL
# This code gets the partner. # Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/partners/get # Replace the __PARTNER_ID__ # Make sure a service account key file exists at ./service_account_key.json curl -X GET \ "https://businesscommunications.googleapis.com/v1/partners/__PARTNER_ID__" \ -H "Content-Type: application/json" \ -H "User-Agent: curl/business-communications" \ -H "$(oauth2l header --json ./service_account_key.json businesscommunications)"
Node.js के लिए
/** * This code snippet gets a partner. * Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/partners/get * * This code is based on the https://github.com/google-business-communications/nodejs-businesscommunications Node.js * Business Communications client library. */ /** * Edit the values below: */ const PARTNER_ID = 'EDIT_HERE'; const PATH_TO_SERVICE_ACCOUNT_KEY = './service_account_key.json'; const businesscommunications = require('businesscommunications'); const {google} = require('googleapis'); // Initialize the Business Communications API const bcApi = new businesscommunications.businesscommunications_v1.Businesscommunications({}); // Set the scope that we need for the Business Communications API const scopes = [ 'https://www.googleapis.com/auth/businesscommunications', ]; // Set the private key to the service account file const privatekey = require(PATH_TO_SERVICE_ACCOUNT_KEY); async function main() { const authClient = await initCredentials(); const partnerName = 'partners/' + PARTNER_ID; if (authClient) { // Setup the parameters for the API call const apiParams = { auth: authClient, name: partnerName, }; bcApi.partners.get(apiParams, {}, (err, response) => { if (err !== undefined && err !== null) { console.dir(err); } else { // Agent found console.log(response.data); } }); } else { console.log('Authentication failure.'); } } /** * Initializes the Google credentials for calling the * Business Messages API. */ async function initCredentials() { // Configure a JWT auth client const authClient = new google.auth.JWT( privatekey.client_email, null, privatekey.private_key, scopes, ); return new Promise(function(resolve, reject) { // Authenticate request authClient.authorize(function(err, tokens) { if (err) { reject(false); } else { resolve(authClient); } }); }); } main();
Python
"""This code gets a partner. Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/partners/get This code is based on the https://github.com/google-business-communications/python-businessmessages Python Business Messages client library. """ from oauth2client.service_account import ServiceAccountCredentials from businesscommunications.businesscommunications_v1_client import BusinesscommunicationsV1 from businesscommunications.businesscommunications_v1_messages import ( Agent, BusinesscommunicationsPartnersGetRequest, ) # Edit the values below: PARTNER_ID = 'EDIT_HERE' SCOPES = ['https://www.googleapis.com/auth/businesscommunications'] SERVICE_ACCOUNT_FILE = './service_account_key.json' credentials = ServiceAccountCredentials.from_json_keyfile_name( SERVICE_ACCOUNT_FILE, scopes=SCOPES) client = BusinesscommunicationsV1(credentials=credentials) partners_service = BusinesscommunicationsV1.PartnersService(client) partner_name = 'partners/' + PARTNER_ID partner = partners_service.Get(BusinesscommunicationsPartnersGetRequest( name=partner_name )) print(partner)
सेवा खाते का ईमेल कॉपी करें. यह खाता आपके Business Messages और Dialogflow एजेंट से कनेक्ट करता है.
Google Cloud कंसोल में, अपना Dialogflow प्रोजेक्ट चुनें.
IAM अनुमतियां पर जाएं.
जोड़ें पर क्लिक करें और नए सदस्यों के लिए सेवा खाते का ईमेल पता डालें.
कोई भूमिका चुनने के लिए Dialogflow कंसोल एजेंट एडिटर चुनें.
कोई दूसरी भूमिका जोड़ें पर क्लिक करें और Dialogflow एपीआई क्लाइंट चुनें.
सेव करें पर क्लिक करें.
Dialogflow प्रोजेक्ट को Business Messages एजेंट के साथ जोड़ें.
AUTO_RESPONSE_STATUS को चालू या बंद करें, यह इस बात पर निर्भर करता है कि कारोबार के मैसेज, Dialogflow के जवाबों के साथ अपने-आप उपयोगकर्ताओं को जवाब देना चाहते हैं या नहीं.
Dialogflow ES
cURL
# This code creates a Dialogflow ES integration. # Read more: https://developers.google.com/business-communications/business-messages/guides/how-to/integrate/dialogflow?method=api#dialogflow_es # Replace the __BRAND_ID__, __AGENT_ID__, __DIALOGFLOW_ES_PROJECT_ID__ and __AUTO_RESPONSE_STATUS__ # Make sure a service account key file exists at ./service_account_key.json curl -X POST \ "https://businesscommunications.googleapis.com/v1/brands/__BRAND_ID__/agents/__AGENT_ID__/integrations" \ -H "$(oauth2l header --json ./service_account_key.json businesscommunications)" \ -H "Content-Type: application/json" \ -H "User-Agent: curl/business-communications" \ -d '{ "dialogflowEsIntegration": { "dialogflowProjectId": "__DIALOGFLOW_ES_PROJECT_ID__", "autoResponseStatus": "__AUTO_RESPONSE_STATUS__" } }'
Node.js के लिए
/** * This code snippet creates a Dialogflow ES integration. * Read more: https://developers.google.com/business-communications/business-messages/guides/how-to/integrate/dialogflow?method=api#dialogflow_es * * This code is based on the https://github.com/google-business-communications/nodejs-businesscommunications Node.js * Business Communications client library. */ /** * Edit the values below: */ const BRAND_ID = 'EDIT_HERE'; const AGENT_ID = 'EDIT_HERE'; const DIALOGFLOW_ES_PROJECT_ID = 'EDIT_HERE' const PATH_TO_SERVICE_ACCOUNT_KEY = './service_account_key.json'; const businesscommunications = require('businesscommunications'); const {google} = require('googleapis'); const uuidv4 = require('uuid').v4; // Initialize the Business Communications API const bcApi = new businesscommunications.businesscommunications_v1.Businesscommunications({}); // Set the scope that we need for the Business Communications API const scopes = [ 'https://www.googleapis.com/auth/businesscommunications', ]; // Set the private key to the service account file const privatekey = require(PATH_TO_SERVICE_ACCOUNT_KEY); async function main() { const authClient = await initCredentials(); const agentName = 'brands/' + BRAND_ID + '/agents/' + AGENT_ID; if (authClient) { const integrationObject = { dialogflowEsIntegration: { dialogflowProjectId: DIALOGFLOW_ES_PROJECT_ID, autoResponseStatus: 'ENABLED' } }; // Setup the parameters for the API call const apiParams = { auth: authClient, parent: agentName, resource: integrationObject }; bcApi.brands.agents.integrations.create(apiParams, {}, (err, response) => { if (err !== undefined && err !== null) { console.dir(err); } else { // Agent created console.log(response.data); } }); } else { console.log('Authentication failure.'); } } /** * Initializes the Google credentials for calling the * Business Messages API. */ async function initCredentials() { // Configure a JWT auth client const authClient = new google.auth.JWT( privatekey.client_email, null, privatekey.private_key, scopes, ); return new Promise(function(resolve, reject) { // Authenticate request authClient.authorize(function(err, tokens) { if (err) { reject(false); } else { resolve(authClient); } }); }); } main();
Python
"""This code snippet creates a Dialogflow ES integration. Read more: https://developers.google.com/business-communications/business-messages/guides/how-to/integrate/dialogflow?method=api#dialogflow_es This code is based on the https://github.com/google-business-communications/python-businessmessages Python Business Messages client library. """ from oauth2client.service_account import ServiceAccountCredentials from businesscommunications.businesscommunications_v1_client import BusinesscommunicationsV1 from businesscommunications.businesscommunications_v1_messages import ( BusinesscommunicationsBrandsAgentsIntegrationsCreateRequest, DialogflowEsIntegration ) # Edit the values below: BRAND_ID = 'EDIT_HERE' AGENT_ID = 'EDIT_HERE' DIALOGFLOW_ES_PROJECT_ID = 'EDIT_HERE' SCOPES = ['https://www.googleapis.com/auth/businesscommunications'] SERVICE_ACCOUNT_FILE = './service_account_key.json' credentials = ServiceAccountCredentials.from_json_keyfile_name( SERVICE_ACCOUNT_FILE, scopes=SCOPES) client = BusinesscommunicationsV1(credentials=credentials) integrations_service = BusinesscommunicationsV1.BrandsAgentsIntegrationsService(client) agent_name = 'brands/' + BRAND_ID + '/agents/' + AGENT_ID integration = integrations_service.Create(BusinesscommunicationsBrandsAgentsIntegrationsCreateRequest( integration=DialogflowEsIntegration( autoResponseStatus=DialogflowEsIntegration.AutoResponseStatusValueValuesEnum.ENABLED, dialogflowProjectId=DIALOGFLOW_ES_PROJECT_ID ), parent=agent_name )) print(integration)
Dialogflow CX
cURL
# This code creates a Dialogflow CX integration. # Read more: https://developers.google.com/business-communications/business-messages/guides/how-to/integrate/dialogflow?method=api#dialogflow_cx # Replace the __BRAND_ID__, __AGENT_ID__, __DIALOGFLOW_CX_PROJECT_ID__, __DIALOGFLOW_CX_AGENT_ID__ and __AUTO_RESPONSE_STATUS__ # Make sure a service account key file exists at ./service_account_key.json curl -X POST \ "https://businesscommunications.googleapis.com/v1/brands/__BRAND_ID__/agents/__AGENT_ID__/integrations" \ -H "$(oauth2l header --json ./service_account_key.json businesscommunications)" \ -H "Content-Type: application/json" \ -H "User-Agent: curl/business-communications" \ -d '{ "dialogflowCxIntegration": { "dialogflowProjectId": "__DIALOGFLOW_CX_PROJECT_ID__", "dialogflowAgentId": "__DIALOGFLOW_CX_AGENT_ID__", "autoResponseStatus": "__AUTO_RESPONSE_STATUS__" } }'
Node.js के लिए
/** * This code snippet creates a Dialogflow CX integration. * Read more: https://developers.google.com/business-communications/business-messages/guides/how-to/integrate/dialogflow?method=api#dialogflow_cx * * This code is based on the https://github.com/google-business-communications/nodejs-businesscommunications Node.js * Business Communications client library. */ /** * Edit the values below: */ const BRAND_ID = 'EDIT_HERE'; const AGENT_ID = 'EDIT_HERE'; const DIALOGFLOW_CX_AGENT_ID = 'EDIT_HERE' const DIALOGFLOW_CX_PROJECT_ID = 'EDIT_HERE' const PATH_TO_SERVICE_ACCOUNT_KEY = './service_account_key.json'; const businesscommunications = require('businesscommunications'); const {google} = require('googleapis'); const uuidv4 = require('uuid').v4; // Initialize the Business Communications API const bcApi = new businesscommunications.businesscommunications_v1.Businesscommunications({}); // Set the scope that we need for the Business Communications API const scopes = [ 'https://www.googleapis.com/auth/businesscommunications', ]; // Set the private key to the service account file const privatekey = require(PATH_TO_SERVICE_ACCOUNT_KEY); async function main() { const authClient = await initCredentials(); const agentName = 'brands/' + BRAND_ID + '/agents/' + AGENT_ID; if (authClient) { const integrationObject = { dialogflowCxIntegration: { dialogflowProjectId: DIALOGFLOW_CX_PROJECT_ID, dialogflowAgentId: DIALOGFLOW_CX_AGENT_ID, autoResponseStatus: 'ENABLED' } }; // Setup the parameters for the API call const apiParams = { auth: authClient, parent: agentName, resource: integrationObject }; bcApi.brands.agents.integrations.create(apiParams, {}, (err, response) => { if (err !== undefined && err !== null) { console.dir(err); } else { // Agent created console.log(response.data); } }); } else { console.log('Authentication failure.'); } } /** * Initializes the Google credentials for calling the * Business Messages API. */ async function initCredentials() { // Configure a JWT auth client const authClient = new google.auth.JWT( privatekey.client_email, null, privatekey.private_key, scopes, ); return new Promise(function(resolve, reject) { // Authenticate request authClient.authorize(function(err, tokens) { if (err) { reject(false); } else { resolve(authClient); } }); }); } main();
Python
"""This code snippet creates a Dialogflow CX integration. Read more: https://developers.google.com/business-communications/business-messages/guides/how-to/integrate/dialogflow?method=api#dialogflow_cx This code is based on the https://github.com/google-business-communications/python-businessmessages Python Business Messages client library. """ from oauth2client.service_account import ServiceAccountCredentials from businesscommunications.businesscommunications_v1_client import BusinesscommunicationsV1 from businesscommunications.businesscommunications_v1_messages import ( BusinesscommunicationsBrandsAgentsIntegrationsCreateRequest, DialogflowCxIntegration ) # Edit the values below: BRAND_ID = 'EDIT_HERE' AGENT_ID = 'EDIT_HERE' DIALOGFLOW_CX_AGENT_ID = 'EDIT_HERE' DIALOGFLOW_CX_PROJECT_ID = 'EDIT_HERE' SCOPES = ['https://www.googleapis.com/auth/businesscommunications'] SERVICE_ACCOUNT_FILE = './service_account_key.json' credentials = ServiceAccountCredentials.from_json_keyfile_name( SERVICE_ACCOUNT_FILE, scopes=SCOPES) client = BusinesscommunicationsV1(credentials=credentials) integrations_service = BusinesscommunicationsV1.BrandsAgentsIntegrationsService(client) agent_name = 'brands/' + BRAND_ID + '/agents/' + AGENT_ID integration = integrations_service.Create(BusinesscommunicationsBrandsAgentsIntegrationsCreateRequest( integration=DialogflowCxIntegration( autoResponseStatus=DialogflowCxIntegration.AutoResponseStatusValueValuesEnum.ENABLED, dialogflowAgentId=DIALOGFLOW_CX_AGENT_ID, dialogflowProjectId=DIALOGFLOW_CX_PROJECT_ID ), parent=agent_name )) print(integration)
फ़ॉर्मैटिंग और वैल्यू के विकल्पों के लिए,
Integration
देखें.
Business Messages और Dialogflow को कनेक्ट करने में, करीब दो मिनट लगते हैं. इंटिग्रेशन की स्थिति देखने के लिए, इंटिग्रेशन की OperationInfo
जानकारी पाएं.
इंटिग्रेशन अपडेट करें
अपने एजेंट की अपने-आप जवाब देने की सेटिंग को अपडेट करने के लिए, यह निर्देश चलाएं. AUTO_RESPONSE_STATUS को चालू करें या बंद करें, यह इस बात पर निर्भर करता है कि Business Messages अपने-आप उपयोगकर्ताओं को Dialogflow के जवाबों के साथ जवाब देना चाहता है या नहीं.
Dialogflow ES
cURL
# This code updates the Dialogflow association. # Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/brands.agents/updateDialogflowAssociation # Replace the __BRAND_ID__ and __AGENT_ID__ # Make sure a service account key file exists at ./service_account_key.json curl -X PATCH \ "https://businesscommunications.googleapis.com/v1/brands/__BRAND_ID__/agents/__AGENT_ID__/dialogflowAssociation?updateMask=enableAutoResponse" \ -H "Content-Type: application/json" \ -H "User-Agent: curl/business-communications" \ -H "$(oauth2l header --json ./service_account_key.json businesscommunications)" \ -d '{ "enableAutoResponse": true }'
Dialogflow CX
cURL
# This code updates the Dialogflow association. # Read more: https://developers.google.com/business-communications/business-messages/reference/business-communications/rest/v1/brands.agents/updateDialogflowAssociation # Replace the __BRAND_ID__ and __AGENT_ID__ # Make sure a service account key file exists at ./service_account_key.json curl -X PATCH \ "https://businesscommunications.googleapis.com/v1/brands/__BRAND_ID__/agents/__AGENT_ID__/dialogflowAssociation?updateMask=enableAutoResponse" \ -H "Content-Type: application/json" \ -H "User-Agent: curl/business-communications" \ -H "$(oauth2l header --json ./service_account_key.json businesscommunications)" \ -d '{ "enableAutoResponse": true }'
फ़ॉर्मैटिंग और वैल्यू के विकल्पों के लिए, Integration
देखें.
Dialogflow के वर्शन के बीच स्विच करें
Business Messages एजेंट को एक बार में, सिर्फ़ एक Dialogflow के साथ काम किया जा सकता है. Dialogflow के एक वर्शन से दूसरे वर्शन पर जाने के लिए, आपको नया इंटिग्रेशन बनाने से पहले मौजूदा इंटिग्रेशन हटाना होगा.
इंटिग्रेशन मिटाएं
अगर आपको अपने Business Messages एजेंट से Dialogflow को हटाना है, तो नीचे दिए गए निर्देश से इंटिग्रेशन मिटाएं.
cURL
# This code deletes an integration. # Read more: https://developers.google.com/business-communications/business-messages/guides/how-to/integrate/dialogflow?method=api#delete_the_integration # Replace the __BRAND_ID__, __AGENT_ID__ and __INTEGRATION_ID__ # Make sure a service account key file exists at ./service_account_key.json curl -X DELETE \ "https://businesscommunications.googleapis.com/v1/brands/__BRAND_ID__/agents/__AGENT_ID__/integrations/__INTEGRATION_ID__" \ -H "Content-Type: application/json" \ -H "User-Agent: curl/business-communications" \ -H "$(oauth2l header --json ./service_account_key.json businesscommunications)"
Node.js के लिए
/** * This code snippet deletes an integration. * Read more: https://developers.google.com/business-communications/business-messages/guides/how-to/integrate/dialogflow?method=api#delete_the_integration * * This code is based on the https://github.com/google-business-communications/nodejs-businesscommunications Node.js * Business Communications client library. */ /** * Edit the values below: */ const BRAND_ID = 'EDIT_HERE'; const AGENT_ID = 'EDIT_HERE'; const INTEGRATION_ID = 'EDIT_HERE'; const PATH_TO_SERVICE_ACCOUNT_KEY = './service_account_key.json'; const businesscommunications = require('businesscommunications'); const {google} = require('googleapis'); const uuidv4 = require('uuid').v4; // Initialize the Business Communications API const bcApi = new businesscommunications.businesscommunications_v1.Businesscommunications({}); // Set the scope that we need for the Business Communications API const scopes = [ 'https://www.googleapis.com/auth/businesscommunications', ]; // Set the private key to the service account file const privatekey = require(PATH_TO_SERVICE_ACCOUNT_KEY); async function main() { const authClient = await initCredentials(); const integrationName = 'brands/' + BRAND_ID + '/agents/' + AGENT_ID + '/integrations/' + INTEGRATION_ID; if (authClient) { // Setup the parameters for the API call const apiParams = { auth: authClient, name: integrationName, }; bcApi.brands.agents.integrations.delete(apiParams, {}, (err, response) => { if (err !== undefined && err !== null) { console.dir(err); } else { // Agent created console.log(response.data); } }); } else { console.log('Authentication failure.'); } } /** * Initializes the Google credentials for calling the * Business Messages API. */ async function initCredentials() { // Configure a JWT auth client const authClient = new google.auth.JWT( privatekey.client_email, null, privatekey.private_key, scopes, ); return new Promise(function(resolve, reject) { // Authenticate request authClient.authorize(function(err, tokens) { if (err) { reject(false); } else { resolve(authClient); } }); }); } main();
Python
"""This code snippet deletes an integration. Read more: https://developers.google.com/business-communications/business-messages/guides/how-to/integrate/dialogflow?method=api#delete_the_integration This code is based on the https://github.com/google-business-communications/python-businessmessages Python Business Messages client library. """ from oauth2client.service_account import ServiceAccountCredentials from businesscommunications.businesscommunications_v1_client import BusinesscommunicationsV1 from businesscommunications.businesscommunications_v1_messages import ( BusinesscommunicationsBrandsAgentsIntegrationsDeleteRequest ) # Edit the values below: BRAND_ID = 'EDIT_HERE' AGENT_ID = 'EDIT_HERE' INTEGRATION_ID = 'EDIT_HERE' SCOPES = ['https://www.googleapis.com/auth/businesscommunications'] SERVICE_ACCOUNT_FILE = './service_account_key.json' credentials = ServiceAccountCredentials.from_json_keyfile_name( SERVICE_ACCOUNT_FILE, scopes=SCOPES) client = BusinesscommunicationsV1(credentials=credentials) integrations_service = BusinesscommunicationsV1.BrandsAgentsIntegrationsService(client) integration_name = 'brands/' + BRAND_ID + '/agents/' + AGENT_ID + '/integrations/' + INTEGRATION_ID integration = integrations_service.Delete(BusinesscommunicationsBrandsAgentsIntegrationsDeleteRequest( name=integration_name )) print(integration)
फ़ॉर्मैटिंग और वैल्यू के विकल्पों के लिए, Integration
देखें.
इंटिग्रेशन की जानकारी पाना
इंटिग्रेशन के बारे में जानकारी पाने के लिए, बिज़नेस कम्यूनिकेशन एपीआई का इस्तेमाल करें. हालांकि, इसके लिए ज़रूरी है कि आपके पास इंटिग्रेशन की name
वैल्यू हो.
इंटिग्रेशन के बारे में जानकारी पाना
इंटिग्रेशन की जानकारी पाने के लिए, नीचे दिया गया निर्देश चलाएं.
हैcURL
# This code gets information about an integration. # Read more: https://developers.google.com/business-communications/business-messages/guides/how-to/integrate/dialogflow?method=api#get_info_for_a_single_integration # Replace the __BRAND_ID__, __AGENT_ID__ and __INTEGRATION_ID__ # Make sure a service account key file exists at ./service_account_key.json curl -X GET \ "https://businesscommunications.googleapis.com/v1/brands/__BRAND_ID__/agents/__AGENT_ID__/integrations/__INTEGRATION_ID__" \ -H "Content-Type: application/json" \ -H "User-Agent: curl/business-communications" \ -H "$(oauth2l header --json ./service_account_key.json businesscommunications)"
Node.js के लिए
/** * This code snippet gets information about an integration. * Read more: https://developers.google.com/business-communications/business-messages/guides/how-to/integrate/dialogflow?method=api#get_info_for_a_single_integration * * This code is based on the https://github.com/google-business-communications/nodejs-businesscommunications Node.js * Business Communications client library. */ /** * Edit the values below: */ const BRAND_ID = 'EDIT_HERE'; const AGENT_ID = 'EDIT_HERE'; const INTEGRATION_ID = 'EDIT_HERE'; const PATH_TO_SERVICE_ACCOUNT_KEY = './service_account_key.json'; const businesscommunications = require('businesscommunications'); const {google} = require('googleapis'); const uuidv4 = require('uuid').v4; // Initialize the Business Communications API const bcApi = new businesscommunications.businesscommunications_v1.Businesscommunications({}); // Set the scope that we need for the Business Communications API const scopes = [ 'https://www.googleapis.com/auth/businesscommunications', ]; // Set the private key to the service account file const privatekey = require(PATH_TO_SERVICE_ACCOUNT_KEY); async function main() { const authClient = await initCredentials(); const integrationName = 'brands/' + BRAND_ID + '/agents/' + AGENT_ID + '/integrations/' + INTEGRATION_ID; if (authClient) { // Setup the parameters for the API call const apiParams = { auth: authClient, name: integrationName, }; bcApi.brands.agents.integrations.get(apiParams, {}, (err, response) => { if (err !== undefined && err !== null) { console.dir(err); } else { // Agent created console.log(response.data); } }); } else { console.log('Authentication failure.'); } } /** * Initializes the Google credentials for calling the * Business Messages API. */ async function initCredentials() { // Configure a JWT auth client const authClient = new google.auth.JWT( privatekey.client_email, null, privatekey.private_key, scopes, ); return new Promise(function(resolve, reject) { // Authenticate request authClient.authorize(function(err, tokens) { if (err) { reject(false); } else { resolve(authClient); } }); }); } main();
Python
"""This code snippet gets information about an integration. Read more: https://developers.google.com/business-communications/business-messages/guides/how-to/integrate/dialogflow?method=api#get_info_for_a_single_integration This code is based on the https://github.com/google-business-communications/python-businessmessages Python Business Messages client library. """ from oauth2client.service_account import ServiceAccountCredentials from businesscommunications.businesscommunications_v1_client import BusinesscommunicationsV1 from businesscommunications.businesscommunications_v1_messages import ( BusinesscommunicationsBrandsAgentsIntegrationsDeleteRequest ) # Edit the values below: BRAND_ID = 'EDIT_HERE' AGENT_ID = 'EDIT_HERE' INTEGRATION_ID = 'EDIT_HERE' SCOPES = ['https://www.googleapis.com/auth/businesscommunications'] SERVICE_ACCOUNT_FILE = './service_account_key.json' credentials = ServiceAccountCredentials.from_json_keyfile_name( SERVICE_ACCOUNT_FILE, scopes=SCOPES) client = BusinesscommunicationsV1(credentials=credentials) integrations_service = BusinesscommunicationsV1.BrandsAgentsIntegrationsService(client) integration_name = 'brands/' + BRAND_ID + '/agents/' + AGENT_ID + '/integrations/' + INTEGRATION_ID integration = integrations_service.Get(BusinesscommunicationsBrandsAgentsIntegrationsDeleteRequest( name=integration_name )) print(integration)
फ़ॉर्मैटिंग और वैल्यू के विकल्पों के लिए, Integration
देखें.
एजेंट के लिए सभी इंटिग्रेशन की सूची बनाएं
अगर आपको इंटिग्रेशन का नाम नहीं पता है, तो आप किसी जीईटी अनुरोध यूआरएल से INTEGRATION_ID वैल्यू को हटाकर, एजेंट से जुड़ी सभी इंटिग्रेशन के बारे में जानकारी पा सकते हैं.
हैcURL
# This code lists all integrations for an agent. # Read more: https://developers.google.com/business-communications/business-messages/guides/how-to/integrate/dialogflow?method=api#list_all_integrations_for_an_agent # Replace the __BRAND_ID__ and __AGENT_ID__ # Make sure a service account key file exists at ./service_account_key.json curl -X GET \ "https://businesscommunications.googleapis.com/v1/brands/__BRAND_ID__/agents/__AGENT_ID__/integrations" \ -H "Content-Type: application/json" \ -H "User-Agent: curl/business-communications" \ -H "$(oauth2l header --json ./service_account_key.json businesscommunications)"
Node.js के लिए
/** * This code snippet lists all integrations for an agent. * Read more: https://developers.google.com/business-communications/business-messages/guides/how-to/integrate/dialogflow?method=api#list_all_integrations_for_an_agent * * This code is based on the https://github.com/google-business-communications/nodejs-businesscommunications Node.js * Business Communications client library. */ /** * Edit the values below: */ const BRAND_ID = 'EDIT_HERE'; const AGENT_ID = 'EDIT_HERE'; const PATH_TO_SERVICE_ACCOUNT_KEY = './service_account_key.json'; const businesscommunications = require('businesscommunications'); const {google} = require('googleapis'); const uuidv4 = require('uuid').v4; // Initialize the Business Communications API const bcApi = new businesscommunications.businesscommunications_v1.Businesscommunications({}); // Set the scope that we need for the Business Communications API const scopes = [ 'https://www.googleapis.com/auth/businesscommunications', ]; // Set the private key to the service account file const privatekey = require(PATH_TO_SERVICE_ACCOUNT_KEY); async function main() { const authClient = await initCredentials(); if (authClient) { // Setup the parameters for the API call const apiParams = { auth: authClient, parent: 'brands/' + BRAND_ID + '/agents/' + AGENT_ID, }; bcApi.brands.agents.integrations.list(apiParams, {}, (err, response) => { if (err !== undefined && err !== null) { console.dir(err); } else { // Agent created console.log(response.data); } }); } else { console.log('Authentication failure.'); } } /** * Initializes the Google credentials for calling the * Business Messages API. */ async function initCredentials() { // Configure a JWT auth client const authClient = new google.auth.JWT( privatekey.client_email, null, privatekey.private_key, scopes, ); return new Promise(function(resolve, reject) { // Authenticate request authClient.authorize(function(err, tokens) { if (err) { reject(false); } else { resolve(authClient); } }); }); } main();
Python
"""This code snippet lists all integrations for an agent. Read more: https://developers.google.com/business-communications/business-messages/guides/how-to/integrate/dialogflow?method=api#list_all_integrations_for_an_agent This code is based on the https://github.com/google-business-communications/python-businessmessages Python Business Messages client library. """ from oauth2client.service_account import ServiceAccountCredentials from businesscommunications.businesscommunications_v1_client import BusinesscommunicationsV1 from businesscommunications.businesscommunications_v1_messages import ( BusinesscommunicationsBrandsAgentsIntegrationsListRequest ) # Edit the values below: BRAND_ID = 'EDIT_HERE' AGENT_ID = 'EDIT_HERE' SCOPES = ['https://www.googleapis.com/auth/businesscommunications'] SERVICE_ACCOUNT_FILE = './service_account_key.json' credentials = ServiceAccountCredentials.from_json_keyfile_name( SERVICE_ACCOUNT_FILE, scopes=SCOPES) client = BusinesscommunicationsV1(credentials=credentials) integrations_service = BusinesscommunicationsV1.BrandsAgentsIntegrationsService(client) agent_name = 'brands/' + BRAND_ID + '/agents/' + AGENT_ID integration = integrations_service.List( BusinesscommunicationsBrandsAgentsIntegrationsListRequest(parent=agent_name) ) print(integration)
फ़ॉर्मैटिंग और वैल्यू के विकल्पों के लिए, Integration
देखें.
इंटेंट मैचिंग
Business Messages एजेंट के लिए Dialogflow के साथ काम करने की सुविधा चालू करने के बाद, आपका एजेंट आपके Dialogflow प्रोजेक्ट और#39; कॉन्फ़िगर किए गए इंटेंट का इस्तेमाल करके, बिना कोड लिखे उपयोगकर्ता के सवालों को समझ सकता है और उनका जवाब दे सकता है. इंटेंट के बारे में ज़्यादा जानने के लिए, Dialogflow ES और Dialogflow CX के दस्तावेज़ देखें.
ऑटोमेशन के ज़रिए बातचीत करने के लिए, बातचीत के हर विकल्प के लिए Dialogflow के इंटेंट कॉन्फ़िगर करें. Business Messages के एजेंट, Dialogflow पर भरोसा करते हैं, ताकि उपयोगकर्ता के मैसेज को समझा जा सके.
Dialogflow के एपीआई को कॉल करते समय, Business Messages आपके इंटेंट और
वेबहुक को वेबहुक की तरह
उपयोगकर्ता मैसेज पेलोड में भेजता है. जब उपयोगकर्ता मैसेज को इंटेंट से मैच किया जाता है, तो आप QueryParameters
के business_messages_payload
फ़ील्ड में Struct
फ़ॉर्मैट में यह पेलोड ऐक्सेस कर सकते हैं.
पेलोड में DialogflowResponse
को छोड़कर, उपयोगकर्ता मैसेज के सभी फ़ील्ड शामिल होते हैं.
Dialogflow CX के लिए, Business Messages, आपके channel
इंटेंट के साथ channel
नाम वाला सेशन पैरामीटर भी पास करता है. साथ ही, एजेंट के रेफ़रंस में इस फ़ॉर्मैट का इस्तेमाल किया जा सकता है: $session.params.channel
.
एक ही Dialogflow एजेंट में कई चैनलों की मदद करने के लिए, इस पैरामीटर का इस्तेमाल करके शर्तों को पूरा करने के लिए शर्तें जोड़ी जा सकती हैं.
क्वेरी पैरामीटर के बारे में ज़्यादा जानने के लिए, Dialogflow ES और Dialogflow CX रेफ़रंस देखें.
ज़रूरी शर्तें
Dialogflow के अंदर NLU मॉडल बनाते समय, आप इंटेंट के लिए अलग-अलग रिस्पॉन्स टाइप को कॉन्फ़िगर कर सकते हैं. Business Messages में, डिफ़ॉल्ट जवाब की सुविधा इस्तेमाल की जा सकती है. इसमें ये शामिल हो सकते हैं:
- टेक्स्ट
- कस्टम पेलोड
- लाइव एजेंट हैंडऑफ़ (सिर्फ़ Dialogflow CX)
पसंद के मुताबिक बनाया गया पेलोड, Business Messages के JSON मैसेज के जवाब के तौर पर मान्य होना चाहिए. किसी इंटेंट के लिए कस्टम पेलोड रिस्पॉन्स कॉन्फ़िगर करते समय, Business Messages इन फ़ील्ड को अनदेखा करता है:
name
messageId
representative
नमूने के तौर पर दिए गए ये जवाब देखें.
सुझावों वाला टेक्स्ट
{
"text": "Hello World!",
"fallback": "Hello World!\n\nReply with \"Hello\" or \"Hi!\"",
"suggestions": [
{
"reply": {
"text": "Hello",
"postbackData": "hello-formal"
}
},
{
"reply": {
"text": "Hi!",
"postbackData": "hello-informal"
}
}
]
}
रिच कार्ड
{
"fallback": "Hello, world!\nSent with Business Messages\n\nReply with \"Suggestion #1\" or \"Suggestion #2\"",
"richCard": {
"standaloneCard": {
"cardContent": {
"title": "Hello, world!",
"description": "Sent with Business Messages.",
"media": {
"height": "TALL",
"contentInfo":{
"altText": "Google logo",
"fileUrl": "https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png",
"forceRefresh": "false"
}
},
"suggestions": [
{
"reply": {
"text": "Suggestion #1",
"postbackData": "suggestion_1"
}
},
{
"reply": {
"text": "Suggestion #2",
"postbackData": "suggestion_2"
}
}
]
}
}
}
}
रिच कार्ड कैरसेल
{
"fallback": "Card #1\nThe description for card #1\n\nCard #2\nThe description for card #2\n\nReply with \"Card #1\" or \"Card #2\"",
"richCard": {
"carouselCard": {
"cardWidth": "MEDIUM",
"cardContents": [
{
"title": "Card #1",
"description": "The description for card #1",
"suggestions": [
{
"reply": {
"text": "Card #1",
"postbackData": "card_1"
}
}
],
"media": {
"height": "MEDIUM",
"contentInfo": {
"fileUrl": "https://my.files/cute-dog.jpg",
"forceRefresh": false
}
}
},
{
"title": "Card #2",
"description": "The description for card #2",
"suggestions": [
{
"reply": {
"text": "Card #2",
"postbackData": "card_2"
}
}
],
"media": {
"height": "MEDIUM",
"contentInfo": {
"fileUrl": "https://my.files/elephant.jpg",
"forceRefresh": false
}
}
}
]
}
}
}
लाइव एजेंट हैंडऑफ़
{
"metadata": {}
}
अक्सर पूछे जाने वाले सवाल के बॉट
Business Messages एजेंट के लिए, Dialogflow का ES इंटिग्रेशन चालू करने के बाद, अक्सर पूछे जाने वाले सवाल का बॉट बनाया जा सकता है. जब आप सवालों और जवाबों के लिए सहायता दस्तावेज़ उपलब्ध कराते हैं, तो Business Messages और Dialogflow, उपयोगकर्ता के सवालों को समझने और उनका जवाब देने के लिए ज़रूरी इन्फ़्रास्ट्रक्चर बनाते हैं. इसके लिए आपको कोड लिखने की ज़रूरत नहीं पड़ती.
'अक्सर पूछे जाने वाले सवाल' बॉट का इस्तेमाल करते हुए देखने के लिए, Business Messages के बारे में अक्सर पूछे जाने वाले सवाल के बॉट से चैट करें.
ज़रूरी शर्तें
अक्सर पूछे जाने वाले सवालों का बॉट बनाने से पहले, आपको अपने सवाल और जवाब, नॉलेज दस्तावेज़ (ज़्यादा से ज़्यादा 50 एमबी) के तौर पर उपलब्ध कराने होंगे: यह ऐसी एचटीएमएल फ़ाइल या CSV फ़ाइल होती है जो सार्वजनिक तौर पर उपलब्ध होती है.
आम तौर पर, जानकारी वाले दस्तावेज़
- इसमें जवाबों में सीमित मार्कडाउन शामिल हो सकता है, जैसा कि रिच टेक्स्ट में बताया गया है.
- फ़ाइल का साइज़ ज़्यादा से ज़्यादा 50 एमबी हो सकता है.
- 2000 से ज़्यादा सवाल/जवाब के जोड़े नहीं होने चाहिए.
- अलग-अलग जवाबों के साथ डुप्लीकेट सवालों के साथ काम न करें.
एचटीएमएल फ़ाइलों के लिए:
- सार्वजनिक यूआरएल की फ़ाइलों को 'Google सर्च' इंडेक्सर ने क्रॉल किया होना चाहिए, ताकि वे खोज इंडेक्स में मौजूद रहें. आप Google Search Console से इसकी जांच कर सकते हैं. ध्यान दें कि इंडेक्स करने वाला आपका कॉन्टेंट अप-टू-डेट नहीं रखता. सोर्स कॉन्टेंट में बदलाव होने पर, आपको अपने दस्तावेज़ में बदलाव करना होगा.
- Dialogflow जवाब बनाते समय कॉन्टेंट से एचटीएमएल टैग हटा देता है. इस वजह से, एचटीएमएल टैग से बचना और जहां भी हो सके वहां सादे टेक्स्ट का इस्तेमाल करना सबसे अच्छा होता है.
- एक ही सवाल/जवाब की जोड़ी वाली फ़ाइलें काम नहीं करती हैं.
CSV फ़ाइलों के लिए
- फ़ाइलों के पहले कॉलम में सवाल और दूसरे कॉलम में जवाब होने चाहिए, जिसमें कोई हेडर न हो.
- फ़ाइलों में डीलिमिटर होने पर, कॉमा का इस्तेमाल करना चाहिए.
अक्सर पूछे जाने वाले सवालों का बॉट बनाना
अक्सर पूछे जाने वाले सवालों के जवाब देने वाला बॉट बनाने के लिए, सबसे पहले बॉट का डेटा सेव करने के लिए एक नॉलेज बेस बनाएं. इसके बाद, अपने नॉलेज बेस में सवाल/जवाब के जोड़े के साथ एक या एक से ज़्यादा दस्तावेज़ जोड़ें.
नॉलेज बेस बनाना
नॉलेज बेस बनाने के लिए, यह निर्देश चलाएं. दस्तावेज़, BRAND_ID और name
के यूनीक वैल्यू के साथ BRAND_ID, AGENT_ID, और INTEGRATION_ID को बदलें. KNOWLEDGE_BASE_DISPLAY_NAME
को अपनी पसंद की पहचान करने वाली स्ट्रिंग से बदलें.
नॉलेज बेस बनाने के बाद, उसमें दस्तावेज़ बनाए जा सकते हैं.
cURL
# This code creates a knowledge base. # Read more: https://developers.google.com/business-communications/business-messages/guides/how-to/integrate/dialogflow?method=api#create-knowledge-base # Replace the __BRAND_ID__, __AGENT_ID__, __INTEGRATION_ID__ and __KNOWLEDGE_BASE_DISPLAY_NAME__ # Make sure a service account key file exists at ./service_account_key.json curl -X PATCH \ "https://businesscommunications.googleapis.com/v1/brands/__BRAND_ID__/agents/__AGENT_ID__/integrations/__INTEGRATION_ID__?updateMask=dialogflowEsIntegration.dialogflowKnowledgeBases" \ -H "Content-Type: application/json" \ -H "User-Agent: curl/business-communications" \ -H "$(oauth2l header --json ./service_account_key.json businesscommunications)" \ -d '{ "dialogflowEsIntegration": { "dialogflowKnowledgeBases": [ { "displayName": "__KNOWLEDGE_BASE_DISPLAY_NAME__" } ] } }'
फ़ॉर्मैटिंग और वैल्यू के विकल्पों के लिए, DialogflowKnowledgebase
देखें.
नॉलेज दस्तावेज़ बनाना
नॉलेज दस्तावेज़ बनाने के लिए, यह निर्देश चलाएं.
दस्तावेज़ को मौजूदा दस्तावेज़ों की सूची में जोड़ें या अगर कोई सूची मौजूद नहीं है, तो एक नई सूची बनाएं. मौजूदा दस्तावेज़ों की एक सूची में, दस्तावेज़ में मौजूद दस्तावेज़ की name
वैल्यू शामिल होनी चाहिए.
सार्वजनिक HTML फ़ाइल
नीचे दिए गए वैरिएबल को बदलें:
- BRAND_ID, AGENT_ID, और INTEGRATION_ID
इंटिग्रेशन के अद्वितीय मानों के साथ's
name
- अपनी पसंद की स्ट्रिंग की पहचान करने के लिए KNOWLEDGE_BASE_DISPLAY_NAME और DOCUMENT_DISPLAY_NAME
PUBLIC_URL में मौजूद, नॉलेज दस्तावेज़ का सार्वजनिक यूआरएल
cURL
# This code creates a knowledge base document from an HTML document and adds it to the knowledge base. # Read more: https://developers.google.com/business-communications/business-messages/guides/how-to/integrate/dialogflow?method=api#create-document # Replace the __BRAND_ID__, __AGENT_ID__, __INTEGRATION_ID__, __KNOWLEDGE_BASE_DISPLAY_NAME__, __DOCUMENT_DISPLAY_NAME__ and __PUBLIC_URL__ # Make sure a service account key file exists at ./service_account_key.json curl -X PATCH \ "https://businesscommunications.googleapis.com/v1/brands/__BRAND_ID__/agents/__AGENT_ID__/integrations/__INTEGRATION_ID__?updateMask=dialogflowEsIntegration.dialogflowKnowledgeBases" \ -H "Content-Type: application/json" \ -H "User-Agent: curl/business-communications" \ -H "$(oauth2l header --json ./service_account_key.json businesscommunications)" \ -d '{ "dialogflowEsIntegration": { "dialogflowKnowledgeBases": [ { "displayName": "__KNOWLEDGE_BASE_DISPLAY_NAME__", "documents": [ { "displayName": "__DOCUMENT_DISPLAY_NAME__", "faqUrl": "__PUBLIC_URL__" } ] } ] } }'
लोकल CSV फ़ाइल
नीचे दिए गए वैरिएबल को बदलें:
- BRAND_ID, AGENT_ID, और INTEGRATION_ID
इंटिग्रेशन के अद्वितीय मानों के साथ's
name
- अपनी पसंद की स्ट्रिंग की पहचान करने के लिए KNOWLEDGE_BASE_DISPLAY_NAME और DOCUMENT_DISPLAY_NAME
CSV_RAW_BYTES, CSV फ़ाइल के साथ जिसमें base64-एनकोडेड स्ट्रिंग है
cURL
# This code creates a knowledge base document from a CSV document and adds it to the knowledge base. # Read more: https://developers.google.com/business-communications/business-messages/guides/how-to/integrate/dialogflow?method=api#create-document # Replace the __BRAND_ID__, __AGENT_ID__, __INTEGRATION_ID__, __KNOWLEDGE_BASE_DISPLAY_NAME__, __DOCUMENT_DISPLAY_NAME__ and __CSV_RAW_BYTES__ # Make sure a service account key file exists at ./service_account_key.json curl -X PATCH \ "https://businesscommunications.googleapis.com/v1/brands/__BRAND_ID__/agents/__AGENT_ID__/integrations/__INTEGRATION_ID__?updateMask=dialogflowEsIntegration.dialogflowKnowledgeBases" \ -H "Content-Type: application/json" \ -H "User-Agent: curl/business-communications" \ -H "$(oauth2l header --json ./service_account_key.json businesscommunications)" \ -d '{ "dialogflowEsIntegration": { "dialogflowKnowledgeBases": [ { "displayName": "__KNOWLEDGE_BASE_DISPLAY_NAME__", "documents": [ { "displayName": "__DOCUMENT_DISPLAY_NAME__", "rawContent": "__CSV_RAW_BYTES__" } ] } ] } }'
फ़ॉर्मैटिंग और वैल्यू के विकल्पों के लिए, DialogflowKnowledgebase
देखें.
नॉलेज बेस पर किसी दस्तावेज़ को जोड़ने में करीब दो मिनट लगते हैं. दस्तावेज़
की स्थिति देखने के लिए, इंटिग्रेशन
OperationInfo
पर जाएं.
नॉलेज दस्तावेज़ मिटाना
अगर आपको Business Messages एजेंट से सवाल/जवाब के जोड़े हटाने हैं, तो उस नॉलेज दस्तावेज़ को मिटाएं जिसमें ये निर्देश हैं.
किसी मौजूदा दस्तावेज़ को मिटाने के लिए, यह निर्देश चलाएं. दस्तावेज़, BRAND_ID और name
के यूनीक वैल्यू के साथ BRAND_ID, AGENT_ID, और INTEGRATION_ID को बदलें. KNOWLEDGE_BASE_DISPLAY_NAME को सही स्ट्रिंग से बदलें.
cURL
# This code deletes a knowledge base document. # Read more: https://developers.google.com/business-communications/business-messages/guides/how-to/integrate/dialogflow?method=api#delete_a_knowledge_document # Replace the __BRAND_ID__, __AGENT_ID__, __INTEGRATION_ID__ and __KNOWLEDGE_BASE_DISPLAY_NAME__ # To delete all knowledge bases, set dialogflowKnowledgeBases to an empty list. Otherwise, the list should contain all existing knowledgebases except the one you would like to remove. # Make sure a service account key file exists at ./service_account_key.json curl -X PATCH \ "https://businesscommunications.googleapis.com/v1/brands/__BRAND_ID__/agents/__AGENT_ID__/integrations/__INTEGRATION_ID__?updateMask=dialogflowEsIntegration.dialogflowKnowledgeBases" \ -H "Content-Type: application/json" \ -H "User-Agent: curl/business-communications" \ -H "$(oauth2l header --json ./service_account_key.json businesscommunications)" \ -d '{ "dialogflowEsIntegration": { "dialogflowKnowledgeBases": [ { "displayName": "__KNOWLEDGE_BASE_DISPLAY_NAME__" } ] } }'
फ़ॉर्मैटिंग और वैल्यू के विकल्पों के लिए, DialogflowKnowledgebase
देखें.
अपने-आप दिए जाने वाले जवाब
अगर आप Dialogflow के साथ काम करने की सुविधा के दौरान अपने-आप जवाब देने की सुविधा चालू करते हैं, तो Business Messages, Dialogflow के ज़रिए उपयोगकर्ता को अपने-आप जवाब देता है. आपका Business Messages एजेंट, सबसे ज़्यादा भरोसेमंद लेवल मैच का जवाब देता है. डायलॉगफ़्लो ES इंटिग्रेशन के साथ, अगर अक्सर पूछे जाने वाले सवालों के जवाब और कस्टम इंटेंट दोनों का मिलान होता है, तो Business Messages सबसे मैच करने वाले कॉन्फ़िडेंस के साथ जवाब देता है.
Business Messages, अपने-आप जवाब दिए जाने वाले सभी मैसेज को BOT
प्रज़ेंटेशन के तौर पर मार्क करता है. अगर आपका एजेंट लाइव एजेंट के साथ काम करता है, तो Business Messages, REPRESENTATIVE_JOINED
इवेंट के बाद अपने-आप मिलने वाले जवाब निलंबित कर देता है.
REPRESENTATIVE_LEFT
इवेंट के बाद अपने-आप जवाब देने की सुविधा फिर से शुरू कर देता है. बॉट से लाइव एजेंट को हैंडऑफ़ देखें.
अक्सर पूछे जाने वाले सवालों के जवाब अपने-आप देने की सुविधा
डायलॉगफ़्लो ES इंटिग्रेशन के साथ, अगर अक्सर पूछे जाने वाले सवालों के जवाब पर बहुत ज़्यादा भरोसा होता है, तो Business Messages, मैसेज के जवाब को मैप करता है. अगर कोई मिलता-जुलता जवाब दिया जाता है, लेकिन उस मैसेज में अलग-अलग जवाब और कोटेशन होते हैं, तो मैसेज दिखता है. अगर नहीं, तो मैसेज में एक सवाल और सुझाया गया जवाब होता है, जो यह बताता है कि मैसेज, उपयोगकर्ता के अनुरोध को पूरा करता है या नहीं.
इंटेंट के जवाब के साथ अपने-आप जवाब देना
इंटेंट रिस्पॉन्स में इनमें से एक या ज़्यादा जवाब शामिल हो सकते हैं.
- Dialogflow ES: टेक्स्ट, कस्टम पेलोड
- Dialogflow CX: टेक्स्ट, कस्टम पेलोड, लाइव एजेंट हैंडऑफ़
अगर इंटेंट रिस्पॉन्स का कॉन्फ़िडेंस लेवल सबसे ज़्यादा है, तो यह लागू होता है.
- अगर रिस्पॉन्स में कम से कम एक टेक्स्ट वैल्यू है, तो Business Messages इस वैल्यू को मैसेज में मैप करता है.
- अगर रिस्पॉन्स में मान्य Business Messages JSON ऑब्जेक्ट स्ट्रक्चर के साथ कम से कम एक कस्टम पेलोड है, तो Business Messages, दिए गए JSON ऑब्जेक्ट का इस्तेमाल करके मैसेज बनाता है.
- अगर रिस्पॉन्स में कम से कम एक लाइव एजेंट हैंडऑफ़ रिस्पॉन्स है, तो लाइव एजेंट के अनुरोध का अपने-आप जवाब देना देखें.
Dialogflow एक ही इंटेंट मैच में कई जवाब शामिल कर सकता है. इसलिए, Business Messages हर टेक्स्ट, कस्टम पेलोड या लाइव एजेंट हैंडऑफ़ रिस्पॉन्स को एक अलग मैसेज के तौर पर भेजता है. अगर इंटेंट मैच में एक से ज़्यादा मैसेज हैं, लेकिन उनमें से कुछ खराब हैं, तो Business Messages सिर्फ़ मान्य मैसेज को अपने-आप जवाब के तौर पर भेजता है.
लाइव एजेंट के अनुरोध के जवाब में, अपने-आप जवाब दें
Dialogflow CX के लिए, लाइव एजेंट के हैंडऑफ़ रिस्पॉन्स का इस्तेमाल किया जा सकता है. इससे इस बात का संकेत मिलता है कि बातचीत किसी ऐसे व्यक्ति को दी जानी चाहिए जो प्रतिनिधि हो. साथ ही, इसकी मदद से आप अपनी प्रक्रिया के लिए कस्टम मेटाडेटा पास कर सकते हैं. अगर इंटेंट जवाब में कॉन्फ़िडेंस लेवल सबसे ज़्यादा होता है और इसमें लाइव एजेंट हैंडऑफ़ शामिल होता है, तो Business Messages आपके वेबहुक के लिए लाइव एजेंट के लिए अनुरोध किया गया इवेंट भेजता है. इस इवेंट को मैनेज करने के लिए, बॉट से लाइव एजेंट को हैंडऑफ़ देखें.
फ़ॉलबैक मैसेज के साथ अपने-आप जवाब देना
अगर Dialogflow को ज़्यादा कॉन्फ़िडेंस लेवल नहीं मिलता है, तो Business Messages फ़ॉलबैक रिस्पॉन्स भेजता है. Dialogflow ES और Dialogflow CX में, फ़ॉलबैक को अलग-अलग तरीके से हैंडल किया जाता है.
Dialogflow ES
अक्सर पूछे जाने वाले सवालों के बॉट के लिए, अक्सर पूछे जाने वाले सवालों के जवाब से मेल न खाने पर, Business Messages एक फ़ॉलबैक मैसेज भेजता है, जिसका जवाब उसे नहीं मिल पाता.
कॉन्फ़िगर किए गए इंटेंट के लिए, अगर इंटेंट रिस्पॉन्स से कोई मैच नहीं होता है, तो Business Messages फ़ॉलबैक रिस्पॉन्स भेजता है. Dialogflow से मिले फ़ॉलबैक टेक्स्ट का इस्तेमाल किया जा सकता है या अतिरिक्त टेक्स्ट और कस्टम पेलोड के साथ फ़ॉलबैक को कॉन्फ़िगर किया जा सकता है.
यहां फ़ॉलबैक कनेक्शन के रिस्पॉन्स का एक उदाहरण दिया गया है, जिसे आपके वेबहुक को मिल सकता है:
{
"intentResponses": [
{
"intentName": "projects/df-integration/agent/intents/12345",
"intentDisplayName": "Default Fallback Intent",
"intentDetectionConfidence": "1.0",
"fulfillmentMessages": [
{
"text": "One more time?"
}
]
}
]
}
Dialogflow intent_name
और intent_display_name
की जानकारी अपने-आप भर देता है.
Dialogflow CX
Dialogflow CX, फ़ॉलबैक इंटेंट रिस्पॉन्स को बिल्ट-इन इवेंट के तौर पर हैंडल करता है. अगर इंटेंट रिस्पॉन्स से कोई मैच नहीं होता है, तो Business Messages, Dialogflow के नो-मैच डिफ़ॉल्ट इवेंट से फ़ॉलबैक मैसेज भेजता है. आप Dialogflow से मिले फ़ॉलबैक टेक्स्ट का इस्तेमाल कर सकते हैं या फ़ॉलबैक को अतिरिक्त टेक्स्ट, कस्टम पेलोड, और लाइव एजेंट हैंडऑफ़ के विकल्पों के साथ कॉन्फ़िगर कर सकते हैं.
यहां एक फ़ॉलबैक इंटेंट रिस्पॉन्स का उदाहरण दिया गया है, जिसे आपके वेबहुक को मिल सकता है:
{
"intentResponses": [
{
"intentName": "sys.no-match-default",
"intentDisplayName": "Default Fallback Intent",
"intentDetectionConfidence": "0.3",
"fulfillmentMessages": [
{
"text": "I missed that, say that again?"
}
]
}
]
}
Business Messages में intent_name
और intent_display_name
के हार्ड कोड होते हैं.
Dialogflow-खास फ़ील्ड
Dialogflow के साथ काम करने की सुविधा चालू करने के बाद, उपयोगकर्ता को जो मैसेज
मिलता है
वे उसके साथ
dialogflowResponse
ऑब्जेक्ट शामिल करते हैं. आपके वेबहुक को सभी उपयोगकर्ता मैसेज के लिए पेलोड मिलते हैं. भले ही, Business Messages ने आपकी तरफ़ से
मैसेज का अपने-आप जवाब दिया हो या नहीं. अपने-आप दिए जाने वाले जवाब की जांच करने के लिए, autoResponded
फ़ील्ड की वैल्यू देखें और तय करें कि आपको उपयोगकर्ता को जवाब देना है या नहीं.
Dialogflow ES
... "dialogflowResponse": { "queryText": "TEXT", "intentResponse": { "intentName": "INTENT_ID", "intentDisplayName": "INTENT_NAME", "intentDetectionConfidence": "CONFIDENCE_NUMERIC", "fulfillmentMessages": [{ "text": "FULFILLMENT_TEXT", "jsonPayload": "JSON", "error": "ERROR_STATUS", }], "faqResponse": { "userQuestion": "USER_QUESTION", "answers": [{ "faqQuestion": "FAQ_QUESTION", "faqAnswer": "FAQ_ANSWER", "matchConfidenceLevel": "CONFIDENCE_LEVEL", "matchConfidence": "CONFIDENCE_NUMERIC", }], }, "autoResponded": "BOOLEAN", "autoRespondedMessages": [{ "message": "MESSAGE_JSON", "responseSource": "SOURCE", }], }, ...
फ़ील्ड | जानकारी |
---|---|
queryText
|
बातचीत का मूल टेक्स्ट. अगर Dialogflow मॉडल के लिए,
स्पेलिंग में अपने-आप सुधार होने की सुविधा चालू होती है, तो queryText में सही उपयोगकर्ता इनपुट शामिल होता है. |
intentName |
मेल खाने वाले इंटेंट का यूनीक आइडेंटिफ़ायर. |
intentDisplayName |
मेल खाने वाले इंटेंट का नाम. |
intentDetectionConfidence
|
queryText और intentName के बीच मैच में
न्यूमेरिक कॉन्फ़िडेंस रेटिंग. |
text |
टेक्स्ट में जवाब. |
jsonPayload
|
कस्टम पेलोड रिस्पॉन्स.
यह स्ट्रिंग, Dialogflow के लिए तय किए गए कस्टम पेलोड से मेल खाती है.
अगर पेलोड में कोई मान्य Business Messages JSON ऑब्जेक्ट नहीं है, तो error समस्या के बारे में बताता है. |
error |
इंटेंट पूरा करने वाले मैसेज की गड़बड़ी का ब्यौरा. |
userQuestion |
Dialogflow के ज़रिए पार्स किए गए सवाल, उपयोगकर्ता ने पूछा. |
faqQuestion |
Dialogflow के सवाल को उपयोगकर्ता के सवाल से मैच किया गया. |
faqAnswer |
Dialogflow के जवाब से उपयोगकर्ता के सवाल का मिलान हुआ. |
matchConfidenceLevel
|
userQuestion और faqQuestion के बीच मैच में कॉन्फ़िडेंस का लेवल. |
matchConfidence
|
userQuestion और faqQuestion के बीच मैच में
न्यूमेरिक कॉन्फ़िडेंस रेटिंग. |
autoResponded
|
Business Messages ने उपयोगकर्ता को Dialogflow के जवाब के साथ, अपने-आप जवाब दिए या नहीं. |
message |
अपने-आप दिए जाने वाले जवाब का पेलोड. |
responseSource
|
अपने-आप दिए जाने वाले जवाब का सोर्स.
ResponseSource देखें. |
Dialogflow CX
... "dialogflowResponse": { "queryText": "TEXT", "intentResponse": { "intentName": "INTENT_ID", "intentDisplayName": "INTENT_NAME", "intentDetectionConfidence": "CONFIDENCE_NUMERIC", "fulfillmentMessages": [{ "text": "FULFILLMENT_TEXT", "jsonPayload": "JSON", "error": "ERROR_STATUS", "liveAgentHandoff": { "metadata": {} } }], "autoResponded": "BOOLEAN", "autoRespondedMessages": [{ "message": "MESSAGE_JSON", "responseSource": "SOURCE", }], }, ...
फ़ील्ड | जानकारी |
---|---|
queryText
|
बातचीत का मूल टेक्स्ट. अगर Dialogflow मॉडल के लिए,
स्पेलिंग में अपने-आप सुधार होने की सुविधा चालू होती है, तो queryText में सही उपयोगकर्ता इनपुट शामिल होता है. |
intentName |
मेल खाने वाले इंटेंट का यूनीक आइडेंटिफ़ायर. |
intentDisplayName |
मेल खाने वाले इंटेंट का नाम. |
intentDetectionConfidence
|
queryText और intentName के बीच मैच में
न्यूमेरिक कॉन्फ़िडेंस रेटिंग. |
text |
टेक्स्ट में जवाब. |
jsonPayload
|
कस्टम पेलोड रिस्पॉन्स.
यह स्ट्रिंग, Dialogflow के लिए तय किए गए कस्टम पेलोड से मेल खाती है.
अगर पेलोड में कोई मान्य Business Messages JSON ऑब्जेक्ट नहीं है, तो error समस्या के बारे में बताता है. |
error |
इंटेंट पूरा करने वाले मैसेज की गड़बड़ी का ब्यौरा. |
liveAgentHandoff |
लाइव एजेंट के हैंडऑफ़ प्रोसेस के लिए कस्टम मेटाडेटा. |
autoResponded
|
Business Messages ने उपयोगकर्ता को Dialogflow के जवाब के साथ, अपने-आप जवाब दिए या नहीं. |
message |
अपने-आप दिए जाने वाले जवाब का पेलोड. |
responseSource
|
अपने-आप दिए जाने वाले जवाब का सोर्स.
ResponseSource देखें. |