How to use Dialogflow CX API pass parameters to webhook?It seemed that detectIntent() set session queryParams does not work
According to the google dialogflow cx document: https://cloud.google.com/dialogflow/cx/docs/concept/parameter https://cloud.google.com/dialogflow/cx/docs/reference/rest/v3/QueryParameters
click to show the reference I know we can use api to set session parameters. So I want pass the parameters to webhook by API way.
Step 1:Front-end, use detectintent() API, fill the queryParams item. Step 2:Google dialogflow cx server will set parameters as the session parameter. Step 3:Webhook receive the google-side fucnction call.We can found all of the session parametersin from the http request.
As far as I am concerned, I can only receive the variables set in the DialogFlow Agent, but I have not received any information set through the API. I think I must have done something wrong, who can tell me how to? thanks.
My code as below(Nodejs code):
const sessionPath = client.projectLocationAgentSessionPath(
projectId,
location,
agentId,
sessionId
);
var mapParameters = new Map([['Michael', 95], ['Bob', 75], ['Tracy', 85]]);
const request = {
session: sessionPath,
"queryInput": {
"text": {
"text": query,
},
languageCode,
},
'queryParams': {
'timeZone': 'America/Los_Angeles',
'parameters': {
"fields":mapParameters
}
},
};
const [response] = await client.detectIntent(request);
from Recent Questions - Stack Overflow https://ift.tt/3dMi5iN
https://ift.tt/eA8V8J
Comments
Post a Comment