简体   繁体   English

是否可以向谷歌家庭应用程序发送丰富的回复?

[英]Is it possible to send rich responses to google home app?

I developed a actions on google app which sends a rich response. 我在谷歌应用程序上开发了一个动作,它发送了丰富的响应。 Everything works fine in the Actions on Google simulator. 在Google模拟器上的动作中,一切正常。 Now I want to test it on my Google Home Mini but my rich responses are not told by the mini. 现在我想在我的Google Home Mini上测试它,但迷你没有告诉我丰富的回复。 I would like to ask if it is possible to send my rich response to the google home app? 我想问一下是否可以将我的丰富回复发送到谷歌家庭应用程序? The home mini says something like "Ok, I found these hotels, look at the home app" and there are the rich responses? 家庭迷你说“好吧,我发现这些酒店,看看家庭应用程序”,有丰富的回应?

You can't send users to the Home app , but you can direct them to the Assistant available through their phone. 您无法将用户发送到家庭应用程序 ,但您可以通过他们的手机将他们转到助手 The process is roughly: 这个过程大致是:

  1. At some point in the conversation (decide what is best for you, but when you have results that require display is usually good, or if the user says something like "Show me" or "Send this to my phone"), determine if they are on a device with a screen or not. 在对话的某个时刻(决定什么是最适合你的,但是当你有需要显示的结果通常是好的,或者如果用户说“显示我”或“将此发送到我的手机”),请确定他们是否是否有屏幕的设备。 You do this by using the app.getSurfaceCapabilities() method or by looking at the JSON in the originalRequest.data.surface.capabilities property. 您可以使用app.getSurfaceCapabilities()方法或通过查看originalRequest.data.surface.capabilities属性中的JSON来完成此操作。 If they're using a screen, you're all set. 如果他们正在使用屏幕,那么你已经完成了设置。 But if not... 但如果不是......

  2. Make sure they have a screen they can use. 确保他们一个可以使用的屏幕。 You'll do this by checking out the results from app.getAvailableSurfaces() or looking at the JSON in the (not fully documented) originalRequest.data.availableSurfaces array. 您可以通过从app.getAvailableSurfaces()查看结果或查看app.getAvailableSurfaces()originalRequest.data.availableSurfaces数组中的JSON来完成此操作。 If they don't have a screen, you'll need to figure out your best course of action. 如果他们没有屏幕,您需要找出最佳的行动方案。 But if they do have a screen surface (such as their phone, currently) available... 但如果他们确实有可用的屏幕表面(例如他们的手机)......

  3. You can request to transfer them to the new surface using the app.askForNewSurface() method, passing a message explaining why you want to do the switch, a message that will appear as a notification on the device, and what surface you need (the screen). 您可以使用app.askForNewSurface()方法请求将它们传输到新表面,传递一条消息,说明您要进行切换的原因,一条消息将在设备上显示为通知,以及您需要的表面(屏幕)。

  4. If the user approves, they'll get the notification on their mobile device (using that device's normal notification system). 如果用户批准,他们将在其移动设备上收到通知(使用该设备的正常通知系统)。 When they select the notification, the Assistant will open up and will send your Action an Event called actions_intent_NEW_SURFACE . 当他们选择通知时, actions_intent_NEW_SURFACE助理将打开并发送一个名为actions_intent_NEW_SURFACE动作事件。 You'll need to create an Intent that handles this Event and forwards it to your webhook. 您需要创建一个处理此事件的Intent并将其转发到您的webhook。

  5. Your webhook should confirm that it is on a useful surface, and then proceed with the conversation and send the results. 您的webhook应确认它位于有用的表面上,然后继续进行对话并发送结果。

You can see more about handling different surfaces at https://developers.google.com/actions/assistant/surface-capabilities 您可以在https://developers.google.com/actions/assistant/surface-capabilities查看有关处理不同表面的更多信息

Rich responses can appear on screen-only or audio and screen experiences. 丰富的响应可以出现在仅限屏幕或音频和屏幕体验上。 They can contain the following components: 它们可以包含以下组件:

  • One or two simple responses (chat bubbles) 一两个简单的回答(聊天气泡)
  • An optional basic card 可选的基本卡
  • Optional suggestion chips 可选的建议芯片
  • An optional link-out chip 可选的链接输出芯片
  • An option interface (list or carousel) 选项界面(列表或轮播)

So you need to make sure that the text response is containing all the details for cases like voice only (eg Google home/mini/max). 因此,您需要确保文本响应包含仅限语音(例如Google home / mini / max)等案例的所有详细信息。

However, if your users are using the assistant from a device with a screen, you can offer them a better experience with the rich responses (eg suggestion chips, links etc'). 但是,如果您的用户使用带有屏幕的设备上的助手,您可以通过丰富的响应(例如建议芯片,链接等)为他们提供更好的体验。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM