在 Google 助手之外使用 Actions REST API?

Using the Actions REST API Outside of Google Assistant?

我们目前有一个 Google 操作要求用户登录我们的系统,我们的 OAuth 帐户链接流程成功地提供了一个访问令牌,用于通过我们的履行后端进行身份验证。当我们的 Action 在 Google Assistant 中进行查询时,这非常有效。

我们也有兴趣在我们的网络应用程序、我们的 iOS 应用程序和其他应用程序平台中使用 Google Actions REST API 和自己的自定义聊天机器人,但是当Google 操作 API 外部 Google 助理的请求,我们不断收到 401 身份验证错误响应。

是否可以在 Google 助手环境的 Google Actions REST API 之外使用?如果是这样,那么有人能告诉我们我们在 REST API 调用中遗漏了什么吗?

例如,基于 Google Actions REST API 文档 - https://developers.google.com/assistant/actions/api - 如果我们通过“Authorization: Bearer”包含我们的有效 OAuth 访问令牌 header 进行测试时 Google Actions REST API 通过命令行调用:

curl -X POST "https://actions.googleapis.com/v2/projects/[OUR PROJECT ID]:matchIntents" -H "Authorization: Bearer [OUR OAUTH ACCESS TOKEN]" -H "x-goog-user-project: [OUR PROJECT ID]" -H "User-Agent: [OUR APP PLATFORM/VERSION INFO]" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"query\": \"how much money do we owe\", \"locale\": \"en-US\"}"

无论我们如何调整 headers:

,我们总是会收到 401 错误响应
{
  "error": {
    "code": 401,
    "message": "Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
    "status": "UNAUTHENTICATED"
  }
}

我们已在网上广泛搜索任何疑难解答提示,但我们没有找到任何关于我们可能在此处做错的答案。我们的 API 调用 -OR- 是否遗漏了一些东西 Google Actions REST API 根本无法访问 outside[= Google助手环境的31=]?任何帮助将不胜感激。

Google/Actions Builder 平台上的 Actions 不适合在 Google Assistant 环境之外使用。如果您想要一种以编程方式匹配意图或调用 API 的方法,您应该使用 Dialogflow 及其 API。