Reputation: 3702
I have the following custom javascript code for API.AI. I have implemented a simple webhook in php to receive data on certain action. Whenever I check in API.AI console it is working fine. But with the following code it gives Webhook call failed. Error: Webhooks can be used with version '20150415' or greater.
error. Please help.
$.ajax({
type: "POST",
url: baseUrl + "query",
contentType: "application/json; charset=utf-8",
dataType: "json",
headers: {
"Authorization": "Bearer " + accessToken
},
data: JSON.stringify({query: text, lang: "en", sessionId: "<?php echo uniqid();?>", v:"20170712"}),
success: function(data,url) {
console.log(url);
prepareResponse(data);
},
error: function(text) {
console.log(text);
respond(messageInternalError);
}
});
Upvotes: 1
Views: 642
Reputation: 3469
As qnguyen mention in a comment you must have ?v=20150910 in your url. For example: https://api.dialogflow.com/v1/query?v=20150910
See https://dialogflow.com/docs/reference/agent/query for more info
Upvotes: 2