问题
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:
- 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) - 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