Google 助手与我的自定义应用程序集成?

Google Assistant integration with my custom app?

我正在学习 google 操作并制作了一个基本的,google-keep like 应用程序,它为登录用户记录笔记。它有一个移动客户端和一个 Firebase 服务器。我想知道是否可以让助手以这样一种方式进行交互,即可以在根本不打开移动客户端的情况下通过助手会话创建笔记。 例如:

User (on any screen): "hey google"
AI - "hi , how can i help?"
U - " place a note to call david in customNotter" ( suppose)
Ai - "am sorrry, customnotter  does not exist on your mobile , download it from playstore http"//www.link..." 
U - *downloads customNotter app , installs, logs himself in*
U - " place a note to call david in customNotter"
Ai - "Ok, your note is saved"
*saves note "call david" in customNotter (by somehow calling some code to interact with customNotter's server?)*

我可以想象一个 kotlin 代码可以包含在我的应用程序中,助手可以触发它可以简单地将注释添加到服务器,但无法想象助手如何使用用户的身份验证详细信息和注释数据触发该代码?


PS: 另外我想知道 google home 是否也可以集成到这样的应用程序中。如果不是,限制 google 主页不与我的服务器交互的关键因素是什么?假设我正在为 CustomNotter 构建一个完整的业务模型,其中有一个统一的服务器和许多客户端,例如 ios / android / web apps 。 google home 能否像另一个经过身份验证的客户端一样,直接与服务器交互?

最好的选择是在 Google 上使用 Actions 直接调用您的 Firebase 服务器并以这种方式更新数据库。 Android 应用程序的挂钩目前并不深入。 Android Actions 已公布,但目前不可用。

这样做的好处是,你的 Action 可以在 Android phone 以外的任何 Google 助理界面上运行,并且不需要用户安装你的应用。

由于您可以 运行 Actions on Google on Firebase Functions,因此很容易将其合并到您的 Firebase 数据库中。

你在这里做了几个假设,但在我做出不同的假设之前,我想澄清一些事情。你说 "it has a mobile client and a firebase server"。我假设 "firebase server" 是存储用户笔记的内容?

如果是这样,那么您实际上根本不需要在本地安装该应用程序,智能助理就可以使用它。您只需要确保您的移动应用程序和您的操作都具有相同的用户帐户引用,以便它们可以更新和读取数据库中的相同记录。这适用于智能助理可以 运行 操作的任何地方 - 在移动设备或扬声器上,例如 Google Home。

在这种情况下,您的对话可能如下所示:

User: Hey Google, ask Custom Notter to remind me to call David.
Assistant: Getting Custom Notter
[Earcon, indicating your Action is running]
Action: Hi there. I've added a note to call David.
[Earcon, indicating the Action is done]

这是一个非常简单的对话示例。其他对话流程可能还想表明用户是否尚未将此类应用连接到帐户,或者您可能需要提示他们获得使用其帐户的权限等。

您将需要编写服务器代码来处理处理 - 所有操作都与云端服务器上的 Webhook 运行ning 交互。您可以使用您喜欢的任何语言(包括 Kotlin)和您希望的任何服务来编写它 - 但是,如果您 运行 使用 Firebase Cloud Functions 或 Google 在 node.js 中提供库和其他支持在 Google 的云端。

所有详细信息可在 https://developers.google.com/actions/

获得

如果您有移动应用,并且想了解如何让 Google 助理启动该应用中的内容,您可以查看 App Actions,即将在 Android.