webhook 在 API.ai 中不工作

webhook not working in API.ai

我有以下 API.AI 的自定义 javascript 代码。我在 php 中实现了一个简单的 webhook 来接收特定操作的数据。每当我检查 API.AI 控制台时,它都工作正常。但是使用以下代码会出现 Webhook call failed. Error: Webhooks can be used with version '20150415' or greater. 错误。请帮忙。

         $.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);
                }
            });

正如 qnguyen 在评论中提到的那样,您的 url 中必须包含 ?v=20150910。例如:https://api.dialogflow.com/v1/query?v=20150910

有关详细信息,请参阅 https://dialogflow.com/docs/reference/agent/query