ビジネス メッセージ エージェントは、
- Dialogflow ES: インテント マッチングおよびよくある質問 bot
- Dialogflow CX: インテント マッチングと人間のエージェントへの引き継ぎ
ビジネス メッセージ エージェントを Dialogflow ES または Dialogflow CX の他の機能と統合するには、各プロダクトのドキュメントをご覧ください。
ユーザーが Dialogflow を統合したエージェントにメッセージを送信すると、ビジネス メッセージはユーザー メッセージを Dialogflow に渡し、メッセージの dialogflowResponse
オブジェクトで Dialogflow のレスポンスをエージェントに送信します。Dialogflow のレスポンスをユーザーに自動的に送信するように、エージェントによるアクションを構成することができます。詳細については、自動応答をご覧ください。
Dialogflow との統合
ビジネス メッセージを通じて Dialogflow ベースの自動化を活用するには、まず Dialogflow との統合を有効にする必要があります。
Prerequisites
開始するには、以下が必要です。
- ビジネス メッセージ エージェント
- ルート言語が英語(en)の Global リージョンの Dialogflow エージェント
Dialogflow エージェントがない場合は、作成してください。
Dialogflow ES
Dialogflow ES 統合を有効にするには、Dialogflow エージェントのプロジェクト ID が必要です。プロジェクト ID を確認するには:
- Dialogflow コンソールに移動します。
- ビジネス メッセージに接続する Dialogflow エージェントを選択し、エージェント名の横にある歯車アイコン をクリックします。
- [Google プロジェクト] の [プロジェクト ID] の値をメモします。
Dialogflow CX
Dialogflow CX の統合を有効にするには、Dialogflow エージェントのプロジェクト ID とエージェント ID が必要です。ID を確認する手順は次のとおりです。
- Dialogflow CX コンソールに移動します。
- Dialogflow プロジェクトを選択します。
- エージェント セレクタで、Dialogflow エージェントの横にあるオーバーフロー メニュー をクリックします。
- [名前をコピー] をクリックします。エージェントの完全な名前が
projects/PROJECT_ID/locations/REGION_ID/agents/AGENT_ID
の形式でコピーされます。 - プロジェクト ID とエージェント ID の値をメモします。
統合を作成する
dialogflowServiceAccountEmail
からパートナーの Dialogflow サービス アカウントのメールアドレスを取得します。PARTNER_ID は実際のパートナー 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)
サービス アカウントのメールアドレスをコピーします。このアカウントは、ビジネス メッセージと Dialogflow エージェントを接続します。
Google Cloud Console で、Dialogflow プロジェクトを選択します。
IAM 権限に移動します。
[追加] をクリックし、[新しいメンバー] のサービス アカウントのメールアドレスを入力します。
[ロールを選択] で、[Dialogflow コンソール エージェント編集者] を選択します。
[別のロールを追加] をクリックして、[Dialogflow API クライアント] を選択します。
[保存] をクリックします。
Dialogflow プロジェクトをビジネス メッセージ エージェントと統合する。
AUTO_RESPONSE_STATUS を Dialogflow レスポンスでビジネス ユーザーに自動応答するかどうかに応じて、ENABLED または DISABLED に置き換えます。
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
をご覧ください。
ビジネス メッセージと Dialogflow の接続には約 2 分かかります。統合のステータスを確認するには、統合の OperationInfo
を取得します。
統合の更新
エージェントの自動応答設定を更新するには、次のコマンドを実行します。AUTO_RESPONSE_STATUS を Dialogflow レスポンスでビジネス メッセージに自動的に応答するかどうかに応じて、ENABLED または DISABLED に置き換えます。
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 エディションを切り替える
ビジネス メッセージ エージェントは、一度に 1 つの Dialogflow 統合のみをサポートできます。Dialogflow エディションを別のエディションに切り替えるには、新しい統合を作成する前に現在の統合を削除する必要があります。
統合を削除する
ビジネス メッセージ エージェントから 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
値があれば、Business Communications API を使用して統合に関する情報を取得できます。
1 つの統合に関する情報を取得する
統合情報を取得するには、次のコマンドを実行します。
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
をご覧ください。
エージェントのすべての統合を一覧表示する
統合の名前が不明な場合は、GET リクエスト URL から 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
をご覧ください。
インテント マッチング
ビジネス メッセージ エージェントの Dialogflow 統合を有効にすると、エージェントは Dialogflow プロジェクトで構成されたインテントを使用して、コードを記述することなくユーザーの質問を理解して応答できます。インテントの詳細については、Dialogflow ES と Dialogflow CX のドキュメントをご覧ください。
自動化によりサポートするすべての会話オプションに対して Dialogflow インテントを構成します。ビジネス メッセージ エージェントは、ユーザー メッセージを理解するために Dialogflow を使用します。
Dialogflow API を呼び出すと、ビジネス メッセージはユーザー メッセージ ペイロードをインテントとフルフィルメント Webhook に渡します。ユーザー メッセージがインテントと一致すると、このペイロードには QueryParameters
内の business_messages_payload
フィールドの Struct
形式でアクセスできます。
ペイロードには、ユーザー メッセージから DialogflowResponse
を除くすべてのフィールドが含まれています。
Dialogflow CX の場合、ビジネス メッセージによって、google_business_messages
という名前の channel
というセッション パラメータもインテントに渡され、これを $session.params.channel
の形式でエージェント内で参照できます。
このパラメータを使用すると、Dialogflow フルフィルメントに条件を追加して、同じ Dialogflow エージェントで複数のチャネルをサポートできます。
クエリ パラメータの詳細については、Dialogflow ES と Dialogflow CX のリファレンスをご覧ください。
Prerequisites
Dialogflow 内で NLU モデルを作成する場合は、インテントに異なるレスポンス タイプを構成できます。ビジネス メッセージは、次のレスポンスを含むデフォルトのレスポンスをサポートしています。
- Text
- カスタム ペイロード
- ライブ対応のエージェントへの引き継ぎ(Dialogflow CX のみ)
カスタム ペイロードは、有効なビジネス メッセージの JSON メッセージ レスポンス オブジェクトと一致する必要があります。インテントのカスタム ペイロード レスポンスを構成するとき、ビジネス メッセージは次のフィールドを無視します。
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": {}
}
よくある質問: bot
ビジネス メッセージ エージェントに対して Dialogflow ES の統合を有効にすると、FAQ bot を作成できます。サポート対象のナレッジ ドキュメントとして質問と回答を提供すると、ビジネス メッセージと Dialogflow は、コードを記述することなく、ユーザーの質問を理解して応答するために必要なインフラストラクチャを作成します。
FAQ ボットの実際の動作を確認するため、ビジネス メッセージに関するよくある質問の bot とチャットします。
Prerequisites
FAQ bot を作成する前に、質問と回答をナレッジ ドキュメント(最大 50 MB)として公開する必要があります。これは、一般公開されている HTML ファイルまたは CSV ファイルです。
一般的に、ナレッジ ドキュメントは
- リッチテキストで指定されているように、回答に限定的なマークダウンを含めることができます。
- 最大サイズは 50 MB です。
- 質問と回答のペアは 2,000 個まで。
- 回答が異なる質問は重複して入力しないでください。
HTML ファイルの場合:
- 公開 URL からのファイルは、Google 検索インデクサによってクロールされ、検索インデックスに存在している必要があります。これは、Google Search Console で確認できます。インデクサはコンテンツを最新の状態に維持しません。ソース コンテンツが変更されたときに、ドキュメントを明示的に更新する必要があります。
- Dialogflow は、レスポンスの作成時にコンテンツから HTML タグを削除します。このため、HTML タグの使用は避け、可能であれば書式なしテキストを使用することをおすすめします。
- 質問と回答のペアが 1 つであるファイルはサポートされていません。
CSV ファイルの場合:
- ファイルの 1 列目に質問、2 列目に解答を含める必要があります。ヘッダーはありません。
- ファイルの区切り文字にはカンマを使用する必要があります。
FAQ bot を作成する
FAQ bot を作成するには、まず bot のすべてのデータを格納するナレッジベースを作成し、質問と回答のペアを含む 1 つ以上のドキュメントをナレッジベースに追加します。
ナレッジベースを作成する
ナレッジベースを作成するには、次のコマンドを実行します。BRAND_ID、AGENT_ID、INTEGRATION_ID は、ドキュメントの name
にある一意の値に置き換えます。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 は、統合の
name
から一意の値に置き換えます。 - KNOWLEDGE_BASE_DISPLAY_NAME と DOCUMENT_DISPLAY_NAME。任意の文字列を識別します。
PUBLIC_URL は、ナレッジ ドキュメントの公開 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 は、統合の
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
をご覧ください。
ナレッジベースにドキュメントが追加されるまでに 2 分ほどかかります。ドキュメントのステータスを確認するには、統合の OperationInfo
を取得します。
ナレッジ ドキュメントを削除する
ビジネス メッセージ エージェントから質問と回答のペアを削除する必要がある場合は、次のコマンドを使用して、それらを含むナレッジ ドキュメントを削除します。
次のコマンドを実行して、既存のドキュメントを 1 つだけ削除します。BRAND_ID、AGENT_ID、INTEGRATION_ID は、ドキュメントの name
にある一意の値に置き換えます。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 との統合中に自動返信を有効にすると、ビジネス メッセージが Dialogflow を介してユーザーに自動的に応答します。ビジネス メッセージ エージェントは、最も高い信頼度の一致で応答します。Dialogflow ES の統合では、よくある質問の回答とカスタム インテントの両方に一致する場合、ビジネス メッセージは信頼度が最も高い一致で応答します。
ビジネス メッセージでは、すべての自動返信メッセージが BOT
の代理人から送信されたものとしてマークされます。エージェントがライブ エージェントをサポートしている場合、ビジネス メッセージは REPRESENTATIVE_JOINED
イベントの後に自動返信を一時停止し、REPRESENTATIVE_LEFT
イベント後に自動返信を再開します。bot から人間のエージェントへの引き継ぎをご覧ください。
よくある質問の回答を自動返信する
Dialogflow ES の統合では、よくある質問の回答の信頼度が最も高い場合、ビジネス メッセージによって回答がテキスト メッセージにマッピングされます。関連があるものの別の回答がある場合は、メッセージに「別の回答を表示」の提案が表示されます。表示されていない場合は、メッセージに質問が含まれており、メッセージがユーザーのリクエストを満たしているかどうかを尋ねる返信が返されます。
インテント レスポンスで自動応答
インテント レスポンスには、次のレスポンスを 1 つ以上含めることができます。
- Dialogflow ES: テキスト、カスタム ペイロード
- Dialogflow CX: テキスト、カスタム ペイロード、人間のエージェントへの引き継ぎ
インテント レスポンスの信頼度レベルが最も高い場合、以下が適用されます。
- レスポンスに少なくとも 1 つのテキスト値がある場合、ビジネス メッセージはこの値をテキスト メッセージにマッピングします。
- 有効なビジネス メッセージの JSON オブジェクト構造を持つカスタム ペイロードがレスポンスに少なくとも 1 つある場合、ビジネス メッセージは指定された JSON オブジェクトを使用してメッセージを作成します。
- レスポンスに少なくとも 1 つのライブ エージェント ハンドオフ レスポンスがある場合は、ライブ エージェント リクエストによる自動返信をご覧ください。
Dialogflow では 1 つのインテントの一致内に複数のレスポンスを含めることができるため、ビジネス メッセージは各テキスト、カスタム ペイロード、ライブ エージェントのハンドオフ レスポンスを個別のメッセージとして送信します。インテントに一致するメッセージが複数あるが、その一部が異常な場合は、ビジネス メッセージによって有効なメッセージのみが自動応答として送信されます。
人間のエージェントからのリクエストで自動返信
Dialogflow CX は、人間のエージェントへの引き継ぎのレスポンスをサポートしています。これは、会話を人間の担当者に渡す必要があることを示し、ハンドオフ手順のためにカスタム メタデータを渡すことができます。インテント レスポンスの信頼度レベルが最高で、ライブ エージェントのハンドオフが含まれている場合、ビジネス メッセージはライブ エージェントにリクエストされたイベントを Webhook に送信します。このイベントを処理する方法については、bot から人間のエージェントへの引き継ぎをご覧ください。
フォールバック メッセージで自動応答
Dialogflow が信頼度の高い一致を取得できない場合、ビジネス メッセージはフォールバック レスポンスを送信します。Dialogflow ES と Dialogflow CX では、フォールバックの処理方法が異なります。
Dialogflow ES
「よくある質問」bot の場合、よくある質問の回答と一致しない場合、ビジネス メッセージは、回答が見つからなかったというフォールバック メッセージを送信します。
構成済みインテントの場合、インテント レスポンスに一致するものがない場合、ビジネス メッセージはフォールバック インテント レスポンスを送信します。Dialogflow が提供する代替テキストを使用することも、テキストとカスタム ペイロードを追加して構成することもできます。
Webhook が受信できるフォールバック インテント レスポンスの例を次に示します。
{
"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 はフォールバック インテント レスポンスを組み込みイベントとして処理します。インテント レスポンスに一致するものがない場合、ビジネス メッセージは Dialogflow の no-match デフォルト イベントからフォールバック メッセージを送信します。Dialogflow が提供するフォールバック テキストを使用することも、追加のテキスト、カスタム ペイロード、人間のエージェントへの引き継ぎオプションを含むフォールバックを構成することもできます。
Webhook が受信できるフォールバック インテント レスポンスの例を次に示します。
{
"intentResponses": [
{
"intentName": "sys.no-match-default",
"intentDisplayName": "Default Fallback Intent",
"intentDetectionConfidence": "0.3",
"fulfillmentMessages": [
{
"text": "I missed that, say that again?"
}
]
}
]
}
ビジネス メッセージは intent_name
と intent_display_name
をハードコードします。
Dialogflow 固有のフィールド
Dialogflow 統合を有効にすると、エージェントが受け取るユーザー メッセージには dialogflowResponse
オブジェクトが含まれます。Webhook がビジネス メッセージに代わってメッセージに自動的に応答したかどうかにかかわらず、すべてのユーザー メッセージのペイロードを受信します。自動返信を確認するには、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 で定義されたカスタム ペイロードと一致します。ペイロードに有効なビジネス メッセージの JSON オブジェクト構造がない場合、error はその問題を表します。 |
error |
インテント フルフィルメント メッセージを含むエラーの説明。 |
userQuestion |
Dialogflow によって解析された、ユーザーが尋ねた質問。 |
faqQuestion |
Dialogflow からの質問とユーザーの質問との一致。 |
faqAnswer |
Dialogflow からの回答がユーザーの質問に一致する。 |
matchConfidenceLevel
|
userQuestion と faqQuestion の一致の信頼度。 |
matchConfidence
|
userQuestion と faqQuestion の間の一致の数値信頼度。 |
autoResponded
|
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 で定義されたカスタム ペイロードと一致します。ペイロードに有効なビジネス メッセージの JSON オブジェクト構造がない場合、error はその問題を表します。 |
error |
インテント フルフィルメント メッセージを含むエラーの説明。 |
liveAgentHandoff |
人間のエージェントの引き継ぎ手順のカスタム メタデータ。 |
autoResponded
|
Dialogflow からの回答をビジネス メッセージによってユーザーに自動返信したかどうか。 |
message |
自動応答のペイロード。 |
responseSource
|
自動返信の送信元。ResponseSource をご覧ください。 |