다음 코드 스니펫은 대화 웹훅 (JSON)의 예를 보여줍니다.
사용자가 "공기질 어때
샌프란시스코?':
"inputs":[{"intent":"actions.intent.CHECK_AIR_QUALITY","rawInputs":[{"inputType":"VOICE","query":"what is the air quality in san francisco tomorrow"}],"arguments":[{"name":"location","structuredValue":{"geo":{"longitude":-122.41941550000001,"latitude":37.7749295},"@context":"https://schema.org","@type":"Place","name":"san francisco"}},{"name":"temporalCoverage","rawText":"2018-04-25","textValue":"2018-04-25"}]}]
app.intent('actions.intent.CHECK_AIR_QUALITY',(conv)=>{constattributes=conv.arguments.get('attributes');constlocation=conv.arguments.get('location');consttemporal_coverage=conv.arguments.get('temporalCoverage');Consttime_indicator=conv.arguments.get('timeIndicator')//YourActionlogic.Ifyouneedtouseanyoftheparametervalues,//youshouldcheckfirstthatitisdefined.Arguments.getreturns//undefinedifitcan't find a value for a parameter.});
내장 인텐트와의 통합 테스트
통합을 테스트하려면 다음 단계를 따르세요.
테스트 작업이 사용 설정된 상태로 작업 시뮬레이터를 열거나 엽니다.
기기에서 어시스턴트를 사용할 수 있습니다.
내장 인텐트와 관련된 쿼리를 말하거나 입력합니다. 예를 들어
“게임하고 싶어.”
표시된 앱 선택 대화상자에서 작업을 찾습니다.
앱에 인텐트를 보낼 앱을 선택합니다.
그림 3. 내장 인텐트 문구에서 생성되는 작업 선택 대화상자
그림 4. 내장 인텐트에 연결된 작업 호출
내장 인텐트 사용 권장사항
내장 인텐트를 사용할 때는 다음 권장사항을 따라야 합니다.
내장 인텐트를 특정 작업에 매핑: 특정 내장 인텐트가
작업을 트리거하고 사용자를 특정 인텐트로 보내고
기능을 최대한 원활하게 구현하세요. 대상
작업이 PLAY_GAME 내장 인텐트를 지원하고
해당 인텐트를 수신하면 사용자를 즉시 게임 기능으로 보내야 합니다.
확인할 수 있습니다 게임을 하고 싶은지 사용자에게 다시 묻지 않습니다.
내장 인텐트 매개변수 처리: 내장 인텐트를 사용해야 합니다.
매개변수 값을 포함해야 합니다.
사용자에게 이러한 값을 다시 입력하라는 메시지를 표시하지 않습니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-26(UTC)"],[[["\u003cp\u003eBuilt-in intents allow your Google Action to handle specific user requests, like playing games or getting horoscopes, by mapping them to actions within your Action.\u003c/p\u003e\n"],["\u003cp\u003eYou can integrate built-in intents using Dialogflow (graphically) or the Actions SDK (through code) to specify how your Action responds to these intents.\u003c/p\u003e\n"],["\u003cp\u003eBuilt-in intents often include parameters (like location or time) that you can access in your Action's code to provide a more tailored user experience.\u003c/p\u003e\n"],["\u003cp\u003eTo test your integration, use the Actions simulator or your device to trigger the intent and ensure your Action is invoked and handles the request appropriately.\u003c/p\u003e\n"],["\u003cp\u003eFor optimal user experience, directly address the user's request when a built-in intent triggers your Action and utilize any provided parameters to avoid unnecessary prompts.\u003c/p\u003e\n"]]],[],null,["# Built-in intents (Dialogflow)\n\nA *built-in intent* is a unique identifier that you can specify to tell the\nGoogle Assistant that your Action can fulfill a specific category of user\nrequests. For example, here are some examples of user queries that\nthe Assistant matches to built-in intents:\n\n- **\"Play game\" built-in intent** : *\"Ok Google. Play a memory game\"*\n- **\"Get horoscope\" built-in intent** : *\"Ok Google. Get my horoscope\"*\n\n| **Note:** The 'Play Game' intent is the only built-in intent that is generally available at this time. Other built-in intents mentioned in this documentation are currently in developer preview. You can build and publish Actions that use this feature, but we are still working on fine tuning discovery and ranking.\n|\n| For built-in intents in developer preview, there is no user triggering initially and some\n| intents will not trigger at all. For the time being, you should continue creating\n| [implicit invocations](/assistant/conversational/df-asdk/discovery/implicit) and testing them in addition to\n| registering for built-in intents.\n\nDuring [Action discovery](/assistant/df-asdk/discovery/implicit#action_discovery), the Assistant can use\nmetadata about your Action, including the built-in intents you've specified,\nto recommend your Action to users. To minimize conversational round-trips,\nthe Assistant also attempts to scan parameters from the user queries\nand pass them on to your Action.\n\nTo see the full list of built-in intents that the Assistant supports,\nincluding their parameters and example user queries, see the\n[Built-in intents reference](/assistant/df-asdk/reference/built-in-intents).\n\nIntegrate built-in intents\n--------------------------\n\nDepending on how you are building your Action, there are different ways to\nintegrate built-in intents.\n\n### Dialogflow\n\nIf you are using Dialogflow to create your Action, you can attach a built-in intent\ngraphically from the [Dialogflow console](//console.dialogflow.com).\n\nTo attach a built-in intent with Dialogflow, follow these steps:\n\n1. Open the [Dialogflow console](//console.dialogflow.com), select your agent, then navigate to the **Intents** screen.\n2. Create or select the intent that your agent triggers when it receives a\n specific built-in intent. Open the **Events** section, and click **Add\n Event**.\n\n **Figure 1.** Adding a Dialogflow event in the Dialogflow console.\n3. In the **Events** field, type in the name of a built-in intent event for your\n agent (for example, `actions_intent_PLAY_GAME`).\n\n **Figure 2.** Attaching a built-in intent to your agent in the Dialogflow console.\n4. Click **Save**.\n\n### Actions SDK\n\nIf you are using the Actions SDK to build your Action, you must specify the\nmapping between built-in intents and the Actions in your Action package.\n\nTo attach a built-in intent with Actions SDK, follow these steps:\n\n1. Specify the built-in intent in the name field in your [Action](/assistant/conversational/reference/rest/Shared.Types/Action) definition.\n2. Upload your action package to your Actions project using the `gactions` tool, as described in [Actions SDK overview](/assistant/df-asdk/actions-sdk).\n\nFor example, the following snippet shows how you can add the `CHECK_AIR_QUALITY`\nbuilt-in intent: \n\n {\n \"actions\":[\n {\n \"description\":\"Default Welcome Intent\",\n \"name\":\"MAIN\",\n \"fulfillment\":{\n \"conversationName\":\"conversation_1\"\n },\n \"intent\":{\n \"name\":\"actions.intent.MAIN\"\n }\n },\n {\n \"description\":\"Check Air Quality\",\n \"name\":\"CHECK_AIR_QUALITY\",\n \"fulfillment\":{\n \"conversationName\":\"conversation_1\"\n },\n \"intent\":{\n \"name\":\"actions.intent.CHECK_AIR_QUALITY\"\n }\n }\n ],\n \"conversations\":{\n \"conversation_1\":{\n \"name\":\"conversation_1\",\n \"url\":\"https://example.com/fulfillment\",\n \"fulfillmentApiVersion\":2\n }\n }\n }\n\nHandle built-in intent parameters\n---------------------------------\n\nWhen your Action is invoked through a built-in intent, your fulfillment might\nreceive additional parameters. The intent schema defines the names of the\nparameters and their types as primitive types or [schema.org](//schema.org/)\nentities. To view the schema for Conversational Action built-in intents, see the\n[Built-in intents reference](/assistant/df-asdk/reference/built-in-intents).\n\nParameters for built-in intents are optional. The Assistant handles filling the\nparameters with values if they can be extracted from the user's invocation of\nthe built-in intent.\n\nFor example, the schema of the `actions.intent.CHECK_AIR_QUALITY` built-in\nintent defines four optional parameters:\n\n| Parameter Name | Type |\n|--------------------|--------------------------------------------------------|\n| `attributes` | A string value. |\n| `location` | A [schema.org/Place](//schema.org/Place) object. |\n| `temporalCoverage` | A [schema.org/Duration](//schema.org/Duration) object. |\n| `timeIndicator` | An `EnumeratedDuration` (Google-specific extension). |\n\nThe following code snippet shows an example of the conversation webhook (JSON)\nrequest when a user invokes your Action by saying *\"What's the air quality in\nSan Francisco tomorrow?\"*: \n\n \"inputs\":[\n {\n \"intent\":\"actions.intent.CHECK_AIR_QUALITY\",\n \"rawInputs\":[\n {\n \"inputType\":\"VOICE\",\n \"query\":\"what is the air quality in san francisco tomorrow\"\n }\n ],\n \"arguments\":[\n {\n \"name\":\"location\",\n \"structuredValue\":{\n \"geo\":{\n \"longitude\":-122.41941550000001,\n \"latitude\":37.7749295\n },\n \"@context\":\"https://schema.org\",\n \"@type\":\"Place\",\n \"name\":\"san francisco\"\n }\n },\n {\n \"name\":\"temporalCoverage\",\n \"rawText\":\"2018-04-25\",\n \"textValue\":\"2018-04-25\"\n }\n ]\n }\n ]\n\nIn this example, the parameters take the following values:\n\n- The `location` parameter contains the [`schema.org/Place`](//schema.org/Place) value for \"San Francisco\".\n- The `temporalCoverage` parameter contains the [`schema.org/Duration`](//schema.org/Duration) value for tomorrow's date relative to the time of the invocation.\n- There are no values for the `attributes` and `timeIndicator` parameters because the user's invocation phrase did not include such information.\n\nIf you use the [Actions on Google Client Library for Node.js](/assistant/df-asdk/reference/nodejsv2/overview),\nyou can retrieve the value of the parameters as shown in the following snippet: \n\n app.intent('actions.intent.CHECK_AIR_QUALITY', (conv) =\u003e {\n const attributes = conv.arguments.get('attributes');\n const location = conv.arguments.get('location');\n const temporal_coverage = conv.arguments.get('temporalCoverage');\n Const time_indicator = conv.arguments.get('timeIndicator')\n\n // Your Action logic. If you need to use any of the parameter values,\n // you should check first that it is defined. Arguments.get returns\n // undefined if it can't find a value for a parameter.\n\n });\n\nTest integrations with built-in intents\n---------------------------------------\n\nFollow these steps to test your integration:\n\n1. Open the Actions simulator with your test Action enabled, or open the Assistant on your device.\n2. Speak or type a query associated with that built-in intent. For example, *\"I want to play a game.\"*\n3. From the displayed app selection dialog, find your Action.\n4. Select your app to send an intent to your app.\n\n|------------------------------------------------------------------------------------|-----------------------------------------------------------------|\n| **Figure 3.** The Action selection dialog resulting from a built-in intent phrase. | **Figure 4.** Invoking an Action attached to a built-in intent. |\n\nBest practices for using built-in intents\n-----------------------------------------\n\nYou should follow these best practices when using built-in intents:\n\n- **Map built-in intents to specific actions** : When a specific built-in intent triggers your Action, send the user to the specific intent and functionality in your Action with as little friction as possible. For example, if your Action supports the `PLAY_GAME` built-in intent and receives that intent, you should immediately send the user to the game feature of your Action. Avoid asking the user again if they want to play a game.\n- **Handle built-in intent parameters**: Make sure to use the built-in intent parameter values that the Assistant sends to your fulfillment. Avoid re-prompting the user for those values."]]