网络钩子在 API.ai 中不起作用



我有以下用于API的自定义JavaScript代码。.AI。我在 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在评论中提到的,你的网址中必须有?v=20150910。例如:https://api.dialogflow.com/v1/query?v=20150910

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

最新更新