You can generate a URL that will link directly to the specific Action, on a per-Action basis. Users who click the Action link in a web or mobile browser will be directed to the Assistant on their device, where they'll interact directly with your corresponding Action.
Some examples of useful Action links include:
- Linking users to voice-guided instructions from a how-to website.
- Linking users to a customer support experience from a "get help" page.
- Linking users to an update intent so they can opt-in to your future updates.
To generate a URL for an Action, do the following:
- In the Actions Console, navigate to Develop > Actions.
- Click the Action you want to generate a link for.
- Under the Links section, enable Would you like to enable a URL for this Action.
- Enter a Link title. This title should include a verb that is descriptive of what the Action will do. For example, if your Action will take the user down a transaction flow to buy tickets to a concert, a useful link title would be "purchase concert tickets".
- Click Save.
You can copy the provided URL and reference it wherever you want to direct users to this specific Action.
Action link parameters
Action links can optionally contain an intent and parameters in the URL. Google handles the parameters according to the type of intent specified in the URL.
Action link URL specification
The general syntax for the URL of an Action link is as follows:
https://assistant.google.com/services/invoke[/$action_id][?intent=$intent¶m.$param=$value][&$utm_param=$utm_value]
The URL parameters you can set are described in the following table:
URL parameter | Description |
---|---|
$action_id |
Action's numeric identifier. |
$intent |
Full name of a built-in or custom intent. |
$param |
Full name of an intent parameter specified in the Action package. |
$value |
URL encoded value of the type declared for $param in the
Action package. |
$utm_param |
List of one or more UTM parameter types. Valid values include:
utm_source , utm_medium ,
utm_campaign , utm_term , and
utm_content . |
$utm_value |
String value of the UTM parameter. |
Action link URLs with built-in intents
If the Action link contains a
built-in intent (the intent starts with actions.intent.*
), Google will try to extract any built-in intent parameters in the URL and pass them on to your Action. Any parameters that Google does not understand as built-in intent parameters are stripped.
For conversational Actions, Google sends these parameters to your fulfillment as part of the AppRequest
message.
The following example shows how you might specify an Action link URL that includes a built-in intent with a single intent parameter:
https://assistant.google.com/services/invoke/uid/0000008ddd7eabec?intent=actions.intent.GET_HOROSCOPE¶m.astrologySign=%22cancer%22
Action link URLs with custom intents
For custom intents Google extracts only those parameters that are defined by your Action as part of the intent and discards any other parameters.
The following example shows how you might specify an Action link URL that includes a custom intent:
https://assistant.google.com/services/invoke/uid/0000001f575305a0?intent=NEWS_UPDATE_DEEP_LINK¶m.topic=sports
For the above example URL, in the AppRequest
, Google adds a JSON object as
follows:
argument {
name: ‘topic’,
raw_text: ‘sports’,
text_value: ‘sports’,
}
Action link URLs with no intents
If you don't specify an intent in the Action link, Google links to the MAIN
intent (actions.intent.MAIN
) of your Action by default with the following behavior:
- If you didn't explicitly enable the
MAIN
intent in the Action link, Google triggers the main intent without any parameters, similar to the behavior for "Talk to app_name". - If you explicitly enabled the
MAIN
intent, Google passes the parameters to your Actions.
The following example shows how you might specify an Action link URL with no intent:
https://assistant.google.com/services/invoke/uid/000000d139bbc4d4
Action link URLS with UTM parameters
UTM parameters are strings that Google sends to your Action when users click on an Action link, which you can later use for analytics.
The UTM parameters that Google sends to your Action includes the following:
utm_source
utm_medium
utm_campaign
utm_term
utm_content
The following example shows how you might specify an Action link URL that includes UTM parameters:
https://assistant.google.com/services/invoke/uid/000000d139bbc4d4?utm_source=Google&utm_medium=email&utm_campaign=holiday+sale
For the example URL above, Google adds the following arguments in the AppRequest
message:
argument {
name: ‘utm_source’,
raw_text: ‘Google’,
text_value: ‘Google’,
}
argument {
name: ‘utm_medium’,
raw_text: ‘email’,
text_value: ‘email’,
}
argument {
name: ‘utm_campaign’,
raw_text: ‘holiday sale’,
text_value: ‘holiday sale’,
}
Test Action links
You can test Action links for any intent (main or custom, with or without parameters) through the simulator or a device.
To test your Action link:
- Enable the Action link in the console.
- Sign into the Assistant with the same account you used to create your Actions on Google project.
- Create a clickable version of your Action link (in email, chat, doc, etc.).
- On an Assistant enabled device, click on the link created in the previous step.
Once you confirm the Action link functions as expected, you will need to re-deploy your Action to make the link available to your users.
Restrictions and best practices
Because your Action link URL can now be distributed and referenced outside of the directory or other Google services, please note that the following restrictions and best practices apply:
- Make sure you continue to support all of your Action links. If you distribute an Action link that later breaks, your Actions project may be flagged as unhealthy and taken down.
Publishing a link means you support triggering from untrusted sources. For any linked Actions, you must explicitly confirm with the user before taking any "real-world action". For example, an Action that turns off a smart home appliance should prompt the user saying "Are you sure you want to turn off
$applianceName
?"In this context, a "real world action" is any action affecting the user's services, data, devices, networks, computers, or APIs. For example, sending an email, performing a transaction, altering the status of a Smart Home appliance, creating a subscription, or updating a piece of content.