Api.ai request body does not contain the originalRequest object from which the access_token can be sent to the fulfillment webhook

喜欢而已 提交于 2019-12-13 21:41:18

问题


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?

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.

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

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. 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

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.


回答1:


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.



来源:https://stackoverflow.com/questions/45177451/api-ai-request-body-does-not-contain-the-originalrequest-object-from-which-the-a

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!