Api.ai请求主体不包含originalRequest对象,access_token可以从中发送到实现Webhook [英] Api.ai request body does not contain the originalRequest object from which the access_token can be sent to the fulfillment webhook

查看:133
本文介绍了Api.ai请求主体不包含originalRequest对象,access_token可以从中发送到实现Webhook的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Api.ai请求正文不包含originalRequest对象,从中可以将 access_token 发送到实现Webhook。有人可以让我知道为什么我没有看到originalRequest正文吗?

Api.ai request body does not contain the originalRequest object from which the access_token can be sent to the fulfillment webhook. Can anybody please let me know why I am not seeing the originalRequest body?

我已经为我的应用成功完成了帐户关联,实际上,操作网络模拟器确实显示了预期的调试窗口中的access_token ,但 Api.ai json请求正文没有拥有它。

I have successfully completed the Account Linking for my app and in fact, the actions web simulator does show the expected access_token in the debug window but the Api.ai json request body does not have it.

我正在使用python实现逻辑。在此方面的任何帮助将不胜感激。

I am using python for fulfillment logic. Any help on this is greatly appreciated.

如果有一些有关如何从api.ai json请求中获取access_token的文档或示例应用程序(特别是在python中),它将非常有帮助可以在webhook实现逻辑中使用。在我的特定情况下,我需要执行以下操作:

It would be very helpful, if there is some documentation or sample app (in python specifically) around how to grab the access_token from the api.ai json request so that it can be used in the webhook fulfillment logic. In my specific case, I need to do the below:


  1. 获取 access_token 来自api.ai请求(通过一堆文章/文档读取
    时,似乎只会在originalRequest json对象中看到
    ,而我在请求中未看到

  2. 在我的API调用的承载标头中使用 access_token

  1. Grab the access_token from the api.ai request (which upon reading through a bunch of articles/docs, it seems like it will only be seen in originalRequest json object which I am not seeing in my request at all)
  2. Use the access_token in the bearer header of my API calls

仅供参考,我正在Actions Web模拟器上对此进行测试,并且Web模拟器中的调试窗口显示访问令牌,告诉我帐户链接成功。我只需要知道如何从api.ai请求中获取该access_token。

FYI, I am testing this on actions web simulator and the debug window in web simulator shows the access token which tells me that account linking is successful. I only need to know how to get that access_token from the api.ai request.

推荐答案

查看Webhook获取的JSON内容的最简单方法是将其打印或记录在Webhook本身中。这应该作为请求对象中的主体出现。

The easiest way to see the contents of the JSON that your webhook is getting is to print or log it in the webhook itself. This should come in as the body in the request object.

这篇关于Api.ai请求主体不包含originalRequest对象,access_token可以从中发送到实现Webhook的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆