Dialogflow에서 살펴보기
계속을 클릭하여 Dialogflow에서 도우미 샘플을 가져옵니다. 그런 다음 다음 단계에 따라 샘플을 배포하고 테스트합니다.
- 에이전트 이름을 입력하고 샘플의 새 Dialogflow 에이전트를 만듭니다.
- 에이전트 가져오기가 완료되면 Go to agent를 클릭합니다.
- 기본 탐색 메뉴에서 fulfillment로 이동합니다.
- 인라인 편집기를 사용 설정한 다음 배포를 클릭합니다. 편집기에 샘플 파일이 포함되어 있고 있습니다.
- 기본 탐색 메뉴에서 Integrations로 이동한 다음 Google을 클릭합니다. 어시스턴트를 탭합니다.
- 모달 창이 나타나면 변경사항 자동 미리보기를 사용 설정하고 테스트를 클릭합니다. 작업 시뮬레이터를 엽니다.
- 시뮬레이터에서
Talk to my test app
를 입력하여 샘플을 테스트합니다.
도우미가 어시스턴트에 잠시 대화를 인계받아 일반적인 데이터(예: 사용자의 성명, 날짜 및 시간, 배송 주소) 도우미를 요청하면 어시스턴트는 일관된 표준 UI를 제공하여 사용자가 정보를 얻을 수 있도록 하기 때문에 자체적으로 설계할 필요가 없습니다.
사용 개요
Dialogflow 및 Actions SDK에서 도우미를 사용하는 일반적인 프로세스 설명 참조하세요. 자세한 내용은 각 도우미에 대해 자세히 알아보세요.
Dialogflow
Node.js
- 적절한 도우미 객체로
conv.ask()
를 호출합니다. 날짜 도우미 함수를 호출하면 클라이언트 라이브러리가 상응하는 도우미 인텐트가 포함된 어시스턴트입니다. 기준: 어시스턴트는 상응하는 인텐트에 관한 대화상자를 실행하는 것을 인지하고 도움이 됩니다. - 다음에 해당하는 이벤트를 지정하는 Dialogflow 인텐트를 선언합니다. 도움이 될 수 있습니다 도우미 인텐트 보기 섹션을 참조하세요. 이 인텐트는 이벤트가 발생하면 항상 트리거되기 때문에 사용자가 말하는 모든 문구 실행됩니다 (어시스턴트가 도우미 실행이 완료된 경우).
- 어시스턴트가 후속 응답에서 도우미의 결과를 반환하면 처리 요청을 제출하면 해당 Dialogflow 인텐트가 트리거되고 인텐트를 정상적으로 처리합니다.
JSON
- 다음에서 도우미의 인텐트를 지정합니다. possibleIntents 객체에 응답할 수 없습니다. 어시스턴트가 도우미에 대한 대화를 실행해야 한다는 것을 인식합니다. 자세한 내용은 도우미 인텐트를 확인하여 요청을 처리할 수 있습니다
- 다음에 해당하는 이벤트를 지정하는 Dialogflow 인텐트를 선언합니다. 도움이 될 수 있습니다 도우미 인텐트 보기 섹션을 참조하세요. 이 인텐트는 이벤트가 발생하면 항상 트리거되기 때문에 사용자가 말하는 모든 문구 시작됩니다
- 어시스턴트가 후속 응답에서 도우미의 결과를 반환하면 요청을 처리하고, 요청과 필요한 데이터를 파싱합니다.
Actions SDK
Node.js
- 적절한 매개변수를 사용하여
ask
를 호출합니다. 도우미 함수는 어시스턴트에 요청하여 도우미 인텐트를 지원합니다. 도우미 함수를 호출할 때 클라이언트 라이브러리는 지정할 수 있습니다 인텐트에 따라 어시스턴트는 대화상자를 표시합니다. - 어시스턴트가 후속 응답에서 도우미의 결과를 반환하면 요청을 처리하면 합니다. 이를 통해 도우미가 결과를 반환했는지 감지할 수 있습니다. 사용 가져올 데이터를 가져올 수 있도록 도우미의 해당 getter 함수 알 수 있습니다
JSON
- 다음에서 도우미의 인텐트를 지정합니다. possibleIntents 객체에 응답할 수 없습니다. 어시스턴트가 도우미에 대한 대화를 실행해야 한다는 것을 인식합니다. 자세한 내용은 도우미 인텐트를 확인하여 요청을 처리할 수 있습니다
- 어시스턴트가 후속 응답에서 도우미의 결과를 반환하면 요청을 처리하고, 요청과 필요한 데이터를 파싱합니다.
도우미 인텐트
다음 표에서는 어시스턴트가 처리해야 합니다. Dialogflow를 사용하는 경우 도우미 인텐트에 해당하는 이벤트를 지정하는 Dialogflow 인텐트입니다.
인텐트 이름 | Dialogflow 이벤트 이름 | 사용 |
---|---|---|
actions.intent.PERMISSION |
actions_intent_PERMISSION |
사용자의 성명, 대략적인 위치, 정확한 위치 또는 이 3가지 모두를 가져옵니다. |
actions.intent.OPTION |
actions_intent_OPTION |
목록 또는 캐러셀 UI에서 선택한 항목을 수신합니다. 또는 사용자가 목록 또는 캐러셀 UI에서 선택하거나 음성 또는 텍스트를 수신하지 않음 목록 또는 캐러셀 UI의 키와 일치하는 입력을 반환합니다. |
actions.intent.DATETIME |
actions_intent_DATETIME |
사용자로부터 날짜 및 시간 입력을 가져옵니다. |
actions.intent.SIGN_IN |
actions_intent_SIGN_IN |
사용자 계정을 연결하기 위한 계정 연결 흐름을 요청합니다. |
actions.intent.PLACE |
actions_intent_PLACE |
사용자로부터 주소 또는 저장된 위치를 가져옵니다. |
actions.intent.CONFIRMATION |
actions_intent_CONFIRMATION |
사용자의 확인을 받습니다 (예: 예/아니요 질문에 대한 답변). |
다음 섹션에서는 사용 가능한 도우미와 연결된 인텐트를 설명합니다. 이 도우미를 사용하도록 요청해야 합니다.
사용자 정보
이 도우미를 사용하여 다음과 같은 사용자 정보를 가져올 수 있습니다.
- 표시 이름
- 이름
- 계열 이름
- 대략적인 기기 위치 (우편번호 및 도시)
- 정확한 기기 위치 (좌표 및 상세 주소)
도우미 호출
다음 코드 예에서는 클라이언트를 사용하여 도우미를 호출하는 방법을 보여줍니다. 있습니다. JSON 스니펫은 해당 웹훅 응답을 보여줍니다.
Node.js
app.intent('Permission', (conv) => { const permissions = ['NAME']; let context = 'To address you by name'; // Location permissions only work for verified users // https://developers.google.com/actions/assistant/guest-users if (conv.user.verification === 'VERIFIED') { // Could use DEVICE_COARSE_LOCATION instead for city, zip code permissions.push('DEVICE_PRECISE_LOCATION'); context += ' and know your location'; } const options = { context, permissions, }; conv.ask(new Permission(options)); });
자바
@ForIntent("Permission") public ActionResponse getPermission(ActionRequest request) { ResponseBuilder responseBuilder = getResponseBuilder(request); String[] permissions = new String[] {ConstantsKt.PERMISSION_NAME}; String context = "To address you by name"; // Location permissions only work for verified users // https://developers.google.com/actions/assistant/guest-users if (request.getUser().getUserVerificationStatus().equals("VERIFIED")) { // Could use PERMISSION_DEVICE_COARSE_LOCATION instead for city, zip code permissions = new String[] { ConstantsKt.PERMISSION_NAME, ConstantsKt.PERMISSION_DEVICE_PRECISE_LOCATION }; } responseBuilder .add("PLACEHOLDER") .add(new Permission().setPermissions(permissions).setContext(context)); return responseBuilder.build(); }
Node.js
const permissions = ['NAME']; let context = 'To address you by name'; // Location permissions only work for verified users // https://developers.google.com/actions/assistant/guest-users if (conv.user.verification === 'VERIFIED') { // Could use DEVICE_COARSE_LOCATION instead for city, zip code permissions.push('DEVICE_PRECISE_LOCATION'); context += ' and know your location'; } const options = { context, permissions, }; conv.ask(new Permission(options));
자바
ResponseBuilder responseBuilder = getResponseBuilder(request); String[] permissions = new String[] {ConstantsKt.PERMISSION_NAME}; String context = "To address you by name"; // Location permissions only work for verified users // https://developers.google.com/actions/assistant/guest-users if (request.getUser().getUserVerificationStatus().equals("VERIFIED")) { // Could use PERMISSION_DEVICE_COARSE_LOCATION instead for city, zip code permissions = new String[] { ConstantsKt.PERMISSION_NAME, ConstantsKt.PERMISSION_DEVICE_PRECISE_LOCATION }; } responseBuilder .add("PLACEHOLDER") .add(new Permission().setPermissions(permissions).setContext(context)); return responseBuilder.build();
JSON
아래 JSON은 웹훅 요청을 설명합니다.
{ "payload": { "google": { "expectUserResponse": true, "systemIntent": { "intent": "actions.intent.PERMISSION", "data": { "@type": "type.googleapis.com/google.actions.v2.PermissionValueSpec", "optContext": "To address you by name and know your location", "permissions": [ "NAME", "DEVICE_PRECISE_LOCATION" ] } } } } }
JSON
아래 JSON은 웹훅 요청을 설명합니다.
{ "expectUserResponse": true, "expectedInputs": [ { "possibleIntents": [ { "intent": "actions.intent.PERMISSION", "inputValueData": { "@type": "type.googleapis.com/google.actions.v2.PermissionValueSpec", "optContext": "To address you by name and know your location", "permissions": [ "NAME", "DEVICE_PRECISE_LOCATION" ] } } ] } ] }
도우미 결과 가져오기
다음 코드 예는 다음을 사용하여 도우미의 결과에 액세스하는 방법을 보여줍니다. 클라이언트 라이브러리로 이동하게 됩니다. JSON 스니펫은 처리에서 수신할 도우미의 결과입니다.
Node.js
app.intent('Permission Handler', (conv, params, confirmationGranted) => { // Also, can access latitude and longitude // const { latitude, longitude } = location.coordinates; const {location} = conv.device; const {name} = conv.user; if (confirmationGranted && name && location) { conv.ask(`Okay ${name.display}, I see you're at ` + `${location.formattedAddress}`); } else { conv.ask(`Looks like I can't get your information.`); } conv.ask(`Would you like to try another helper?`); conv.ask(new Suggestions([ 'Confirmation', 'DateTime', 'Place', ])); });
자바
@ForIntent("Permission Handler") public ActionResponse handlePermission(ActionRequest request) { ResponseBuilder responseBuilder = getResponseBuilder(request); Location location = request.getDevice().getLocation(); String name = request.getUser().getProfile().getDisplayName(); if (request.isPermissionGranted()) { responseBuilder.add("Okay " + name + ", I see you're at " + location.getFormattedAddress()); } else { responseBuilder.add("Looks like I can't get your information"); } responseBuilder .add("Would you like to try another helper?") .addSuggestions(new String[] {"Confirmation", "DateTime", "Place"}); return responseBuilder.build(); }
Node.js
app.intent('actions.intent.PERMISSION', (conv, confirmationGranted) => { // Also, can access latitude and longitude // const { latitude, longitude } = location.coordinates; const {location} = conv.device; const {name} = conv.user; if (confirmationGranted && name && location) { conv.ask(`Okay ${name.display}, I see you're at ` + `${location.formattedAddress}`); } else { conv.ask(`Looks like I can't get your information.`); } conv.ask(`Would you like to try another helper?`); conv.ask(new Suggestions([ 'Confirmation', 'DateTime', 'Place', ])); });
자바
@ForIntent("actions.intent.PERMISSION") public ActionResponse handlePermission(ActionRequest request) { ResponseBuilder responseBuilder = getResponseBuilder(request); Location location = request.getDevice().getLocation(); String name = request.getUser().getProfile().getDisplayName(); if (request.isPermissionGranted()) { responseBuilder.add("Okay " + name + ", I see you're at " + location.getFormattedAddress()); } else { responseBuilder.add("Looks like I can't get your information"); } responseBuilder .add("Would you like to try another helper?") .addSuggestions(new String[] {"Confirmation", "DateTime", "Place"}); return responseBuilder.build(); }
JSON
아래 JSON은 웹훅 요청을 설명합니다.
{ "responseId": "f26883c9-0283-4827-85bf-533f4442b4f9-712767ed", "queryResult": { "queryText": "actions_intent_PERMISSION", "parameters": {}, "allRequiredParamsPresent": true, "fulfillmentText": "Webhook failed for intent: Permission Handler", "fulfillmentMessages": [ { "text": { "text": [ "Webhook failed for intent: Permission Handler" ] } } ], "outputContexts": [ { "name": "projects/df-helpers-kohler/agent/sessions/ABwppHGu7m_m6bTsKuLb6noyG_o-9BMSf8J9cfY8dpJIPN_hHT79qfqRrZPtyx515K-sl9SU8Jy3auH6pLmy99Y/contexts/actions_capability_account_linking" }, { "name": "projects/df-helpers-kohler/agent/sessions/ABwppHGu7m_m6bTsKuLb6noyG_o-9BMSf8J9cfY8dpJIPN_hHT79qfqRrZPtyx515K-sl9SU8Jy3auH6pLmy99Y/contexts/actions_capability_screen_output" }, { "name": "projects/df-helpers-kohler/agent/sessions/ABwppHGu7m_m6bTsKuLb6noyG_o-9BMSf8J9cfY8dpJIPN_hHT79qfqRrZPtyx515K-sl9SU8Jy3auH6pLmy99Y/contexts/actions_capability_web_browser" }, { "name": "projects/df-helpers-kohler/agent/sessions/ABwppHGu7m_m6bTsKuLb6noyG_o-9BMSf8J9cfY8dpJIPN_hHT79qfqRrZPtyx515K-sl9SU8Jy3auH6pLmy99Y/contexts/actions_capability_audio_output" }, { "name": "projects/df-helpers-kohler/agent/sessions/ABwppHGu7m_m6bTsKuLb6noyG_o-9BMSf8J9cfY8dpJIPN_hHT79qfqRrZPtyx515K-sl9SU8Jy3auH6pLmy99Y/contexts/actions_capability_media_response_audio" }, { "name": "projects/df-helpers-kohler/agent/sessions/ABwppHGu7m_m6bTsKuLb6noyG_o-9BMSf8J9cfY8dpJIPN_hHT79qfqRrZPtyx515K-sl9SU8Jy3auH6pLmy99Y/contexts/google_assistant_input_type_keyboard" }, { "name": "projects/df-helpers-kohler/agent/sessions/ABwppHGu7m_m6bTsKuLb6noyG_o-9BMSf8J9cfY8dpJIPN_hHT79qfqRrZPtyx515K-sl9SU8Jy3auH6pLmy99Y/contexts/actions_intent_permission", "parameters": { "PERMISSION": true, "text": "yes" } } ], "intent": { "name": "projects/df-helpers-kohler/agent/intents/6475b0ef-dd52-4afa-a1b9-7a19e7e93a80", "displayName": "Permission Handler" }, "intentDetectionConfidence": 1, "languageCode": "en" }, "originalDetectIntentRequest": { "source": "google", "version": "2", "payload": { "user": { "profile": { "displayName": "Sachit Mishra", "givenName": "Sachit", "familyName": "Mishra" }, "permissions": [ "NAME", "DEVICE_PRECISE_LOCATION" ], "locale": "en-US", "userVerificationStatus": "VERIFIED" }, "conversation": { "conversationId": "ABwppHGu7m_m6bTsKuLb6noyG_o-9BMSf8J9cfY8dpJIPN_hHT79qfqRrZPtyx515K-sl9SU8Jy3auH6pLmy99Y", "type": "ACTIVE", "conversationToken": "[]" }, "inputs": [ { "intent": "actions.intent.PERMISSION", "rawInputs": [ { "inputType": "KEYBOARD", "query": "yes" } ], "arguments": [ { "name": "PERMISSION", "boolValue": true, "textValue": "true" }, { "name": "text", "rawText": "yes", "textValue": "yes" } ] } ], "surface": { "capabilities": [ { "name": "actions.capability.ACCOUNT_LINKING" }, { "name": "actions.capability.SCREEN_OUTPUT" }, { "name": "actions.capability.WEB_BROWSER" }, { "name": "actions.capability.AUDIO_OUTPUT" }, { "name": "actions.capability.MEDIA_RESPONSE_AUDIO" } ] }, "device": { "location": { "coordinates": { "latitude": 37.42241550000001, "longitude": -122.0840805 }, "formattedAddress": "Google Building 40 1600 Amphitheatre Parkway, Mountain View, California 94043", "zipCode": "94043", "city": "Mountain View" } }, "availableSurfaces": [ { "capabilities": [ { "name": "actions.capability.WEB_BROWSER" }, { "name": "actions.capability.SCREEN_OUTPUT" }, { "name": "actions.capability.AUDIO_OUTPUT" } ] } ] } }, "session": "projects/df-helpers-kohler/agent/sessions/ABwppHGu7m_m6bTsKuLb6noyG_o-9BMSf8J9cfY8dpJIPN_hHT79qfqRrZPtyx515K-sl9SU8Jy3auH6pLmy99Y" }
JSON
아래 JSON은 웹훅 요청을 설명합니다.
{ "user": { "profile": { "displayName": "Sachit Mishra", "givenName": "Sachit", "familyName": "Mishra" }, "permissions": [ "DEVICE_PRECISE_LOCATION", "NAME" ], "locale": "en-US", "userVerificationStatus": "VERIFIED" }, "conversation": { "conversationId": "ABwppHEcidO2jguO4hS8maDeMVx8aasSCcBWZHrF3EmOMIaWRP9qF0BcACistiIoeyiSNTW6KD_tqN_U-xAIOXhPvA", "type": "NEW" }, "inputs": [ { "intent": "actions.intent.PERMISSION", "rawInputs": [ { "inputType": "KEYBOARD", "query": "yes" } ], "arguments": [ { "name": "PERMISSION", "boolValue": true, "textValue": "true" }, { "name": "text", "rawText": "yes", "textValue": "yes" } ] } ], "surface": { "capabilities": [ { "name": "actions.capability.AUDIO_OUTPUT" }, { "name": "actions.capability.MEDIA_RESPONSE_AUDIO" }, { "name": "actions.capability.ACCOUNT_LINKING" }, { "name": "actions.capability.SCREEN_OUTPUT" }, { "name": "actions.capability.WEB_BROWSER" } ] }, "device": { "location": { "coordinates": { "latitude": 37.4197238, "longitude": -122.08212759999999 }, "formattedAddress": "Google Building 45 1585 Charleston Road, Mountain View, California 94043", "zipCode": "94043", "city": "Mountain View" } }, "availableSurfaces": [ { "capabilities": [ { "name": "actions.capability.SCREEN_OUTPUT" }, { "name": "actions.capability.WEB_BROWSER" }, { "name": "actions.capability.AUDIO_OUTPUT" } ] } ] }
위의 스니펫은 사용자가 정보를 부여했는지와 데이터에 액세스합니다.
사용자 정보를 얻은 후 이 정보를 계속 사용하는 것이 좋습니다. 다시 질문하지 않아도 됩니다 사용자 스토리지를 사용하여 대화 전반에 걸쳐 사용자 정보를 저장할 수 있습니다. Name Psychic 샘플을 확인해 보세요 (Node.js) 및 Java UserStorage를 사용해 보세요
목록 및 캐러셀 옵션
도우미 호출
다음 코드 예에서는 클라이언트를 사용하여 도우미를 호출하는 방법을 보여줍니다. 있습니다. JSON 스니펫은 해당 웹훅 응답을 보여줍니다.
Node.js
app.intent('List', (conv) => { if (!conv.screen) { conv.ask('Sorry, try this on a screen device or select the ' + 'phone surface in the simulator.'); return; } conv.ask('This is a list example.'); // Create a list conv.ask(new List({ title: 'List Title', items: { // Add the first item to the list 'SELECTION_KEY_ONE': { synonyms: [ 'synonym 1', 'synonym 2', 'synonym 3', ], title: 'Title of First List Item', description: 'This is a description of a list item.', image: new Image({ url: 'https://storage.googleapis.com/actionsresources/logo_assistant_2x_64dp.png', alt: 'Image alternate text', }), }, // Add the second item to the list 'SELECTION_KEY_GOOGLE_HOME': { synonyms: [ 'Google Home Assistant', 'Assistant on the Google Home', ], title: 'Google Home', description: 'Google Home is a voice-activated speaker powered by ' + 'the Google Assistant.', image: new Image({ url: 'https://storage.googleapis.com/actionsresources/logo_assistant_2x_64dp.png', alt: 'Google Home', }), }, // Add the third item to the list 'SELECTION_KEY_GOOGLE_PIXEL': { synonyms: [ 'Google Pixel XL', 'Pixel', 'Pixel XL', ], title: 'Google Pixel', description: 'Pixel. Phone by Google.', image: new Image({ url: 'https://storage.googleapis.com/actionsresources/logo_assistant_2x_64dp.png', alt: 'Google Pixel', }), }, }, })); });
자바
@ForIntent("List") public ActionResponse list(ActionRequest request) { ResponseBuilder responseBuilder = getResponseBuilder(request); if (!request.hasCapability(Capability.SCREEN_OUTPUT.getValue())) { return responseBuilder .add("Sorry, try ths on a screen device or select the phone surface in the simulator.") .add("Which response would you like to see next?") .build(); } responseBuilder .add("This is a list example.") .add( new SelectionList() .setTitle("List Title") .setItems( Arrays.asList( new ListSelectListItem() .setTitle("Title of First List Item") .setDescription("This is a description of a list item.") .setImage( new Image() .setUrl( "https://storage.googleapis.com/actionsresources/logo_assistant_2x_64dp.png") .setAccessibilityText("Image alternate text")) .setOptionInfo( new OptionInfo() .setSynonyms( Arrays.asList("synonym 1", "synonym 2", "synonym 3")) .setKey("SELECTION_KEY_ONE")), new ListSelectListItem() .setTitle("Google Home") .setDescription( "Google Home is a voice-activated speaker powered by the Google Assistant.") .setImage( new Image() .setUrl( "https://storage.googleapis.com/actionsresources/logo_assistant_2x_64dp.png") .setAccessibilityText("Google Home")) .setOptionInfo( new OptionInfo() .setSynonyms( Arrays.asList( "Google Home Assistant", "Assistant on the Google Home")) .setKey("SELECTION_KEY_GOOGLE_HOME")), new ListSelectListItem() .setTitle("Google Pixel") .setDescription("Pixel. Phone by Google.") .setImage( new Image() .setUrl( "https://storage.googleapis.com/actionsresources/logo_assistant_2x_64dp.png") .setAccessibilityText("Google Pixel")) .setOptionInfo( new OptionInfo() .setSynonyms( Arrays.asList("Google Pixel XL", "Pixel", "Pixel XL")) .setKey("SELECTION_KEY_GOOGLE_PIXEL"))))); return responseBuilder.build(); }
Node.js
if (!conv.screen) { conv.ask('Sorry, try this on a screen device or select the ' + 'phone surface in the simulator.'); return; } conv.ask('This is a list example.'); // Create a list conv.ask(new List({ title: 'List Title', items: { // Add the first item to the list 'SELECTION_KEY_ONE': { synonyms: [ 'synonym 1', 'synonym 2', 'synonym 3', ], title: 'Title of First List Item', description: 'This is a description of a list item.', image: new Image({ url: 'https://storage.googleapis.com/actionsresources/logo_assistant_2x_64dp.png', alt: 'Image alternate text', }), }, // Add the second item to the list 'SELECTION_KEY_GOOGLE_HOME': { synonyms: [ 'Google Home Assistant', 'Assistant on the Google Home', ], title: 'Google Home', description: 'Google Home is a voice-activated speaker powered by ' + 'the Google Assistant.', image: new Image({ url: 'https://storage.googleapis.com/actionsresources/logo_assistant_2x_64dp.png', alt: 'Google Home', }), }, // Add the third item to the list 'SELECTION_KEY_GOOGLE_PIXEL': { synonyms: [ 'Google Pixel XL', 'Pixel', 'Pixel XL', ], title: 'Google Pixel', description: 'Pixel. Phone by Google.', image: new Image({ url: 'https://storage.googleapis.com/actionsresources/logo_assistant_2x_64dp.png', alt: 'Google Pixel', }), }, }, }));
자바
ResponseBuilder responseBuilder = getResponseBuilder(request); if (!request.hasCapability(Capability.SCREEN_OUTPUT.getValue())) { return responseBuilder .add("Sorry, try ths on a screen device or select the phone surface in the simulator.") .add("Which response would you like to see next?") .build(); } responseBuilder .add("This is a list example.") .add( new SelectionList() .setTitle("List Title") .setItems( Arrays.asList( new ListSelectListItem() .setTitle("Title of First List Item") .setDescription("This is a description of a list item.") .setImage( new Image() .setUrl( "https://storage.googleapis.com/actionsresources/logo_assistant_2x_64dp.png") .setAccessibilityText("Image alternate text")) .setOptionInfo( new OptionInfo() .setSynonyms( Arrays.asList("synonym 1", "synonym 2", "synonym 3")) .setKey("SELECTION_KEY_ONE")), new ListSelectListItem() .setTitle("Google Home") .setDescription( "Google Home is a voice-activated speaker powered by the Google Assistant.") .setImage( new Image() .setUrl( "https://storage.googleapis.com/actionsresources/logo_assistant_2x_64dp.png") .setAccessibilityText("Google Home")) .setOptionInfo( new OptionInfo() .setSynonyms( Arrays.asList( "Google Home Assistant", "Assistant on the Google Home")) .setKey("SELECTION_KEY_GOOGLE_HOME")), new ListSelectListItem() .setTitle("Google Pixel") .setDescription("Pixel. Phone by Google.") .setImage( new Image() .setUrl( "https://storage.googleapis.com/actionsresources/logo_assistant_2x_64dp.png") .setAccessibilityText("Google Pixel")) .setOptionInfo( new OptionInfo() .setSynonyms( Arrays.asList("Google Pixel XL", "Pixel", "Pixel XL")) .setKey("SELECTION_KEY_GOOGLE_PIXEL"))))); return responseBuilder.build();
JSON
아래 JSON은 웹훅 응답을 설명합니다.
{ "payload": { "google": { "expectUserResponse": true, "systemIntent": { "intent": "actions.intent.OPTION", "data": { "@type": "type.googleapis.com/google.actions.v2.OptionValueSpec", "listSelect": { "title": "List Title", "items": [ { "optionInfo": { "key": "SELECTION_KEY_ONE", "synonyms": [ "synonym 1", "synonym 2", "synonym 3" ] }, "description": "This is a description of a list item.", "image": { "url": "https://storage.googleapis.com/actionsresources/logo_assistant_2x_64dp.png", "accessibilityText": "Image alternate text" }, "title": "Title of First List Item" }, { "optionInfo": { "key": "SELECTION_KEY_GOOGLE_HOME", "synonyms": [ "Google Home Assistant", "Assistant on the Google Home" ] }, "description": "Google Home is a voice-activated speaker powered by the Google Assistant.", "image": { "url": "https://storage.googleapis.com/actionsresources/logo_assistant_2x_64dp.png", "accessibilityText": "Google Home" }, "title": "Google Home" }, { "optionInfo": { "key": "SELECTION_KEY_GOOGLE_PIXEL", "synonyms": [ "Google Pixel XL", "Pixel", "Pixel XL" ] }, "description": "Pixel. Phone by Google.", "image": { "url": "https://storage.googleapis.com/actionsresources/logo_assistant_2x_64dp.png", "accessibilityText": "Google Pixel" }, "title": "Google Pixel" } ] } } }, "richResponse": { "items": [ { "simpleResponse": { "textToSpeech": "This is a list example." } } ] } } } }
JSON
아래 JSON은 웹훅 응답을 설명합니다.
{ "expectUserResponse": true, "expectedInputs": [ { "possibleIntents": [ { "intent": "actions.intent.OPTION", "inputValueData": { "@type": "type.googleapis.com/google.actions.v2.OptionValueSpec", "listSelect": { "title": "List Title", "items": [ { "optionInfo": { "key": "SELECTION_KEY_ONE", "synonyms": [ "synonym 1", "synonym 2", "synonym 3" ] }, "description": "This is a description of a list item.", "image": { "url": "https://storage.googleapis.com/actionsresources/logo_assistant_2x_64dp.png", "accessibilityText": "Image alternate text" }, "title": "Title of First List Item" }, { "optionInfo": { "key": "SELECTION_KEY_GOOGLE_HOME", "synonyms": [ "Google Home Assistant", "Assistant on the Google Home" ] }, "description": "Google Home is a voice-activated speaker powered by the Google Assistant.", "image": { "url": "https://storage.googleapis.com/actionsresources/logo_assistant_2x_64dp.png", "accessibilityText": "Google Home" }, "title": "Google Home" }, { "optionInfo": { "key": "SELECTION_KEY_GOOGLE_PIXEL", "synonyms": [ "Google Pixel XL", "Pixel", "Pixel XL" ] }, "description": "Pixel. Phone by Google.", "image": { "url": "https://storage.googleapis.com/actionsresources/logo_assistant_2x_64dp.png", "accessibilityText": "Google Pixel" }, "title": "Google Pixel" } ] } } } ], "inputPrompt": { "richInitialPrompt": { "items": [ { "simpleResponse": { "textToSpeech": "This is a list example." } } ] } } } ] }
목록 또는 캐러셀 UI를 표시하고 사용자로부터 선택된 옵션을 가져올 수 있습니다.
actions.intent.OPTION
인텐트로 요청을 처리합니다.
도우미 결과 가져오기
다음 코드 예는 클라이언트 라이브러리로 이동하게 됩니다. JSON 스니펫은 결과를 포함하는 요청을 나타냅니다. 처리에서 수신할 도우미의 값을 가져옵니다.
다음 스니펫은 사용자가 선택한 옵션을 확인하는 방법을 보여줍니다.
Node.js
app.intent('List - OPTION', (conv, params, option) => { const SELECTED_ITEM_RESPONSES = { 'SELECTION_KEY_ONE': 'You selected the first item', 'SELECTION_KEY_GOOGLE_HOME': 'You selected the Google Home!', 'SELECTION_KEY_GOOGLE_PIXEL': 'You selected the Google Pixel!', }; conv.ask(SELECTED_ITEM_RESPONSES[option]); conv.ask('Which response would you like to see next?'); });
자바
@ForIntent("List - OPTION") public ActionResponse listSelected(ActionRequest request) { ResponseBuilder responseBuilder = getResponseBuilder(request); String selectedItem = request.getSelectedOption(); String response; if (selectedItem.equals("SELECTION_KEY_ONE")) { response = "You selected the first item"; } else if (selectedItem.equals("SELECTION_KEY_GOOGLE_HOME")) { response = "You selected the Google Home!"; } else if (selectedItem.equals("SELECTION_KEY_GOOGLE_PIXEL")) { response = "You selected the Google Pixel!"; } else { response = "You did not select a valid item"; } return responseBuilder.add(response).add("Which response would you like to see next?").build(); }
Node.js
app.intent('actions.intent.OPTION', (conv, params, option) => { const SELECTED_ITEM_RESPONSES = { 'SELECTION_KEY_ONE': 'You selected the first item', 'SELECTION_KEY_GOOGLE_HOME': 'You selected the Google Home!', 'SELECTION_KEY_GOOGLE_PIXEL': 'You selected the Google Pixel!', }; conv.ask(SELECTED_ITEM_RESPONSES[option]); conv.ask('Which response would you like to see next?'); });
자바
@ForIntent("actions.intent.OPTION") public ActionResponse listSelected(ActionRequest request) { ResponseBuilder responseBuilder = getResponseBuilder(request); String selectedItem = request.getSelectedOption(); String response; if (selectedItem.equals("SELECTION_KEY_ONE")) { response = "You selected the first item"; } else if (selectedItem.equals("SELECTION_KEY_GOOGLE_HOME")) { response = "You selected the Google Home!"; } else if (selectedItem.equals("SELECTION_KEY_GOOGLE_PIXEL")) { response = "You selected the Google Pixel!"; } else { response = "You did not select a valid item"; } return responseBuilder.add(response).add("Which response would you like to see next?").build(); } public ActionResponse carousel(ActionRequest request) { ResponseBuilder responseBuilder = getResponseBuilder(request); if (!request.hasCapability(Capability.SCREEN_OUTPUT.getValue())) { return responseBuilder .add("Sorry, try ths on a screen device or select the phone surface in the simulator.") .add("Which response would you like to see next?") .build(); } responseBuilder .add("This is a carousel example.") .add( new SelectionCarousel() .setItems( Arrays.asList( new CarouselSelectCarouselItem() .setTitle("Title of First List Item") .setDescription("This is a description of a list item.") .setImage( new Image() .setUrl( "https://storage.googleapis.com/actionsresources/logo_assistant_2x_64dp.png") .setAccessibilityText("Image alternate text")) .setOptionInfo( new OptionInfo() .setSynonyms( Arrays.asList("synonym 1", "synonym 2", "synonym 3")) .setKey("SELECTION_KEY_ONE")), new CarouselSelectCarouselItem() .setTitle("Google Home") .setDescription( "Google Home is a voice-activated speaker powered by the Google Assistant.") .setImage( new Image() .setUrl( "https://storage.googleapis.com/actionsresources/logo_assistant_2x_64dp.png") .setAccessibilityText("Google Home")) .setOptionInfo( new OptionInfo() .setSynonyms( Arrays.asList( "Google Home Assistant", "Assistant on the Google Home")) .setKey("SELECTION_KEY_GOOGLE_HOME")), new CarouselSelectCarouselItem() .setTitle("Google Pixel") .setDescription("Pixel. Phone by Google.") .setImage( new Image() .setUrl( "https://storage.googleapis.com/actionsresources/logo_assistant_2x_64dp.png") .setAccessibilityText("Google Pixel")) .setOptionInfo( new OptionInfo() .setSynonyms( Arrays.asList("Google Pixel XL", "Pixel", "Pixel XL")) .setKey("SELECTION_KEY_GOOGLE_PIXEL"))))); return responseBuilder.build(); } }
JSON
아래 JSON은 웹훅 요청을 설명합니다.
{ "responseId": "5d7732d1-d22d-4a0e-ad34-8bc0a7fde20c-21947381", "queryResult": { "queryText": "actions_intent_OPTION", "action": "List.List-custom", "parameters": {}, "allRequiredParamsPresent": true, "fulfillmentText": "Webhook failed for intent: List - OPTION", "fulfillmentMessages": [ { "text": { "text": [ "Webhook failed for intent: List - OPTION" ] } } ], "outputContexts": [ { "name": "projects/df-responses-kohler/agent/sessions/ABwppHHsebncupHK11oKhsCTgyH96GRNYH-xpeeMTqb-cvOxbd67QenbRlZM4bGAIB8_KXdTfI7-7lYVKN1ovAhCaA/contexts/actions_capability_screen_output" }, { "name": "projects/df-responses-kohler/agent/sessions/ABwppHHsebncupHK11oKhsCTgyH96GRNYH-xpeeMTqb-cvOxbd67QenbRlZM4bGAIB8_KXdTfI7-7lYVKN1ovAhCaA/contexts/actions_capability_account_linking" }, { "name": "projects/df-responses-kohler/agent/sessions/ABwppHHsebncupHK11oKhsCTgyH96GRNYH-xpeeMTqb-cvOxbd67QenbRlZM4bGAIB8_KXdTfI7-7lYVKN1ovAhCaA/contexts/actions_capability_media_response_audio" }, { "name": "projects/df-responses-kohler/agent/sessions/ABwppHHsebncupHK11oKhsCTgyH96GRNYH-xpeeMTqb-cvOxbd67QenbRlZM4bGAIB8_KXdTfI7-7lYVKN1ovAhCaA/contexts/actions_capability_audio_output" }, { "name": "projects/df-responses-kohler/agent/sessions/ABwppHHsebncupHK11oKhsCTgyH96GRNYH-xpeeMTqb-cvOxbd67QenbRlZM4bGAIB8_KXdTfI7-7lYVKN1ovAhCaA/contexts/actions_capability_web_browser" }, { "name": "projects/df-responses-kohler/agent/sessions/ABwppHHsebncupHK11oKhsCTgyH96GRNYH-xpeeMTqb-cvOxbd67QenbRlZM4bGAIB8_KXdTfI7-7lYVKN1ovAhCaA/contexts/google_assistant_input_type_touch" }, { "name": "projects/df-responses-kohler/agent/sessions/ABwppHHsebncupHK11oKhsCTgyH96GRNYH-xpeeMTqb-cvOxbd67QenbRlZM4bGAIB8_KXdTfI7-7lYVKN1ovAhCaA/contexts/list-followup", "lifespanCount": 1 }, { "name": "projects/df-responses-kohler/agent/sessions/ABwppHHsebncupHK11oKhsCTgyH96GRNYH-xpeeMTqb-cvOxbd67QenbRlZM4bGAIB8_KXdTfI7-7lYVKN1ovAhCaA/contexts/actions_intent_option", "parameters": { "OPTION": "SELECTION_KEY_GOOGLE_PIXEL", "text": "Google Pixel" } } ], "intent": { "name": "projects/df-responses-kohler/agent/intents/88904350-193e-4472-a2de-977eb5d9e26e", "displayName": "List - OPTION" }, "intentDetectionConfidence": 1, "languageCode": "en" }, "originalDetectIntentRequest": { "source": "google", "version": "2", "payload": { "user": { "locale": "en-US", "lastSeen": "2019-08-04T23:56:32Z", "userVerificationStatus": "VERIFIED" }, "conversation": { "conversationId": "ABwppHHsebncupHK11oKhsCTgyH96GRNYH-xpeeMTqb-cvOxbd67QenbRlZM4bGAIB8_KXdTfI7-7lYVKN1ovAhCaA", "type": "ACTIVE", "conversationToken": "[\"list-followup\"]" }, "inputs": [ { "intent": "actions.intent.OPTION", "rawInputs": [ { "inputType": "TOUCH", "query": "Google Pixel" } ], "arguments": [ { "name": "OPTION", "textValue": "SELECTION_KEY_GOOGLE_PIXEL" }, { "name": "text", "rawText": "Google Pixel", "textValue": "Google Pixel" } ] } ], "surface": { "capabilities": [ { "name": "actions.capability.SCREEN_OUTPUT" }, { "name": "actions.capability.ACCOUNT_LINKING" }, { "name": "actions.capability.MEDIA_RESPONSE_AUDIO" }, { "name": "actions.capability.AUDIO_OUTPUT" }, { "name": "actions.capability.WEB_BROWSER" } ] }, "isInSandbox": true, "availableSurfaces": [ { "capabilities": [ { "name": "actions.capability.WEB_BROWSER" }, { "name": "actions.capability.SCREEN_OUTPUT" }, { "name": "actions.capability.AUDIO_OUTPUT" } ] } ], "requestType": "SIMULATOR" } }, "session": "projects/df-responses-kohler/agent/sessions/ABwppHHsebncupHK11oKhsCTgyH96GRNYH-xpeeMTqb-cvOxbd67QenbRlZM4bGAIB8_KXdTfI7-7lYVKN1ovAhCaA" }
JSON
아래 JSON은 웹훅 요청을 설명합니다.
{ "user": { "locale": "en-US", "lastSeen": "2019-08-06T07:37:53Z", "userVerificationStatus": "VERIFIED" }, "conversation": { "conversationId": "ABwppHGcqunXh1M6IE0lu2sVqXdpJfdpC5FWMkMSXQskK1nzb4IkSUSRqQzoEr0Ly0z_G3mwyZlk5rFtd1w", "type": "NEW" }, "inputs": [ { "intent": "actions.intent.OPTION", "rawInputs": [ { "inputType": "TOUCH", "query": "Google Home" } ], "arguments": [ { "name": "OPTION", "textValue": "SELECTION_KEY_GOOGLE_HOME" }, { "name": "text", "rawText": "Google Home", "textValue": "Google Home" } ] } ], "surface": { "capabilities": [ { "name": "actions.capability.AUDIO_OUTPUT" }, { "name": "actions.capability.MEDIA_RESPONSE_AUDIO" }, { "name": "actions.capability.ACCOUNT_LINKING" }, { "name": "actions.capability.SCREEN_OUTPUT" }, { "name": "actions.capability.WEB_BROWSER" } ] }, "isInSandbox": true, "availableSurfaces": [ { "capabilities": [ { "name": "actions.capability.WEB_BROWSER" }, { "name": "actions.capability.AUDIO_OUTPUT" }, { "name": "actions.capability.SCREEN_OUTPUT" } ] } ], "requestType": "SIMULATOR" }
날짜 및 시간
actions.intent.DATETIME
인텐트를 처리하세요.
도우미 호출
다음 코드 예에서는 클라이언트를 사용하여 도우미를 호출하는 방법을 보여줍니다. 있습니다. JSON 스니펫은 해당 웹훅 응답을 보여줍니다.
사용자에게 날짜 및 시간을 요청할 때
DateTime
권한을 만들 때 options
객체를 반환합니다.
Node.js
app.intent('Date Time', (conv) => { const options = { prompts: { initial: 'When would you like to schedule the appointment?', date: 'What day was that?', time: 'What time works for you?', }, }; conv.ask(new DateTime(options)); });
자바
@ForIntent("Date Time") public ActionResponse getDateTime(ActionRequest request) { ResponseBuilder responseBuilder = getResponseBuilder(request); responseBuilder .add("PLACEHOLDER") .add( new DateTimePrompt() .setDateTimePrompt("When would you like to schedule the appointment?") .setDatePrompt("What day was that?") .setTimePrompt("What time works for you?")); return responseBuilder.build(); }
Node.js
const options = { prompts: { initial: 'When would you like to schedule the appointment?', date: 'What day was that?', time: 'What time works for you?', }, }; conv.ask(new DateTime(options));
자바
ResponseBuilder responseBuilder = getResponseBuilder(request); responseBuilder .add("PLACEHOLDER") .add( new DateTimePrompt() .setDateTimePrompt("When would you like to schedule the appointment?") .setDatePrompt("What day was that?") .setTimePrompt("What time works for you?")); return responseBuilder.build();
JSON
아래 JSON은 웹훅 요청을 설명합니다.
{ "payload": { "google": { "expectUserResponse": true, "systemIntent": { "intent": "actions.intent.DATETIME", "data": { "@type": "type.googleapis.com/google.actions.v2.DateTimeValueSpec", "dialogSpec": { "requestDatetimeText": "When would you like to schedule the appointment?", "requestDateText": "What day was that?", "requestTimeText": "What time works for you?" } } } } } }
JSON
아래 JSON은 웹훅 요청을 설명합니다.
{ "expectUserResponse": true, "expectedInputs": [ { "possibleIntents": [ { "intent": "actions.intent.DATETIME", "inputValueData": { "@type": "type.googleapis.com/google.actions.v2.DateTimeValueSpec", "dialogSpec": { "requestDatetimeText": "When would you like to schedule the appointment?", "requestDateText": "What day was that?", "requestTimeText": "What time works for you?" } } } ] } ] }
도우미 결과 가져오기
다음 코드 예는 다음을 사용하여 도우미의 결과에 액세스하는 방법을 보여줍니다. 클라이언트 라이브러리로 이동하게 됩니다. JSON 스니펫은 결과를 포함하는 요청을 나타냅니다. 처리에서 수신할 도우미의 값을 가져옵니다.
아래 스니펫은 사용자가 액세스 권한을 부여했는지 확인하는 방법과 데이터에 액세스합니다.
Node.js
app.intent('Date Time Handler', (conv, params, datetime) => { const {month, day} = datetime.date; const {hours, minutes} = datetime.time; conv.ask(`<speak>` + `Great, we will see you on ` + `<say-as interpret-as="date" format="dm">${day}-${month}</say-as>` + `<say-as interpret-as="time" format="hms12" detail="2">${hours}` + `:${minutes || '00'}</say-as>` + `</speak>`); conv.ask('Would you like to try another helper?'); conv.ask(new Suggestions([ 'Confirmation', 'Permission', 'Place', ])); });
자바
@ForIntent("Date Time Handler") public ActionResponse handleDateTime(ActionRequest request) { ResponseBuilder responseBuilder = getResponseBuilder(request); DateTime dateTimeValue = request.getDateTime(); Integer day = dateTimeValue.getDate().getDay(); Integer month = dateTimeValue.getDate().getMonth(); Integer hours = dateTimeValue.getTime().getHours(); Integer minutes = dateTimeValue.getTime().getMinutes(); String minutesStr = (minutes != null) ? String.valueOf(minutes) : "00"; responseBuilder.add( "<speak>" + "Great, we will see you on " + "<say-as interpret-as=\"date\" format=\"dm\">" + day + "-" + month + "</say-as>" + "<say-as interpret-as=\"time\" format=\"hms12\" detail=\"2\">" + hours + ":" + minutesStr + "</say-as>" + "</speak>"); responseBuilder .add("Would you like to try another helper?") .addSuggestions(new String[] {"Confirmation", "Permission", "Place"}); return responseBuilder.build(); }
Node.js
app.intent('actions.intent.DATETIME', (conv) => { const datetime = conv.arguments.get('DATETIME'); const {month, day} = datetime.date; const {hours, minutes} = datetime.time; conv.ask(`<speak>` + `Great, we will see you on ` + `<say-as interpret-as="date" format="dm">${day}-${month}</say-as>` + `<say-as interpret-as="time" format="hms12" detail="2">${hours}` + `:${minutes || '00'}</say-as>` + `</speak>`); conv.ask('Would you like to try another helper?'); conv.ask(new Suggestions([ 'Confirmation', 'Permission', 'Place', ])); });
자바
@ForIntent("actions.intent.DATETIME") public ActionResponse datetimeHandler(ActionRequest request) { ResponseBuilder responseBuilder = getResponseBuilder(request); DateTime dateTimeValue = request.getDateTime(); Integer day = dateTimeValue.getDate().getDay(); Integer month = dateTimeValue.getDate().getMonth(); Integer hours = dateTimeValue.getTime().getHours(); Integer minutes = dateTimeValue.getTime().getMinutes(); String minutesStr = (minutes != null) ? String.valueOf(minutes) : "00"; responseBuilder.add( "<speak>" + "Great, we will see you on " + "<say-as interpret-as=\"date\" format=\"dm\">" + day + "-" + month + "</say-as>" + "<say-as interpret-as=\"time\" format=\"hms12\" detail=\"2\">" + hours + ":" + minutesStr + "</say-as>" + "</speak>"); responseBuilder .add("Would you like to try another helper?") .addSuggestions(new String[] {"Confirmation", "Permission", "Place"}); return responseBuilder.build(); }
JSON
아래 JSON은 웹훅 요청을 설명합니다.
{ "responseId": "2b0a039d-b033-4256-bd8a-ebb1f0ad90b4-712767ed", "queryResult": { "queryText": "actions_intent_DATETIME", "action": "DateTime.DateTime-custom", "parameters": {}, "allRequiredParamsPresent": true, "fulfillmentText": "Webhook failed for intent: Date Time Handler", "fulfillmentMessages": [ { "text": { "text": [ "Webhook failed for intent: Date Time Handler" ] } } ], "outputContexts": [ { "name": "projects/df-helpers-kohler/agent/sessions/ABwppHHnU7RSIOU994H8vd2wLYXbnoIAs3rk-4zUeiRAaX3aJ0dp68Y50MgvddE2stYuI6Hlu-MfWO75Gz76EeY/contexts/actions_capability_audio_output" }, { "name": "projects/df-helpers-kohler/agent/sessions/ABwppHHnU7RSIOU994H8vd2wLYXbnoIAs3rk-4zUeiRAaX3aJ0dp68Y50MgvddE2stYuI6Hlu-MfWO75Gz76EeY/contexts/actions_capability_screen_output" }, { "name": "projects/df-helpers-kohler/agent/sessions/ABwppHHnU7RSIOU994H8vd2wLYXbnoIAs3rk-4zUeiRAaX3aJ0dp68Y50MgvddE2stYuI6Hlu-MfWO75Gz76EeY/contexts/actions_capability_media_response_audio" }, { "name": "projects/df-helpers-kohler/agent/sessions/ABwppHHnU7RSIOU994H8vd2wLYXbnoIAs3rk-4zUeiRAaX3aJ0dp68Y50MgvddE2stYuI6Hlu-MfWO75Gz76EeY/contexts/actions_capability_account_linking" }, { "name": "projects/df-helpers-kohler/agent/sessions/ABwppHHnU7RSIOU994H8vd2wLYXbnoIAs3rk-4zUeiRAaX3aJ0dp68Y50MgvddE2stYuI6Hlu-MfWO75Gz76EeY/contexts/actions_capability_web_browser" }, { "name": "projects/df-helpers-kohler/agent/sessions/ABwppHHnU7RSIOU994H8vd2wLYXbnoIAs3rk-4zUeiRAaX3aJ0dp68Y50MgvddE2stYuI6Hlu-MfWO75Gz76EeY/contexts/google_assistant_input_type_keyboard" }, { "name": "projects/df-helpers-kohler/agent/sessions/ABwppHHnU7RSIOU994H8vd2wLYXbnoIAs3rk-4zUeiRAaX3aJ0dp68Y50MgvddE2stYuI6Hlu-MfWO75Gz76EeY/contexts/datetime-followup", "lifespanCount": 1 }, { "name": "projects/df-helpers-kohler/agent/sessions/ABwppHHnU7RSIOU994H8vd2wLYXbnoIAs3rk-4zUeiRAaX3aJ0dp68Y50MgvddE2stYuI6Hlu-MfWO75Gz76EeY/contexts/actions_intent_datetime", "parameters": { "DATETIME": "2019-08-14T10:30:00", "text": "1030am" } } ], "intent": { "name": "projects/df-helpers-kohler/agent/intents/3c145f18-32fe-40aa-842e-b99ab28c3f2a", "displayName": "Date Time Handler" }, "intentDetectionConfidence": 1, "languageCode": "en" }, "originalDetectIntentRequest": { "source": "google", "version": "2", "payload": { "user": { "locale": "en-US", "userVerificationStatus": "VERIFIED" }, "conversation": { "conversationId": "ABwppHHnU7RSIOU994H8vd2wLYXbnoIAs3rk-4zUeiRAaX3aJ0dp68Y50MgvddE2stYuI6Hlu-MfWO75Gz76EeY", "type": "ACTIVE", "conversationToken": "[\"datetime-followup\"]" }, "inputs": [ { "intent": "actions.intent.DATETIME", "rawInputs": [ { "inputType": "KEYBOARD", "query": "1030am" } ], "arguments": [ { "name": "DATETIME", "datetimeValue": { "date": { "year": 2019, "month": 8, "day": 14 }, "time": { "hours": 10, "minutes": 30 } } }, { "name": "text", "rawText": "1030am", "textValue": "1030am" } ] } ], "surface": { "capabilities": [ { "name": "actions.capability.AUDIO_OUTPUT" }, { "name": "actions.capability.SCREEN_OUTPUT" }, { "name": "actions.capability.MEDIA_RESPONSE_AUDIO" }, { "name": "actions.capability.ACCOUNT_LINKING" }, { "name": "actions.capability.WEB_BROWSER" } ] }, "availableSurfaces": [ { "capabilities": [ { "name": "actions.capability.AUDIO_OUTPUT" }, { "name": "actions.capability.SCREEN_OUTPUT" }, { "name": "actions.capability.WEB_BROWSER" } ] } ] } }, "session": "projects/df-helpers-kohler/agent/sessions/ABwppHHnU7RSIOU994H8vd2wLYXbnoIAs3rk-4zUeiRAaX3aJ0dp68Y50MgvddE2stYuI6Hlu-MfWO75Gz76EeY" }
JSON
아래 JSON은 웹훅 요청을 설명합니다.
{ "user": { "profile": { "displayName": "Sachit Mishra", "givenName": "Sachit", "familyName": "Mishra" }, "permissions": [ "DEVICE_PRECISE_LOCATION", "NAME" ], "locale": "en-US", "userVerificationStatus": "VERIFIED" }, "conversation": { "conversationId": "ABwppHEcidO2jguO4hS8maDeMVx8aasSCcBWZHrF3EmOMIaWRP9qF0BcACistiIoeyiSNTW6KD_tqN_U-xAIOXhPvA", "type": "NEW" }, "inputs": [ { "intent": "actions.intent.DATETIME", "rawInputs": [ { "inputType": "KEYBOARD", "query": "430pm" } ], "arguments": [ { "name": "DATETIME", "datetimeValue": { "date": { "year": 2019, "month": 8, "day": 18 }, "time": { "hours": 16, "minutes": 30 } } }, { "name": "text", "rawText": "430pm", "textValue": "430pm" } ] } ], "surface": { "capabilities": [ { "name": "actions.capability.ACCOUNT_LINKING" }, { "name": "actions.capability.WEB_BROWSER" }, { "name": "actions.capability.AUDIO_OUTPUT" }, { "name": "actions.capability.MEDIA_RESPONSE_AUDIO" }, { "name": "actions.capability.SCREEN_OUTPUT" } ] }, "device": { "location": { "coordinates": { "latitude": 37.4197238, "longitude": -122.08212759999999 }, "formattedAddress": "Google Building 45 1585 Charleston Road, Mountain View, California 94043", "zipCode": "94043", "city": "Mountain View" } }, "availableSurfaces": [ { "capabilities": [ { "name": "actions.capability.AUDIO_OUTPUT" }, { "name": "actions.capability.SCREEN_OUTPUT" }, { "name": "actions.capability.WEB_BROWSER" } ] } ] }
계정 로그인
사용자에게 내 계정과 연결된 계정에
actions.intent.SIGN_IN
인텐트의 처리를 요청하여 서비스를 호출합니다. 사용자 수
OAuth를 통해 음성으로 로그인할 수 없습니다.
도우미 호출
다음 코드 예에서는 클라이언트를 사용하여 도우미를 호출하는 방법을 보여줍니다. 있습니다. JSON 스니펫은 해당 웹훅 응답을 보여줍니다.
Node.js
const {SignIn} = require('actions-on-google'); app.intent('ask_for_sign_in_detail', (conv) => { conv.ask(new SignIn()); });
자바
ResponseBuilder responseBuilder = getResponseBuilder(request); return responseBuilder.add("This is the SignIn helper intent").add(new SignIn()).build();
JSON
{ "payload": { "google": { "expectUserResponse": true, "systemIntent": { "intent": "actions.intent.SIGN_IN", "data": { "@type": "type.googleapis.com/google.actions.v2.SignInValueSpec" } } } } }
JSON
{ "expectUserResponse": true, "expectedInputs": [ { "possibleIntents": [ { "intent": "actions.intent.SIGN_IN", "inputValueData": { "@type": "type.googleapis.com/google.actions.v2.SignInValueSpec" } } ] } ] }
도우미 결과 가져오기
다음 코드 예는 다음을 사용하여 도우미의 결과에 액세스하는 방법을 보여줍니다. 클라이언트 라이브러리로 이동하게 됩니다. JSON 스니펫은 결과를 포함하는 요청을 나타냅니다. 처리에서 수신할 도우미의 값을 가져옵니다.
아래 스니펫은 사용자가 액세스 권한을 부여했는지 확인하는 방법과 데이터에 액세스합니다.
Node.js
app.intent('ask_for_sign_in_confirmation', (conv, params, signin) => { if (signin.status !== 'OK') { return conv.ask('You need to sign in before using the app.'); } // const access = conv.user.access.token; // possibly do something with access token return conv.ask('Great! Thanks for signing in.'); });
자바
ResponseBuilder responseBuilder = getResponseBuilder(request); boolean signedIn = request.isSignInGranted(); return responseBuilder .add(signedIn ? "Great! Thanks for signin in." : "You must sign in before using the app.") .build();
JSON
{ "responseId": "", "queryResult": { "queryText": "", "action": "", "parameters": {}, "allRequiredParamsPresent": true, "fulfillmentText": "", "fulfillmentMessages": [], "outputContexts": [], "intent": { "name": "ask_for_sign_in_confirmation", "displayName": "ask_for_sign_in_confirmation" }, "intentDetectionConfidence": 1, "diagnosticInfo": {}, "languageCode": "" }, "originalDetectIntentRequest": { "source": "google", "version": "2", "payload": { "isInSandbox": true, "surface": { "capabilities": [ { "name": "actions.capability.SCREEN_OUTPUT" }, { "name": "actions.capability.AUDIO_OUTPUT" }, { "name": "actions.capability.MEDIA_RESPONSE_AUDIO" }, { "name": "actions.capability.WEB_BROWSER" } ] }, "inputs": [ { "rawInputs": [], "intent": "", "arguments": [ { "name": "SIGN_IN", "extension": { "@type": "type.googleapis.com/google.actions.v2.SignInValue", "status": "OK" } } ] } ], "user": {}, "conversation": {}, "availableSurfaces": [ { "capabilities": [ { "name": "actions.capability.SCREEN_OUTPUT" }, { "name": "actions.capability.AUDIO_OUTPUT" }, { "name": "actions.capability.MEDIA_RESPONSE_AUDIO" }, { "name": "actions.capability.WEB_BROWSER" } ] } ] } }, "session": "" }
JSON
{ "user": {}, "device": {}, "surface": { "capabilities": [ { "name": "actions.capability.SCREEN_OUTPUT" }, { "name": "actions.capability.AUDIO_OUTPUT" }, { "name": "actions.capability.MEDIA_RESPONSE_AUDIO" }, { "name": "actions.capability.WEB_BROWSER" } ] }, "conversation": {}, "inputs": [ { "rawInputs": [], "intent": "ask_for_sign_in_confirmation", "arguments": [ { "name": "SIGN_IN", "extension": { "@type": "type.googleapis.com/google.actions.v2.SignInValue", "status": "OK" } } ] } ], "availableSurfaces": [ { "capabilities": [ { "name": "actions.capability.SCREEN_OUTPUT" }, { "name": "actions.capability.AUDIO_OUTPUT" }, { "name": "actions.capability.MEDIA_RESPONSE_AUDIO" }, { "name": "actions.capability.WEB_BROWSER" } ] } ] }
장소 및 위치
actions.intent.PLACE
인텐트를 처리하세요. 이 도우미는 사용자에게
주소와 기타 위치
Google에 저장한 것입니다.
저장된 위치는 주소만 반환하며 연결된 매핑은 반환하지 않습니다. (예: 'HOME = 123 Main St'가 아닌 '123 Main St').
도우미 호출
다음 코드 예에서는 클라이언트를 사용하여 도우미를 호출하는 방법을 보여줍니다. 있습니다. JSON 스니펫은 해당 웹훅 응답을 보여줍니다.
Node.js
app.intent('Place', (conv) => { const options = { context: 'To find a location', prompt: 'Where would you like to go?', }; conv.ask(new Place(options)); });
자바
@ForIntent("Place") public ActionResponse getPlace(ActionRequest request) { ResponseBuilder responseBuilder = getResponseBuilder(request); responseBuilder .add("PLACEHOLDER") .add( new Place() .setRequestPrompt("Where would you like to go?") .setPermissionContext("To find a location")); return responseBuilder.build(); }
Node.js
const options = { context: 'To find a location', prompt: 'Where would you like to go?', }; conv.ask(new Place(options));
자바
ResponseBuilder responseBuilder = getResponseBuilder(request); responseBuilder .add("PLACEHOLDER") .add( new Place() .setRequestPrompt("Where would you like to go?") .setPermissionContext("To find a location")); return responseBuilder.build();
JSON
아래 JSON은 웹훅 요청을 설명합니다.
{ "payload": { "google": { "expectUserResponse": true, "systemIntent": { "intent": "actions.intent.PLACE", "data": { "@type": "type.googleapis.com/google.actions.v2.PlaceValueSpec", "dialogSpec": { "extension": { "@type": "type.googleapis.com/google.actions.v2.PlaceValueSpec.PlaceDialogSpec", "permissionContext": "To find a location", "requestPrompt": "Where would you like to go?" } } } } } } }
JSON
아래 JSON은 웹훅 요청을 설명합니다.
{ "expectUserResponse": true, "expectedInputs": [ { "possibleIntents": [ { "intent": "actions.intent.PLACE", "inputValueData": { "@type": "type.googleapis.com/google.actions.v2.PlaceValueSpec", "dialogSpec": { "extension": { "@type": "type.googleapis.com/google.actions.v2.PlaceValueSpec.PlaceDialogSpec", "permissionContext": "To find a location", "requestPrompt": "Where would you like to go?" } } } } ] } ] }
도우미 결과 가져오기
다음 코드 예는 다음을 사용하여 도우미의 결과에 액세스하는 방법을 보여줍니다. 클라이언트 라이브러리로 이동하게 됩니다. JSON 스니펫은 결과를 포함하는 요청을 나타냅니다. 처리에서 수신할 도우미의 값을 가져옵니다.
아래 스니펫은 사용자가 액세스 권한을 부여했는지 확인하는 방법과 데이터에 액세스합니다.
Node.js
app.intent('Place Handler', (conv, params, place) => { if (!place) { conv.ask(`Sorry, I couldn't get a location from you.`); } else { // Place also contains formattedAddress and coordinates const {name} = place; conv.ask(`${name} sounds like a great place to go!`); } conv.ask('Would you like to try another helper?'); conv.ask(new Suggestions([ 'Confirmation', 'DateTime', 'Permission', ])); });
자바
@ForIntent("Place Handler") public ActionResponse handlePlace(ActionRequest request) { ResponseBuilder responseBuilder = getResponseBuilder(request); Location location = request.getPlace(); if (location == null) { responseBuilder.add("Sorry, I couldn't get a location from you."); } else { responseBuilder.add(location.getName() + " sounds like a great place to go!"); } responseBuilder .add("Would you like to try another helper?") .addSuggestions(new String[] {"Confirmation", "DateTime", "Permission"}); return responseBuilder.build(); }
Node.js
app.intent('actions.intent.PLACE', (conv) => { const place = conv.arguments.get('PLACE'); if (!place) { conv.ask(`Sorry, I couldn't get a location from you.`); } else { // Place also contains formattedAddress and coordinates const {name} = place; conv.ask(`${name} sounds like a great place to go!`); } conv.ask('Would you like to try another helper?'); conv.ask(new Suggestions([ 'Confirmation', 'DateTime', 'Permission', ])); });
자바
@ForIntent("actions.intent.PLACE") public ActionResponse handlePlace(ActionRequest request) { ResponseBuilder responseBuilder = getResponseBuilder(request); Location location = request.getPlace(); if (location == null) { responseBuilder.add("Sorry, I couldn't get a location from you."); } else { responseBuilder.add(location.getName() + " sounds like a great place to go!"); } responseBuilder .add("Would you like to try another helper?") .addSuggestions(new String[] {"Confirmation", "DateTime", "Permission"}); return responseBuilder.build(); }
JSON
아래 JSON은 웹훅 요청을 설명합니다.
{ "responseId": "ce99fd40-b9ed-4151-bc99-f25db9eda8c5-712767ed", "queryResult": { "queryText": "actions_intent_PLACE", "action": "Place.Place-custom", "parameters": {}, "allRequiredParamsPresent": true, "fulfillmentText": "Webhook failed for intent: Place Handler", "fulfillmentMessages": [ { "text": { "text": [ "Webhook failed for intent: Place Handler" ] } } ], "outputContexts": [ { "name": "projects/df-helpers-kohler/agent/sessions/ABwppHEdLCo3vaqVs-pED_sPQDIUr_Ls5JYICyNks9vKbfUaIF8n4P7fYsKEYSiKvD3Vmnli9deu_uTB8s3nPeA/contexts/actions_capability_audio_output" }, { "name": "projects/df-helpers-kohler/agent/sessions/ABwppHEdLCo3vaqVs-pED_sPQDIUr_Ls5JYICyNks9vKbfUaIF8n4P7fYsKEYSiKvD3Vmnli9deu_uTB8s3nPeA/contexts/actions_capability_screen_output" }, { "name": "projects/df-helpers-kohler/agent/sessions/ABwppHEdLCo3vaqVs-pED_sPQDIUr_Ls5JYICyNks9vKbfUaIF8n4P7fYsKEYSiKvD3Vmnli9deu_uTB8s3nPeA/contexts/actions_capability_media_response_audio" }, { "name": "projects/df-helpers-kohler/agent/sessions/ABwppHEdLCo3vaqVs-pED_sPQDIUr_Ls5JYICyNks9vKbfUaIF8n4P7fYsKEYSiKvD3Vmnli9deu_uTB8s3nPeA/contexts/actions_capability_account_linking" }, { "name": "projects/df-helpers-kohler/agent/sessions/ABwppHEdLCo3vaqVs-pED_sPQDIUr_Ls5JYICyNks9vKbfUaIF8n4P7fYsKEYSiKvD3Vmnli9deu_uTB8s3nPeA/contexts/actions_capability_web_browser" }, { "name": "projects/df-helpers-kohler/agent/sessions/ABwppHEdLCo3vaqVs-pED_sPQDIUr_Ls5JYICyNks9vKbfUaIF8n4P7fYsKEYSiKvD3Vmnli9deu_uTB8s3nPeA/contexts/google_assistant_input_type_keyboard" }, { "name": "projects/df-helpers-kohler/agent/sessions/ABwppHEdLCo3vaqVs-pED_sPQDIUr_Ls5JYICyNks9vKbfUaIF8n4P7fYsKEYSiKvD3Vmnli9deu_uTB8s3nPeA/contexts/place-followup", "lifespanCount": 1 }, { "name": "projects/df-helpers-kohler/agent/sessions/ABwppHEdLCo3vaqVs-pED_sPQDIUr_Ls5JYICyNks9vKbfUaIF8n4P7fYsKEYSiKvD3Vmnli9deu_uTB8s3nPeA/contexts/actions_intent_place", "parameters": { "PLACE": "KFC, 2523 North Carson Street, Carson City, NV 89706, United States", "text": "yes" } } ], "intent": { "name": "projects/df-helpers-kohler/agent/intents/4cf9e154-e151-44db-ae79-84d8c5a707de", "displayName": "Place Handler" }, "intentDetectionConfidence": 1, "languageCode": "en" }, "originalDetectIntentRequest": { "source": "google", "version": "2", "payload": { "user": { "permissions": [ "DEVICE_PRECISE_LOCATION" ], "locale": "en-US", "userVerificationStatus": "VERIFIED" }, "conversation": { "conversationId": "ABwppHEdLCo3vaqVs-pED_sPQDIUr_Ls5JYICyNks9vKbfUaIF8n4P7fYsKEYSiKvD3Vmnli9deu_uTB8s3nPeA", "type": "ACTIVE", "conversationToken": "[\"place-followup\"]" }, "inputs": [ { "intent": "actions.intent.PLACE", "rawInputs": [ { "inputType": "KEYBOARD", "query": "Query handled by Actions on Google" } ], "arguments": [ { "name": "PLACE", "placeValue": { "coordinates": { "latitude": 39.182895, "longitude": -119.7679113 }, "formattedAddress": "KFC, 2523 North Carson Street, Carson City, NV 89706, United States", "name": "KFC", "placeId": "ChIJZfBpmMEKmYARFsfc574LgB8" } }, { "name": "text", "rawText": "yes", "textValue": "yes" } ] } ], "surface": { "capabilities": [ { "name": "actions.capability.AUDIO_OUTPUT" }, { "name": "actions.capability.SCREEN_OUTPUT" }, { "name": "actions.capability.MEDIA_RESPONSE_AUDIO" }, { "name": "actions.capability.ACCOUNT_LINKING" }, { "name": "actions.capability.WEB_BROWSER" } ] }, "device": { "location": { "coordinates": { "latitude": 39.2814592, "longitude": -120.12421119999999 }, "formattedAddress": "Currant Road, Truckee, California 96161", "zipCode": "96161", "city": "Truckee" } }, "availableSurfaces": [ { "capabilities": [ { "name": "actions.capability.WEB_BROWSER" }, { "name": "actions.capability.SCREEN_OUTPUT" }, { "name": "actions.capability.AUDIO_OUTPUT" } ] } ] } } }
JSON
아래 JSON은 웹훅 요청을 설명합니다.
{ "user": { "permissions": [ "DEVICE_PRECISE_LOCATION" ], "locale": "en-US", "userVerificationStatus": "VERIFIED" }, "conversation": { "conversationId": "ABwppHEcidO2jguO4hS8maDeMVx8aasSCcBWZHrF3EmOMIaWRP9qF0BcACistiIoeyiSNTW6KD_tqN_U-xAIOXhPvA", "type": "NEW" }, "inputs": [ { "intent": "actions.intent.PLACE", "rawInputs": [ { "inputType": "KEYBOARD", "query": "Query handled by Actions on Google" } ], "arguments": [ { "name": "PLACE", "placeValue": { "coordinates": { "latitude": 37.4219999, "longitude": -122.0840575 }, "formattedAddress": "Googleplex, 1600 Amphitheatre Parkway, Mountain View, CA 94043, United States", "name": "Googleplex", "placeId": "ChIJj61dQgK6j4AR4GeTYWZsKWw" } }, { "name": "text", "rawText": "googleplex", "textValue": "googleplex" } ] } ], "surface": { "capabilities": [ { "name": "actions.capability.AUDIO_OUTPUT" }, { "name": "actions.capability.MEDIA_RESPONSE_AUDIO" }, { "name": "actions.capability.ACCOUNT_LINKING" }, { "name": "actions.capability.SCREEN_OUTPUT" }, { "name": "actions.capability.WEB_BROWSER" } ] }, "device": { "location": { "coordinates": { "latitude": 37.4197238, "longitude": -122.08212759999999 }, "formattedAddress": "Google Building 45 1585 Charleston Road, Mountain View, California 94043", "zipCode": "94043", "city": "Mountain View" } }, "availableSurfaces": [ { "capabilities": [ { "name": "actions.capability.SCREEN_OUTPUT" }, { "name": "actions.capability.WEB_BROWSER" }, { "name": "actions.capability.AUDIO_OUTPUT" } ] } ] }
확인
사용자에게 일반적인 확인을 요청 (예/아니요 질문)하면 정답입니다. '예'의 문법 '아니요'를 선택합니다. 자연스럽게 확장되어 예: "응" 다양한 상황에서 사용할 수 있습니다
도우미 호출
다음 코드 예에서는 클라이언트를 사용하여 도우미를 호출하는 방법을 보여줍니다. 있습니다. JSON 스니펫은 해당 웹훅 응답을 보여줍니다.
사용자에게 확인을 요청할 때 맞춤 프롬프트를 지정할 수 있습니다.
Node.js
app.intent('Confirmation', (conv) => { conv.ask(new Confirmation('Can you confirm?')); });
자바
@ForIntent("Confirmation") public ActionResponse getConfirmation(ActionRequest request) { ResponseBuilder responseBuilder = getResponseBuilder(request); responseBuilder .add("PLACEHOLDER") .add(new Confirmation().setConfirmationText("Can you confirm?")); return responseBuilder.build(); }
Node.js
conv.ask(new Confirmation('Can you confirm?'));
자바
ResponseBuilder responseBuilder = getResponseBuilder(request); responseBuilder .add("PLACEHOLDER") .add(new Confirmation().setConfirmationText("Can you confirm?")); return responseBuilder.build();
JSON
아래 JSON은 웹훅 요청을 설명합니다.
{ "payload": { "google": { "expectUserResponse": true, "systemIntent": { "intent": "actions.intent.CONFIRMATION", "data": { "@type": "type.googleapis.com/google.actions.v2.ConfirmationValueSpec", "dialogSpec": { "requestConfirmationText": "Can you confirm?" } } } } } }
JSON
아래 JSON은 웹훅 요청을 설명합니다.
{ "expectUserResponse": true, "expectedInputs": [ { "possibleIntents": [ { "intent": "actions.intent.CONFIRMATION", "inputValueData": { "@type": "type.googleapis.com/google.actions.v2.ConfirmationValueSpec", "dialogSpec": { "requestConfirmationText": "Can you confirm?" } } } ] } ] }
도우미 결과 가져오기
다음 코드 예는 다음을 사용하여 도우미의 결과에 액세스하는 방법을 보여줍니다. 클라이언트 라이브러리로 이동하게 됩니다. JSON 스니펫은 결과를 포함하는 요청을 나타냅니다. 처리에서 수신할 도우미의 값을 가져옵니다.
사용자가 도우미에 응답하면 사용자의 확인 여부를 확인할 수 있습니다.
Node.js
app.intent('Confirmation Handler', (conv, params, confirmationGranted) => { conv.ask(confirmationGranted ? 'Thank you for confirming' : 'No problem, you have not confirmed'); conv.ask('Would you like to try another helper?'); conv.ask(new Suggestions([ 'DateTime', 'Permission', 'Place', ])); });
자바
@ForIntent("Confirmation Handler") public ActionResponse handleConfirmation(ActionRequest request) { ResponseBuilder responseBuilder = getResponseBuilder(request); boolean userConfirmation = request.getUserConfirmation(); responseBuilder .add(userConfirmation ? "Thank you for confirming" : "No problem, you have not confirmed") .addSuggestions(new String[] {"Place", "DateTime", "Permission"}); return responseBuilder.build(); }
Node.js
app.intent('actions.intent.CONFIRMATION', (conv, confirmationGranted) => { conv.ask(confirmationGranted ? 'Thank you for confirming' : 'No problem, you have not confirmed'); conv.ask('Would you like to try another helper?'); conv.ask(new Suggestions([ 'DateTime', 'Permission', 'Place', ])); });
자바
@ForIntent("actions.intent.CONFIRMATION") public ActionResponse handleConfirmation(ActionRequest request) { ResponseBuilder responseBuilder = getResponseBuilder(request); boolean userConfirmation = request.getUserConfirmation(); responseBuilder .add(userConfirmation ? "Thank you for confirming" : "No problem, you have not confirmed") .addSuggestions(new String[] {"Place", "DateTime", "Permission"}); return responseBuilder.build(); }
JSON
아래 JSON은 웹훅 요청을 설명합니다.
{ "responseId": "26c3dd46-321c-4ab5-9f6c-a445f6d5de01-712767ed", "queryResult": { "queryText": "actions_intent_CONFIRMATION", "parameters": {}, "allRequiredParamsPresent": true, "fulfillmentText": "Webhook failed for intent: Confirmation Handler", "fulfillmentMessages": [ { "text": { "text": [ "Webhook failed for intent: Confirmation Handler" ] } } ], "outputContexts": [ { "name": "projects/df-helpers-kohler/agent/sessions/ABwppHEdLCo3vaqVs-pED_sPQDIUr_Ls5JYICyNks9vKbfUaIF8n4P7fYsKEYSiKvD3Vmnli9deu_uTB8s3nPeA/contexts/actions_capability_account_linking" }, { "name": "projects/df-helpers-kohler/agent/sessions/ABwppHEdLCo3vaqVs-pED_sPQDIUr_Ls5JYICyNks9vKbfUaIF8n4P7fYsKEYSiKvD3Vmnli9deu_uTB8s3nPeA/contexts/actions_capability_media_response_audio" }, { "name": "projects/df-helpers-kohler/agent/sessions/ABwppHEdLCo3vaqVs-pED_sPQDIUr_Ls5JYICyNks9vKbfUaIF8n4P7fYsKEYSiKvD3Vmnli9deu_uTB8s3nPeA/contexts/actions_capability_audio_output" }, { "name": "projects/df-helpers-kohler/agent/sessions/ABwppHEdLCo3vaqVs-pED_sPQDIUr_Ls5JYICyNks9vKbfUaIF8n4P7fYsKEYSiKvD3Vmnli9deu_uTB8s3nPeA/contexts/actions_capability_web_browser" }, { "name": "projects/df-helpers-kohler/agent/sessions/ABwppHEdLCo3vaqVs-pED_sPQDIUr_Ls5JYICyNks9vKbfUaIF8n4P7fYsKEYSiKvD3Vmnli9deu_uTB8s3nPeA/contexts/actions_capability_screen_output" }, { "name": "projects/df-helpers-kohler/agent/sessions/ABwppHEdLCo3vaqVs-pED_sPQDIUr_Ls5JYICyNks9vKbfUaIF8n4P7fYsKEYSiKvD3Vmnli9deu_uTB8s3nPeA/contexts/google_assistant_input_type_keyboard" }, { "name": "projects/df-helpers-kohler/agent/sessions/ABwppHEdLCo3vaqVs-pED_sPQDIUr_Ls5JYICyNks9vKbfUaIF8n4P7fYsKEYSiKvD3Vmnli9deu_uTB8s3nPeA/contexts/actions_intent_confirmation", "parameters": { "CONFIRMATION": true, "text": "yes" } } ], "intent": { "name": "projects/df-helpers-kohler/agent/intents/11cc7c8e-0710-42ea-9cd9-723aff03e97f", "displayName": "Confirmation Handler" }, "intentDetectionConfidence": 1, "languageCode": "en" }, "originalDetectIntentRequest": { "source": "google", "version": "2", "payload": { "user": { "locale": "en-US", "userVerificationStatus": "VERIFIED" }, "conversation": { "conversationId": "ABwppHEdLCo3vaqVs-pED_sPQDIUr_Ls5JYICyNks9vKbfUaIF8n4P7fYsKEYSiKvD3Vmnli9deu_uTB8s3nPeA", "type": "ACTIVE", "conversationToken": "[]" }, "inputs": [ { "intent": "actions.intent.CONFIRMATION", "rawInputs": [ { "inputType": "KEYBOARD", "query": "yes" } ], "arguments": [ { "name": "CONFIRMATION", "boolValue": true }, { "name": "text", "rawText": "yes", "textValue": "yes" } ] } ], "surface": { "capabilities": [ { "name": "actions.capability.ACCOUNT_LINKING" }, { "name": "actions.capability.MEDIA_RESPONSE_AUDIO" }, { "name": "actions.capability.AUDIO_OUTPUT" }, { "name": "actions.capability.WEB_BROWSER" }, { "name": "actions.capability.SCREEN_OUTPUT" } ] }, "availableSurfaces": [ { "capabilities": [ { "name": "actions.capability.AUDIO_OUTPUT" }, { "name": "actions.capability.SCREEN_OUTPUT" }, { "name": "actions.capability.WEB_BROWSER" } ] } ] } }, "session": "projects/df-helpers-kohler/agent/sessions/ABwppHEdLCo3vaqVs-pED_sPQDIUr_Ls5JYICyNks9vKbfUaIF8n4P7fYsKEYSiKvD3Vmnli9deu_uTB8s3nPeA" }
JSON
아래 JSON은 웹훅 요청을 설명합니다.
{ "user": { "locale": "en-US", "userVerificationStatus": "VERIFIED" }, "conversation": { "conversationId": "ABwppHGY8XRtymCExS313Cc6Vp42zR0uQuGf6BwpSW0772Er-rxSTtFjs3KfGYu6jCDgHbA8IKVWjB8Gr9odc4yHhg", "type": "NEW" }, "inputs": [ { "intent": "actions.intent.CONFIRMATION", "rawInputs": [ { "inputType": "KEYBOARD", "query": "yes" } ], "arguments": [ { "name": "CONFIRMATION", "boolValue": true }, { "name": "text", "rawText": "yes", "textValue": "yes" } ] } ], "surface": { "capabilities": [ { "name": "actions.capability.MEDIA_RESPONSE_AUDIO" }, { "name": "actions.capability.SCREEN_OUTPUT" }, { "name": "actions.capability.WEB_BROWSER" }, { "name": "actions.capability.ACCOUNT_LINKING" }, { "name": "actions.capability.AUDIO_OUTPUT" } ] }, "availableSurfaces": [ { "capabilities": [ { "name": "actions.capability.AUDIO_OUTPUT" }, { "name": "actions.capability.SCREEN_OUTPUT" }, { "name": "actions.capability.WEB_BROWSER" } ] } ] }