问题描述
我正在创建一个与Google Assistant集成的dialogflow代理。 我想做的是在匹配适当意图后打开一个应用程序(我的应用程序)。我已经看到像Youtube,Spotify等之类的动作可以做到这一点,例如,我可以告诉Youtube动作“搜索猫视频”,然后Youtube应用将打开并显示猫视频列表。 我尝试使用DeepLink类,但随后发现它已被弃用。 DeepLink class 有什么办法可以建议我这样做吗? 预先感谢
解决方法
我认为您正在寻找App Actions。这是您需要遵循的步骤:
-
找到正确的built-in intent。
actions.intent.OPEN_APP_FEATURE
应该是您的正确选择。 -
Create and update actions.xml。看起来应该像
<?xml version="1.0" encoding="UTF-8"?> <!-- This is a sample actions.xml --> <actions> <action intentName="actions.intent.OPEN_APP_FEATURE"> <!-- Use url from inventory match for deep link fulfillment --> <fulfillment urlTemplate="{@url}" /> <!-- Define parameters with inventories here --> <parameter name="feature"> <entity-set-reference entitySetId="featureParamEntitySet" /> </parameter> </action> <entity-set entitySetId="featureParamEntitySet"> <!-- Provide a URL per entity --> <entity url="myapp://deeplink/one" name="featureParam_one" alternateName="@array/featureParam_one_synonyms" /> <entity url="myapp://deeplink/two" name="featureParam_two" alternateName="@array/featureParam_two_synonyms" /> </entity-set> </actions>