# Define Actions (Dialogflow)

To define Actions in Dialogflow, you create intents in your Dialogflow agent and
assign them as entry points into your Action. You can create the following types
of Actions:

- **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
  Google. Talk to Facts about Google"* or *"Ok, Google. Let me talk to Facts
  about Google"*).
- **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
  facts"*).

See [Intents and invocation](https://developers.google.com/assistant/df-asdk/discovery) for more information on how
these invocation models work.

## Define a default Action

> [!IMPORTANT]
> **Dialogflow Tip**
>
> Because Dialogflow supports many products, there are
> welcome event triggers for specific platforms, such as
> **GOOGLE_ASSISTANT_WELCOME** for Actions. The generic
> **WELCOME** event lets you handle invocations across many platforms if you
> deploy the agent on multiple platforms.

Every Dialogflow agent must have one and only one intent that handles
the **GOOGLE_ASSISTANT_WELCOME** event. This intent is triggered
when users invoke your Action by its name (for example, *"Ok Google, talk to
Facts about Google"*).

You can define the **GOOGLE_ASSISTANT_WELCOME** event in
the following ways:

**From the intent editor on the Dialogflow console:**

1. Click **Intents** in the navigation menu.
2. Select the intent that you want to set as the welcome event.
3. In the **Events** section of the intent, enter `GOOGLE_ASSISTANT_WELCOME`.
4. Click **Save**.

   ![](https://developers.google.com/assistant/df-asdk/dialogflow/images/dialogflow-define-actions-01.png)

   **Figure 1**. A screenshot of the Events section of a Dialogflow intent.

**From the Google Assistant integration modal window:**

1. Click **Integrations** in the navigation menu and click **Google Assistant**.
2. Click **X** to remove the current item in the **Explicit invocation** field.
3. In the **Welcome intent** box, select the intent that you want to set as the
   welcome event.

   ![](https://developers.google.com/assistant/df-asdk/dialogflow/images/dialogflow-define-actions-02.png)

   **Figure 2**. A screenshot of the Google Assistant integration modal window
   on the Dialogflow console.

When you view the intent's **Events** section, you should see that the intent
now has the **GOOGLE_ASSISTANT_WELCOME** event set (see **Figure 1**).

### Enable fulfillment

By default, a Dialogflow intent returns a static response, which is specified
in **Response** section of the intent. This setting might be enough for simple
Actions that only need to respond with the same message when invoked. However,
if you want the intent to return a dynamic response, you need to provide
fulfillment that can process complex logic and compose a response in real time
for the intent.

To enable fulfillment for an intent, do the following:

1. Scroll to the bottom of the intent editor of an intent.
2. Click **Fulfillment** and select **Enable webhook call for this intent**.

   ![](https://developers.google.com/assistant/df-asdk/dialogflow/images/dialogflow-define-actions-03.png)

   **Figure 3**. A screenshot of the Fulfillment section of a Dialogflow intent.

See [Build fulfillment](https://developers.google.com/assistant/df-asdk/dialogflow/fulfillment) for information on how to handle this
intent when it's triggered.

## Define additional Actions

You can provide additional Actions that act as entry points into your
conversation. This setup allows users to specify more details about what they
want to do (for example, *"Talk to Facts about Google to find me history
facts"*).

To define additional Actions in Dialogflow, follow these steps:

1. Create an intent for a specific Action that you want to build.
2. In the intent's **Training phrases** section, specify the patterns that
   trigger this Action. For example, if you want the Action to be invoked by the
   phrase *"Talk to Facts about Google to find me history facts"* , provide the
   following *Training phrases*:

   - *"Find me history facts"*
   - *"Look up history facts"*
   - *"Get me facts about history of the company"*
   - *"Read me some headquarters facts"*
   - *"Tell me a few facts about its headquarters"*

   We recommend at least 10 training phrases per intent.
3. To enable fulfillment for the intent, scroll to the bottom of the screen,
   click **Fulfillment** , and select **Enable webhook call for this intent** .
   (See [Build fulfillment](https://developers.google.com/assistant/df-asdk/dialogflow/fulfillment) for more details on
   fulfillment.)

4. Click **Save**.

5. Click **Integrations** in the navigation menu and click **Google Assistant**.
   (the Google Assistant modal window appears.)

6. In the **Implicit invocation** section, add the intent.

   ![](https://developers.google.com/assistant/df-asdk/dialogflow/images/dialogflow-define-actions-04.png)

   **Figure 4**. A screenshot of the Implicit invocation section on the Google
   Assistant integration modal window.

When defining Actions, the following restrictions and guidelines apply:

- Don't include the *reserved words* in invocation phrases.
  - For example, don't start your invocation phrases with *"talk to"* or "let me talk to".
- Don't specify training phrases that contain only a `@sys.any` entity.
  - Be much more specific; for example, `find recipes for @sys.any`.

## Handling an unrecognized Action

When users attempt to invoke an Action that your Actions don't recognize,
Dialogflow can trigger an intent to handle these cases.

> [!WARNING]
> **Warning:** You should avoid globally overriding Assistant's [default no-match behavior](https://developers.google.com/assistant/df-asdk/dialogflow/define-actions#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](https://developers.google.com/assistant/df-asdk/dialogflow/fulfillment#no-match_reprompting) to reprompt the user when your Action receives invalid input.

To enable this behavior,
create a new intent with an input context of `google_assistant_welcome` and
specify the appropriate responses to users:

1. In the navigation menu, click **Intents**.
2. Click **Create Intent** and name your intent.
3. 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).
4. Click **x** to remove that output context.

   ![](https://developers.google.com/assistant/df-asdk/dialogflow/images/dialogflow-define-actions-05.png)
5. In the **Training phrases** , add `banana` (or any other noun) as a user
   expression.

6. Double-click on **banana** and select `@sys.any`. (We use the `@sys.any`
   entity to tell Dialogflow to generalize the expression to any grammar, not
   just *banana*.)

   ![](https://developers.google.com/assistant/df-asdk/dialogflow/images/dialogflow-define-actions-06.png)
7. In the **Response** section, specify a responses using `$any`. For example,
   use the following response:

   - `I'm sorry, I don't know how to help with $any.`

   ![](https://developers.google.com/assistant/df-asdk/dialogflow/images/dialogflow-define-actions-07.png)
8. Click **Save**.

> [!NOTE]
> **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.