My current challenge involves enhancing the information sent in a JSON request from my application to DialogFlow
. While I am familiar with triggering events to send data calling an intent through the method described in Sending Parameters in a Query Request, I am now attempting to include a value for userID
and retrieve it within DialogFlow
.
To ensure continuity within the session, I am monitoring the user ID in PHP, which is used to extract the ID
value. In my attempts via the AJAX request, the following modifications were made:
$.ajax({
type: "POST",
url: baseUrl + "query?v=20150910",
contentType: "application/json; charset=utf-8",
dataType: "json",
headers: {
"Authorization": "Bearer " + accessToken
},
//The key modification is below:
data: JSON.stringify({
query: text,
lang: "en",
sessionId: "somerandomthing",
userId: "100"
}),
success: function(data) {
},
error: function() {
setResponse("Internal Server Error");
}
});
Additionally:
$.ajax({
type: "POST",
url: baseUrl + "query?v=20150910",
contentType: "application/json; charset=utf-8",
dataType: "json",
headers: {
"Authorization": "Bearer " + accessToken
},
//The key modification is below:
data: JSON.stringify({
query: text,
lang: "en",
sessionId: "somerandomthing",
userId: "100",
parameters: {
userId: "100"
}
}),
success: function(data) {
},
error: function() {
setResponse("Internal Server Error");
}
});
The inclusion of this value in the request is crucial for processing data on the back-end
accordingly. Any insights or alternative approaches would be greatly valued.
Although discussions on the DialogFlow Forums have touched on this topic, no definitive solution has been provided yet. It seems like either the feature is not currently available or lacks proper documentation. Refer to these forum threads for more details: Link 1, Link 2, Link 3.