Agen Business Messages mendukung integrasi langsung dengan
- Dialogflow ES: pencocokan intent dan bot FAQ
- Dialogflow CX: pencocokan intent dan handoff agen langsung
Untuk mengintegrasikan agen Business Messages dengan fitur lain dari Dialogflow ES atau Dialogflow CX, lihat setiap dokumentasi produk.
Saat pengguna mengirim pesan ke agen yang memiliki integrasi Dialogflow,
Business Messages meneruskan pesan pengguna ke Dialogflow dan mengirim respons
Dialogflow ke agen dalam objek
dialogflowResponse
pesan. Anda dapat mengonfigurasi agen untuk
otomatis mengirim respons Dialogflow kepada pengguna tanpa perlu melakukan
tindakan apa pun. Lihat Respons otomatis
untuk mengetahui detailnya.
Integrasi Dialogflow
Sebelum dapat memanfaatkan otomatisasi berbasis Dialogflow melalui Business Messages, Anda harus mengaktifkan integrasi Dialogflow.
Prasyarat
Untuk memulai, Anda memerlukan
- agen Business Messages
- agen Dialogflow di wilayah Global dengan bahasa utama Inggris (en)
Jika Anda tidak memiliki agen Dialogflow, buat agen.
Dialogflow ES
Sebelum dapat mengaktifkan integrasi Dialogflow ES, Anda memerlukan project ID agen Dialogflow. Untuk menemukan project ID,
- Buka Konsol Dialogflow.
- Pilih agen Dialogflow yang ingin Anda hubungkan ke Business Messages, lalu klik ikon roda gigi di samping nama agen.
- Di bagian Project Google, perhatikan nilai Project ID.
Dialogflow CX
Sebelum dapat mengaktifkan integrasi Dialogflow CX, Anda memerlukan project ID dan ID agen agen Dialogflow Anda. Untuk menemukan ID ini,
- Buka Dialogflow CX Console.
- Pilih project Dialogflow Anda.
- Di pemilih agen, klik menu tambahan di samping agen Dialogflow Anda.
- Klik Salin nama. Tindakan ini akan menyalin nama lengkap agen Anda dalam
format berikut:
projects/PROJECT_ID/locations/REGION_ID/agents/AGENT_ID
. - Perhatikan nilai project ID dan ID agen.
Membuat integrasi
Dapatkan email akun layanan Dialogflow partner dari
dialogflowServiceAccountEmail
. Ganti PARTNER_ID dengan ID partner Anda.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)
Salin email akun layanan. Akun ini menghubungkan agen Business Messages dan agen Dialogflow Anda.
Di Google Cloud Console, pilih project Dialogflow Anda.
Buka izin IAM.
Klik Tambahkan, lalu masukkan email akun layanan untuk Anggota baru.
Untuk Select a role, pilih Dialogflow Console Agent Editor.
Klik Tambahkan peran lain, lalu pilih Dialogflow API Client.
Klik Simpan.
Integrasikan project Dialogflow dengan agen Business Messages Anda.
Ganti AUTO_RESPONSE_STATUS dengan ENABLED atau DISABLED, bergantung pada apakah Anda ingin Business Messages merespons pengguna secara otomatis dengan respons Dialogflow atau tidak.
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)
Untuk opsi pemformatan dan nilai, lihat
Integration
.
Perlu waktu sekitar dua menit untuk menghubungkan Business Messages dan Dialogflow. Untuk
memeriksa status integrasi, dapatkan
OperationInfo
integrasi.
Memperbarui integrasi
Untuk memperbarui setelan respons otomatis agen, jalankan perintah berikut. Ganti AUTO_RESPONSE_STATUS dengan DIAKTIFKAN atau NONAKTIF, bergantung pada apakah Anda ingin Business Messages merespons pengguna secara otomatis dengan respons 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 }'
Untuk opsi pemformatan dan nilai, lihat
Integration
.
Beralih antaredisi Dialogflow
Agen Business Messages hanya dapat mendukung satu integrasi Dialogflow pada satu waktu. Untuk beralih dari satu edisi Dialogflow ke edisi lainnya, Anda harus menghapus integrasi saat ini sebelum membuat yang baru.
Menghapus integrasi
Jika Anda perlu menghapus Dialogflow dari agen Business Messages, hapus integrasi dengan perintah berikut.
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)
Untuk opsi pemformatan dan nilai, lihat
Integration
.
Mendapatkan informasi integrasi
Untuk mendapatkan informasi tentang integrasi, Anda dapat menggunakan Business Communications API, asalkan Anda memiliki nilai name
integrasi.
Mendapatkan info untuk satu integrasi
Untuk mendapatkan informasi integrasi, jalankan perintah berikut.
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)
Untuk opsi pemformatan dan nilai, lihat
Integration
.
Menampilkan daftar semua integrasi untuk agen
Jika tidak mengetahui nama integrasi, Anda bisa mendapatkan informasi untuk semua integrasi yang terkait dengan agen dengan menghapus nilai INTEGRATION_ID dari URL permintaan GET.
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)
Untuk opsi pemformatan dan nilai, lihat
Integration
.
Pencocokan intent
Setelah Anda mengaktifkan integrasi Dialogflow untuk agen Business Messages, agen Anda dapat menggunakan intent yang dikonfigurasi oleh project Dialogflow untuk memahami dan merespons pertanyaan pengguna tanpa harus menulis kode. Untuk mempelajari intent lebih lanjut, lihat dokumentasi untuk Dialogflow ES dan Dialogflow CX.
Konfigurasikan intent Dialogflow Anda untuk setiap opsi percakapan yang ingin Anda dukung melalui otomatisasi. Agen Business Messages mengandalkan Dialogflow untuk memahami pesan pengguna.
Saat memanggil Dialogflow API, Business Messages akan meneruskan payload pesan pengguna ke intent dan webhook pemenuhan Anda. Saat pesan pengguna dicocokkan dengan intent, Anda dapat mengakses payload ini dalam format Struct
di kolom business_messages_payload
dalam QueryParameters
.
Payload berisi semua kolom dari pesan pengguna kecuali DialogflowResponse
.
Untuk Dialogflow CX, Business Messages juga meneruskan parameter sesi bernama channel
dengan nilai google_business_messages
ke intent dan Anda dapat mereferensikannya di agen dengan format berikut: $session.params.channel
.
Parameter ini dapat digunakan untuk menambahkan kondisional ke fulfillment Dialogflow Anda untuk mendukung beberapa saluran di agen Dialogflow yang sama.
Untuk informasi selengkapnya tentang parameter kueri, lihat referensi Dialogflow ES dan Dialogflow CX.
Prasyarat
Saat membuat model NLU dalam Dialogflow, Anda dapat mengonfigurasi berbagai jenis respons untuk intent. Business Messages mendukung respons Default, yang dapat mencakup hal berikut:
- Teks
- Payload kustom
- Pengalihan agen langsung (khusus Dialogflow CX)
Payload kustom harus cocok dengan objek respons pesan JSON Business Messages yang valid. Saat mengonfigurasi respons payload kustom untuk intent, Business Messages akan mengabaikan kolom berikut:
name
messageId
representative
Lihat contoh respons berikut.
Teks dengan saran
{
"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"
}
}
]
}
Kartu informasi
{
"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"
}
}
]
}
}
}
}
Carousel kartu informasi
{
"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
}
}
}
]
}
}
}
Penyerahan agen langsung
{
"metadata": {}
}
Bot FAQ
Setelah mengaktifkan integrasi Dialogflow ES untuk agen Business Messages, Anda dapat membuat bot FAQ. Jika Anda memberikan pertanyaan dan jawaban sebagai dokumen pengetahuan yang didukung, Business Messages dan Dialogflow akan membuat infrastruktur yang diperlukan untuk memahami dan merespons pertanyaan pengguna tanpa harus menulis kode.
Untuk melihat cara kerja bot FAQ, chat dengan Bot FAQ Business Messages.
Prasyarat
Sebelum membuat bot FAQ, Anda memerlukan pertanyaan dan jawaban yang tersedia sebagai dokumen pengetahuan (maks. 50 MB): file HTML atau file CSV yang tersedia untuk publik.
Umumnya, dokumen pengetahuan
- Dapat menyertakan Markdown terbatas dalam jawaban, seperti yang ditentukan dalam Teks lengkap.
- Memiliki ukuran maksimum 50 MB.
- Tidak boleh melebihi 2.000 pasangan pertanyaan/jawaban.
- Jangan mendukung pertanyaan duplikat dengan jawaban yang berbeda.
Untuk file HTML,
- File dari URL publik harus di-crawl oleh pengindeks penelusuran Google sehingga file tersebut ada di indeks penelusuran. Anda dapat memeriksanya dengan Google Search Console. Perhatikan bahwa pengindeks tidak selalu memperbarui konten Anda. Anda harus secara eksplisit memperbarui dokumen saat konten sumber berubah.
- Dialogflow akan menghapus tag HTML dari konten saat membuat respons. Oleh karena ini, sebaiknya hindari tag HTML dan gunakan teks biasa jika memungkinkan.
- File dengan satu pasangan pertanyaan/jawaban tidak didukung.
Untuk file CSV,
- File harus memiliki pertanyaan di kolom pertama dan jawaban di kolom kedua, tanpa header.
- File harus menggunakan koma sebagai pembatas.
Membuat bot FAQ
Untuk membuat bot FAQ, pertama-tama buat pusat pengetahuan untuk menyimpan semua data bot, lalu tambahkan satu atau beberapa dokumen dengan pasangan pertanyaan/jawaban ke pusat pengetahuan Anda.
Membuat pusat informasi
Untuk membuat pusat informasi, jalankan perintah berikut. Ganti BRAND_ID, AGENT_ID, dan INTEGRATION_ID dengan nilai unik dari name
dokumen. Ganti KNOWLEDGE_BASE_DISPLAY_NAME dengan string pengidentifikasi pilihan Anda.
Setelah membuat pusat informasi, Anda dapat membuat dokumen di dalamnya.
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__" } ] } }'
Untuk opsi pemformatan dan nilai, lihat
DialogflowKnowledgebase
.
Membuat dokumen pengetahuan
Untuk membuat dokumen pengetahuan, jalankan perintah berikut.
Tambahkan dokumen ke daftar dokumen yang ada, atau buat daftar baru jika belum ada. Daftar dokumen yang ada harus menyertakan nilai name
dokumen dalam permintaan.
File HTML publik
Ganti variabel berikut:
- BRAND_ID, AGENT_ID, dan INTEGRATION_ID
dengan nilai unik dari
name
integrasi - KNOWLEDGE_BASE_DISPLAY_NAME dan DOCUMENT_DISPLAY_NAME dengan mengidentifikasi string pilihan Anda
PUBLIC_URL dengan URL publik dokumen pengetahuan
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__" } ] } ] } }'
File CSV lokal
Ganti variabel berikut:
- BRAND_ID, AGENT_ID, dan INTEGRATION_ID
dengan nilai unik dari
name
integrasi - KNOWLEDGE_BASE_DISPLAY_NAME dan DOCUMENT_DISPLAY_NAME dengan mengidentifikasi string pilihan Anda
CSV_RAW_BYTES dengan file CSV sebagai string berenkode 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__" } ] } ] } }'
Untuk opsi pemformatan dan nilai, lihat
DialogflowKnowledgebase
.
Perlu waktu sekitar dua menit untuk menambahkan dokumen ke pusat informasi. Untuk memeriksa
status dokumen, dapatkan OperationInfo
integrasi.
Menghapus dokumen pengetahuan
Jika Anda perlu menghapus pasangan pertanyaan/jawaban dari agen Business Messages, hapus dokumen pengetahuan yang berisi perintah tersebut dengan perintah berikut.
Jalankan perintah berikut untuk menghapus satu dokumen yang ada. Ganti BRAND_ID, AGENT_ID, dan INTEGRATION_ID dengan nilai unik dari name
dokumen. Ganti KNOWLEDGE_BASE_DISPLAY_NAME dengan string yang sesuai.
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__" } ] } }'
Untuk opsi pemformatan dan nilai, lihat
DialogflowKnowledgebase
.
Respons otomatis
Jika Anda mengaktifkan respons otomatis selama integrasi Dialogflow, Business Messages akan otomatis merespons pengguna melalui Dialogflow. Agen Business Message merespons dengan tingkat keyakinan tertinggi yang cocok. Dengan integrasi Dialogflow ES, jika ada kecocokan dengan jawaban FAQ dan intent kustom, Business Messages akan merespons dengan kecocokan yang memiliki tingkat keyakinan tertinggi.
Business Messages menandai semua pesan yang direspons otomatis sebagai berasal dari BOT
perwakilan. Jika agen Anda mendukung agen langsung,
Business Messages menangguhkan respons otomatis setelah REPRESENTATIVE_JOINED
peristiwa
dan melanjutkan respons otomatis setelah REPRESENTATIVE_LEFT
peristiwa. Lihat Menyerahkan
dari bot ke agen langsung.
Respons otomatis dengan jawaban FAQ
Dengan integrasi Dialogflow ES, jika jawaban FAQ memiliki tingkat keyakinan tertinggi, Business Messages akan memetakan jawaban ke pesan teks. Jika ada jawaban terkait tetapi berbeda, pesan akan menampilkan "Lihat saran jawaban lainnya". Jika tidak, pesan akan menyertakan pertanyaan dan saran balasan untuk menanyakan apakah pesan tersebut memenuhi permintaan pengguna.
Merespons otomatis dengan respons intent
Respons intent dapat menyertakan satu atau beberapa respons berikut.
- Dialogflow ES: Text, Payload kustom
- Dialogflow CX: Teks, Payload kustom, Handoff agen langsung
Jika respons intent memiliki tingkat keyakinan tertinggi yang cocok, hal berikut akan berlaku.
- Jika respons memiliki setidaknya satu nilai Teks, Business Messages akan memetakan nilai ini ke pesan teks.
- Jika respons memiliki setidaknya satu payload Kustom dengan struktur objek JSON Business Messages yang valid, Business Messages akan membuat pesan menggunakan objek JSON yang disediakan.
- Jika respons memiliki setidaknya satu respons handoff Agen langsung, lihat Respons otomatis dengan permintaan agen langsung.
Karena Dialogflow dapat menyertakan beberapa respons dalam satu pencocokan intent, Business Messages akan mengirimkan setiap respons Teks, payload Kustom, atau Handoff agen langsung sebagai pesan terpisah. Jika ada beberapa pesan dalam kecocokan intent, tetapi beberapa pesan tersebut salah format, Business Messages hanya akan mengirimkan pesan yang valid sebagai respons otomatis.
Respons otomatis dengan permintaan agen langsung
Dialogflow CX mendukung respons Handoff agen langsung. Ini menandakan bahwa percakapan harus diserahkan kepada perwakilan manusia, dan memungkinkan Anda meneruskan metadata kustom untuk prosedur handoff Anda. Jika respons intent memiliki tingkat keyakinan tertinggi yang cocok, dan mencakup handoff agen Live, Business Messages akan mengirimkan peristiwa permintaan agen langsung ke webhook Anda. Untuk menangani peristiwa ini, lihat Menyerahkan dari bot ke agen langsung.
Merespons otomatis dengan pesan penggantian
Jika Dialogflow tidak mendapatkan tingkat keyakinan yang tinggi, Business Messages akan mengirimkan respons penggantian. Penggantian ditangani secara berbeda dalam Dialogflow ES dan Dialogflow CX.
Dialogflow ES
Untuk bot FAQ, jika tidak ada kecocokan dengan jawaban FAQ, Business Messages akan mengirimkan pesan penggantian yang tidak dapat ditemukan jawabannya.
Untuk intent yang dikonfigurasi, jika tidak ada kecocokan dengan respons intent, Business Message akan mengirimkan respons intent fallback. Anda dapat menggunakan teks penggantian yang disediakan oleh Dialogflow, atau mengonfigurasi penggantian dengan teks dan payload kustom tambahan.
Berikut adalah contoh respons intent fallback yang dapat diterima webhook Anda:
{
"intentResponses": [
{
"intentName": "projects/df-integration/agent/intents/12345",
"intentDisplayName": "Default Fallback Intent",
"intentDetectionConfidence": "1.0",
"fulfillmentMessages": [
{
"text": "One more time?"
}
]
}
]
}
Dialogflow mengisi otomatis intent_name
dan intent_display_name
.
Dialogflow CX
Dialogflow CX menangani respons intent fallback sebagai peristiwa bawaan. Jika tidak ada kecocokan dengan respons intent, Business Messages akan mengirimkan pesan penggantian dari peristiwa default No-match di Dialogflow. Anda dapat menggunakan teks penggantian yang disediakan oleh Dialogflow, atau mengonfigurasi penggantian dengan teks tambahan, payload kustom, dan opsi handoff agen langsung.
Berikut adalah contoh respons intent fallback yang dapat diterima webhook Anda:
{
"intentResponses": [
{
"intentName": "sys.no-match-default",
"intentDisplayName": "Default Fallback Intent",
"intentDetectionConfidence": "0.3",
"fulfillmentMessages": [
{
"text": "I missed that, say that again?"
}
]
}
]
}
Business Messages melakukan hard code intent_name
dan intent_display_name
.
Kolom khusus dialogflow
Setelah Anda mengaktifkan integrasi Dialogflow, pesan pengguna yang
diterima oleh agen
akan menyertakan objek
dialogflowResponse
. Webhook Anda menerima payload untuk semua pesan pengguna, terlepas dari apakah Pesan Bisnis merespons pesan tersebut secara otomatis atau tidak. Untuk memeriksa respons otomatis, lihat nilai kolom
autoResponded
dan tentukan apakah Anda perlu merespons pengguna.
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", }], }, ...
Kolom | Deskripsi |
---|---|
queryText
|
Teks kueri percakapan asli. Jika koreksi ejaan
otomatis diaktifkan untuk model Dialogflow, queryText
akan berisi input pengguna yang telah diperbaiki. |
intentName |
ID unik dari intent yang cocok. |
intentDisplayName |
Nama intent yang cocok. |
intentDetectionConfidence
|
Rating keyakinan numerik dalam kecocokan
antara queryText dan intentName . |
text |
Respons teks. |
jsonPayload
|
Respons payload kustom.
String ini cocok dengan payload
kustom yang ditentukan dalam Dialogflow.
Jika payload tidak memiliki struktur objek JSON Business Messages yang valid, error akan menjelaskan masalahnya. |
error |
Deskripsi error dengan pesan pemenuhan intent. |
userQuestion |
Pertanyaan yang diajukan pengguna, seperti yang diuraikan oleh Dialogflow. |
faqQuestion |
Pertanyaan dari Dialogflow cocok dengan pertanyaan pengguna. |
faqAnswer |
Jawaban dari Dialogflow cocok dengan pertanyaan pengguna. |
matchConfidenceLevel
|
Tingkat keyakinan dalam kecocokan antara userQuestion dan faqQuestion . |
matchConfidence
|
Rating keyakinan numerik dalam kecocokan antara
userQuestion dan faqQuestion . |
autoResponded
|
Apakah Business Messages otomatis merespons pengguna dengan jawaban dari Dialogflow atau tidak. |
message |
Payload respons otomatis. |
responseSource
|
Sumber respons otomatis. Lihat
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", }], }, ...
Kolom | Deskripsi |
---|---|
queryText
|
Teks kueri percakapan asli. Jika koreksi ejaan
otomatis diaktifkan untuk model Dialogflow, queryText
akan berisi input pengguna yang telah diperbaiki. |
intentName |
ID unik dari intent yang cocok. |
intentDisplayName |
Nama intent yang cocok. |
intentDetectionConfidence
|
Rating keyakinan numerik dalam kecocokan
antara queryText dan intentName . |
text |
Respons teks. |
jsonPayload
|
Respons payload kustom.
String ini cocok dengan payload
kustom yang ditentukan dalam Dialogflow.
Jika payload tidak memiliki struktur objek JSON Business Messages yang valid, error akan menjelaskan masalahnya. |
error |
Deskripsi error dengan pesan pemenuhan intent. |
liveAgentHandoff |
Metadata kustom untuk prosedur handoff agen langsung. |
autoResponded
|
Apakah Business Messages otomatis merespons pengguna dengan jawaban dari Dialogflow atau tidak. |
message |
Payload respons otomatis. |
responseSource
|
Sumber respons otomatis. Lihat
ResponseSource . |