با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
برای تعریف Actions در Dialogflow، Intent ها را در عامل Dialogflow خود ایجاد می کنید و آنها را به عنوان نقاط ورودی به Action خود اختصاص می دهید. شما می توانید انواع زیر را ایجاد کنید:
اقدام پیشفرض : هر عامل Dialogflow باید یک و تنها یک Action داشته باشد که وقتی کاربران از نام اقدام شما را درخواست میکنند (به عنوان مثال، "Ok Google. Talk to Facts about Google" یا "Ok, Google. اجازه دهید با Facts about Google صحبت کنم. " ).
اهداف اضافی برای پیوند عمیق به مکالمه شما : این کنشها زمانی فعال میشوند که کاربران اقدام شما را با نام آن فراخوانی میکنند و یک عبارت فراخوانی را مشخص میکنند (بهعنوان مثال، «با حقایق درباره Google برای حقایق تاریخ صحبت کنید» ).
هر عامل Dialogflow باید یک و تنها یک هدف داشته باشد که رویداد GOOGLE_ASSISTANT_WELCOME را مدیریت کند. این هدف زمانی فعال میشود که کاربران اقدام شما را با نام آن فراخوانی کنند (به عنوان مثال، "Ok Google, talk to Facts about Google" ).
میتوانید رویداد GOOGLE_ASSISTANT_WELCOME را به روشهای زیر تعریف کنید:
از ویرایشگر قصد در کنسول Dialogflow:
روی Intents در منوی پیمایش کلیک کنید.
هدفی را که میخواهید به عنوان رویداد خوشآمدگویی تنظیم کنید، انتخاب کنید.
در بخش رویدادهای intent، GOOGLE_ASSISTANT_WELCOME وارد کنید.
روی ذخیره کلیک کنید.
شکل 1 . تصویری از بخش رویدادهای یک هدف Dialogflow.
از پنجره مدال ادغام دستیار Google:
روی Integrations در منوی پیمایش کلیک کنید و روی Google Assistant کلیک کنید.
روی X کلیک کنید تا مورد فعلی در قسمت فراخوان صریح حذف شود.
در کادر خوشآمدگویی ، هدفی را که میخواهید بهعنوان رویداد خوشآمدگویی تنظیم کنید، انتخاب کنید.
شکل 2 . تصویری از پنجره مدال ادغام دستیار Google در کنسول Dialogflow.
وقتی بخش رویدادهای intent را مشاهده میکنید، باید ببینید که intent اکنون دارای مجموعه رویداد GOOGLE_ASSISTANT_WELCOME است ( شکل 1 را ببینید).
اجرا را فعال کنید
به طور پیشفرض، یک هدف Dialogflow یک پاسخ ثابت را برمیگرداند که در بخش Response از intent مشخص شده است. این تنظیم ممکن است برای کنشهای سادهای که فقط باید در هنگام فراخوانی با همان پیام پاسخ دهند کافی باشد. با این حال، اگر میخواهید هدف یک پاسخ پویا را برگرداند، باید تحققی ارائه کنید که بتواند منطق پیچیده را پردازش کند و پاسخی را در زمان واقعی برای هدف ایجاد کند.
برای فعال کردن تحقق یک intent، موارد زیر را انجام دهید:
به پایین ویرایشگر قصد یک intent بروید.
روی Fulfillment کلیک کنید و Enable webhook call for this intent را انتخاب کنید.
شکل 3 . تصویری از بخش Fulfillment یک هدف Dialogflow.
برای اطلاعات در مورد نحوه رسیدگی به این هدف در هنگام راهاندازی، به تکمیل ساخت مراجعه کنید.
اقدامات اضافی را تعریف کنید
می توانید اقدامات اضافی را ارائه دهید که به عنوان نقطه ورود به مکالمه شما عمل می کند. این تنظیم به کاربران امکان میدهد جزئیات بیشتری را درباره کاری که میخواهند انجام دهند مشخص کنند (به عنوان مثال، «با حقایق درباره Google صحبت کنید تا حقایق تاریخچه من را پیدا کنید» ).
برای تعریف اقدامات اضافی در Dialogflow، مراحل زیر را دنبال کنید:
یک هدف برای یک Action خاص که می خواهید بسازید ایجاد کنید.
در قسمت عبارات آموزشی intent، الگوهایی را که این Action را فعال می کنند، مشخص کنید. برای مثال، اگر میخواهید Action با عبارت «Talk to Facts about Google to find me history facts» فراخوانی شود، عبارتهای آموزشی زیر را ارائه کنید:
"حقایق تاریخ را برای من پیدا کن"
"حقایق تاریخ را جستجو کنید"
"حقایقی در مورد تاریخچه شرکت به من بدهید"
"چند حقایق دفتر مرکزی را برای من بخوانید"
"چند واقعیت در مورد دفتر مرکزی آن به من بگویید"
ما حداقل 10 عبارت آموزشی را برای هر هدف توصیه می کنیم.
برای فعال کردن تحقق هدف، به پایین صفحه بروید، روی Fulfillment کلیک کنید و Enable webhook call for this intent را انتخاب کنید. (برای جزئیات بیشتر در مورد تکمیل به ساخت تکمیل مراجعه کنید.)
روی ذخیره کلیک کنید.
روی Integrations در منوی پیمایش کلیک کنید و روی Google Assistant کلیک کنید. (پنجره مدال دستیار Google ظاهر می شود.)
در بخش Invocation ضمنی ، intent را اضافه کنید.
شکل 4 . تصویری از بخش فراخوان ضمنی در پنجره مدال ادغام دستیار Google.
هنگام تعریف Actions، محدودیت ها و دستورالعمل های زیر اعمال می شود:
کلمات رزرو شده را در عبارات فراخوانی وارد نکنید.
به عنوان مثال، عبارات فراخوانی خود را با «صحبت کن» یا «بگذار صحبت کنم» شروع نکنید.
عبارات آموزشی که فقط حاوی یک موجودیت @sys.any هستند را مشخص نکنید.
خیلی دقیق تر باشید؛ به عنوان مثال، find recipes for @sys.any .
رسیدگی به یک اقدام ناشناخته
وقتی کاربران سعی میکنند یک Action را فراخوانی کنند که Actions شما آن را تشخیص نمیدهد، Dialogflow میتواند قصدی برای رسیدگی به این موارد ایجاد کند.
برای فعال کردن این رفتار، یک intent جدید با زمینه ورودی google_assistant_welcome ایجاد کنید و پاسخ های مناسب را به کاربران مشخص کنید:
در منوی پیمایش، روی Intents کلیک کنید.
روی Create Intent کلیک کنید و هدف خود را نام ببرید.
در بخش Contexts ، google_assistant_welcome به عنوان زمینه ورودی مشخص کنید و کلید enter را فشار دهید. (پس از وارد کردن زمینه ورودی، google_assistant_welcome به عنوان یک زمینه خروجی ظاهر می شود).
برای حذف آن زمینه خروجی ، x را کلیک کنید.
در عبارات آموزشی ، banana (یا هر اسم دیگری) را به عنوان عبارت کاربر اضافه کنید.
روی banana دوبار کلیک کنید و @sys.any را انتخاب کنید. (ما از موجودیت @sys.any استفاده می کنیم تا به Dialogflow بگوییم که عبارت را به هر گرامر تعمیم دهد، نه فقط banana .)
در بخش Response ، یک پاسخ را با استفاده از $any مشخص کنید. برای مثال از پاسخ زیر استفاده کنید:
تاریخ آخرین بهروزرسانی 2025-07-25 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-25 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eDialogflow Actions are entry points into your Google Action, defined by intents, with a mandatory default Action triggered when users invoke your Action by name.\u003c/p\u003e\n"],["\u003cp\u003eAdditional intents can be created to handle deep links, allowing users to specify invocation phrases for more detailed requests.\u003c/p\u003e\n"],["\u003cp\u003eFulfillment can be enabled for intents to provide dynamic responses based on complex logic and real-time processing.\u003c/p\u003e\n"],["\u003cp\u003eWhen unrecognized Actions are invoked, Dialogflow can trigger a specific intent to handle these scenarios, using input context and the \u003ccode\u003e@sys.any\u003c/code\u003e entity for generalization.\u003c/p\u003e\n"],["\u003cp\u003eIt is generally recommended to utilize fallback intents to reprompt users for invalid input instead of overriding Assistant's default no-match behavior.\u003c/p\u003e\n"]]],["Dialogflow Actions are defined by creating intents in a Dialogflow agent. A **Default Action**, triggered by the Action's name, is mandatory, utilizing the `GOOGLE_ASSISTANT_WELCOME` event. Additional Actions allow deeper linking with specific invocation phrases. To define these, create intents with relevant training phrases, enable webhook fulfillment for dynamic responses, and add them to the Google Assistant integration. Handling unrecognized actions involves creating an intent with `google_assistant_welcome` input context, using `@sys.any` for general expressions.\n"],null,["# Define Actions (Dialogflow)\n\nTo define Actions in Dialogflow, you create intents in your Dialogflow agent and\nassign them as entry points into your Action. You can create the following types\nof Actions:\n\n- **Default Action** : Every Dialogflow agent must have one and only one Action that's invoked when users ask for your Action by name (for example, *\"Ok\n Google. Talk to Facts about Google\"* or *\"Ok, Google. Let me talk to Facts\n about Google\"*).\n- **Additional intents to deep link into your conversation** : These Actions are triggered when users invoke your Action by its name **and** specify an invocation phrase (for example, *\"talk to Facts about Google for history\n facts\"*).\n\nSee [Intents and invocation](/assistant/df-asdk/discovery) for more information on how\nthese invocation models work.\n\nDefine a default Action\n-----------------------\n\n| **Dialogflow Tip**\n|\n| Because Dialogflow supports many products, there are\n| welcome event triggers for specific platforms, such as\n| **GOOGLE_ASSISTANT_WELCOME** for Actions. The generic\n| **WELCOME** event lets you handle invocations across many platforms if you\n| deploy the agent on multiple platforms.\n\nEvery Dialogflow agent must have one and only one intent that handles\nthe **GOOGLE_ASSISTANT_WELCOME** event. This intent is triggered\nwhen users invoke your Action by its name (for example, *\"Ok Google, talk to\nFacts about Google\"*).\n\nYou can define the **GOOGLE_ASSISTANT_WELCOME** event in\nthe following ways:\n\n**From the intent editor on the Dialogflow console:**\n\n1. Click **Intents** in the navigation menu.\n2. Select the intent that you want to set as the welcome event.\n3. In the **Events** section of the intent, enter `GOOGLE_ASSISTANT_WELCOME`.\n4. Click **Save**.\n\n **Figure 1**. A screenshot of the Events section of a Dialogflow intent.\n\n**From the Google Assistant integration modal window:**\n\n1. Click **Integrations** in the navigation menu and click **Google Assistant**.\n2. Click **X** to remove the current item in the **Explicit invocation** field.\n3. In the **Welcome intent** box, select the intent that you want to set as the\n welcome event.\n\n **Figure 2**. A screenshot of the Google Assistant integration modal window\n on the Dialogflow console.\n\nWhen you view the intent's **Events** section, you should see that the intent\nnow has the **GOOGLE_ASSISTANT_WELCOME** event set (see **Figure 1**).\n\n### Enable fulfillment\n\nBy default, a Dialogflow intent returns a static response, which is specified\nin **Response** section of the intent. This setting might be enough for simple\nActions that only need to respond with the same message when invoked. However,\nif you want the intent to return a dynamic response, you need to provide\nfulfillment that can process complex logic and compose a response in real time\nfor the intent.\n\nTo enable fulfillment for an intent, do the following:\n\n1. Scroll to the bottom of the intent editor of an intent.\n2. Click **Fulfillment** and select **Enable webhook call for this intent**.\n\n **Figure 3**. A screenshot of the Fulfillment section of a Dialogflow intent.\n\nSee [Build fulfillment](/assistant/df-asdk/dialogflow/fulfillment) for information on how to handle this\nintent when it's triggered.\n\nDefine additional Actions\n-------------------------\n\nYou can provide additional Actions that act as entry points into your\nconversation. This setup allows users to specify more details about what they\nwant to do (for example, *\"Talk to Facts about Google to find me history\nfacts\"*).\n\nTo define additional Actions in Dialogflow, follow these steps:\n\n1. Create an intent for a specific Action that you want to build.\n2. In the intent's **Training phrases** section, specify the patterns that\n trigger this Action. For example, if you want the Action to be invoked by the\n phrase *\"Talk to Facts about Google to find me history facts\"* , provide the\n following *Training phrases*:\n\n - *\"Find me history facts\"*\n - *\"Look up history facts\"*\n - *\"Get me facts about history of the company\"*\n - *\"Read me some headquarters facts\"*\n - *\"Tell me a few facts about its headquarters\"*\n\n We recommend at least 10 training phrases per intent.\n3. To enable fulfillment for the intent, scroll to the bottom of the screen,\n click **Fulfillment** , and select **Enable webhook call for this intent** .\n (See [Build fulfillment](/assistant/df-asdk/dialogflow/fulfillment) for more details on\n fulfillment.)\n\n4. Click **Save**.\n\n5. Click **Integrations** in the navigation menu and click **Google Assistant**.\n (the Google Assistant modal window appears.)\n\n6. In the **Implicit invocation** section, add the intent.\n\n **Figure 4**. A screenshot of the Implicit invocation section on the Google\n Assistant integration modal window.\n\nWhen defining Actions, the following restrictions and guidelines apply:\n\n- Don't include the *reserved words* in invocation phrases.\n - For example, don't start your invocation phrases with *\"talk to\"* or \"let me talk to\".\n- Don't specify training phrases that contain only a `@sys.any` entity.\n - Be much more specific; for example, `find recipes for @sys.any`.\n\nHandling an unrecognized Action\n-------------------------------\n\nWhen users attempt to invoke an Action that your Actions don't recognize,\nDialogflow can trigger an intent to handle these cases.\n| **Warning:** You should avoid globally overriding Assistant's [default no-match behavior](#no-match_yielding), as it may negatively impact the ability of users to move between Actions. Generally, your Action should *not* try to handle all no-match and no-input scenarios. We recommend using [fallback intents](/assistant/df-asdk/dialogflow/fulfillment#no-match_reprompting) to reprompt the user when your Action receives invalid input.\n\nTo enable this behavior,\ncreate a new intent with an input context of `google_assistant_welcome` and\nspecify the appropriate responses to users:\n\n1. In the navigation menu, click **Intents**.\n2. Click **Create Intent** and name your intent.\n3. In the **Contexts** section, Specify `google_assistant_welcome` as the input context and press enter key. (After entering the input context, `google_assistant_welcome` appears as an output context).\n4. Click **x** to remove that output context.\n\n5. In the **Training phrases** , add `banana` (or any other noun) as a user\n expression.\n\n6. Double-click on **banana** and select `@sys.any`. (We use the `@sys.any`\n entity to tell Dialogflow to generalize the expression to any grammar, not\n just *banana*.)\n\n7. In the **Response** section, specify a responses using `$any`. For example,\n use the following response:\n\n - `I'm sorry, I don't know how to help with $any.`\n\n8. Click **Save**.\n\n| **Note:** While you can use Dialogflow to return simple text responses as a fallback, you can turn on **Enable webhook call for this intent** and provide more advanced fulfillment in your webhook code."]]