无法从 Actions 发送 Webhook 请求
Can't send Webhook request from Actions
我在联系我的网络钩子时遇到问题,我尝试从内联脚本(在下方)更改为 WebHook 到我的服务器 api 并在网络服务器上使用直接 json 文件'需要身份验证,但我没有成功,这是我用来调用我的服务器的脚本:
https.get({
host: 'myurl.eu.ngrok.io',
path: 'apipath/function-called',
headers: {
'Authorization': 'mytoken',
},
}, function(response) {
let json = '';
response.on('data', function(chunk) {
console.log('received JSON response: ' + chunk);
json += chunk;
});
response.on('end', function() {
let jsonData = JSON.parse(json);
let stockPrice = jsonData.data[0].value;
console.log('the stock price received is:' + stockPrice);
let chat = 'The' + priceType + ' price for ' + companyName +
' on ' + date + ' was ' + stockPrice;
CloudFnResponse.send(buildChatResponse(chat));
});
});
当我在 Dialogflow 上测试 Intent 时,他们 return 给我一个 403,因为 API 需要身份验证,当我尝试从 Actions 中做同样的事情并使用 Oauth / 登录帐户时Google登录错误是这样的:
"responseMetadata": {
"status": {
"code": 14,
"message": "Webhook error (206)"
}
但是查看日志,我没有收到请求,查看来自云平台的异常,响应的服务器没有 headers 我的服务器使用,我没有使用 NGNIX
Received response from agent with body: HTTP/1.1 200 OK Server: nginx/1.13.6 Date: Wed, 10 Oct 2018 08:15:48 GMT Content-Type: application/json;charset=UTF-8 Content-Length: 534 X-Cloud-Trace-Context: 6441a38beda637638dfd2e6b1f3e9c8a/7766163845645599757;o=0 Google-Actions-API-Version: 2 Via: 1.1 google Alt-Svc: clear
{
"conversationToken": "[]",
"expectUserResponse": true,
"expectedInputs": [
{
"inputPrompt": {
"richInitialPrompt": {
"items": [
{
"simpleResponse": {
"textToSpeech": "text request"
}
}
]
}
},
"possibleIntents": [
{
"intent": "assistant.intent.action.TEXT"
}
],
"speechBiasingHints": [
"$measureUnit",
"$product"
]
}
],
"responseMetadata": {
"status": {
"code": 14,
"message": "Webhook error (206)"
},
"queryMatchInfo": {
"queryMatched": true,
"intent": "d060e25c-2e4e-4c7e-903b-5cb55c13a6f0",
"parameterNames": [
"product",
"quantity",
"measureUnit"
]
}
}
}
有人知道可能是什么问题吗?
问题好像是代理的2nd版本,Web hook错误应该是return页面的Error Code,但是没有。
我在联系我的网络钩子时遇到问题,我尝试从内联脚本(在下方)更改为 WebHook 到我的服务器 api 并在网络服务器上使用直接 json 文件'需要身份验证,但我没有成功,这是我用来调用我的服务器的脚本:
https.get({
host: 'myurl.eu.ngrok.io',
path: 'apipath/function-called',
headers: {
'Authorization': 'mytoken',
},
}, function(response) {
let json = '';
response.on('data', function(chunk) {
console.log('received JSON response: ' + chunk);
json += chunk;
});
response.on('end', function() {
let jsonData = JSON.parse(json);
let stockPrice = jsonData.data[0].value;
console.log('the stock price received is:' + stockPrice);
let chat = 'The' + priceType + ' price for ' + companyName +
' on ' + date + ' was ' + stockPrice;
CloudFnResponse.send(buildChatResponse(chat));
});
});
当我在 Dialogflow 上测试 Intent 时,他们 return 给我一个 403,因为 API 需要身份验证,当我尝试从 Actions 中做同样的事情并使用 Oauth / 登录帐户时Google登录错误是这样的:
"responseMetadata": {
"status": {
"code": 14,
"message": "Webhook error (206)"
}
但是查看日志,我没有收到请求,查看来自云平台的异常,响应的服务器没有 headers 我的服务器使用,我没有使用 NGNIX
Received response from agent with body: HTTP/1.1 200 OK Server: nginx/1.13.6 Date: Wed, 10 Oct 2018 08:15:48 GMT Content-Type: application/json;charset=UTF-8 Content-Length: 534 X-Cloud-Trace-Context: 6441a38beda637638dfd2e6b1f3e9c8a/7766163845645599757;o=0 Google-Actions-API-Version: 2 Via: 1.1 google Alt-Svc: clear
{
"conversationToken": "[]",
"expectUserResponse": true,
"expectedInputs": [
{
"inputPrompt": {
"richInitialPrompt": {
"items": [
{
"simpleResponse": {
"textToSpeech": "text request"
}
}
]
}
},
"possibleIntents": [
{
"intent": "assistant.intent.action.TEXT"
}
],
"speechBiasingHints": [
"$measureUnit",
"$product"
]
}
],
"responseMetadata": {
"status": {
"code": 14,
"message": "Webhook error (206)"
},
"queryMatchInfo": {
"queryMatched": true,
"intent": "d060e25c-2e4e-4c7e-903b-5cb55c13a6f0",
"parameterNames": [
"product",
"quantity",
"measureUnit"
]
}
}
}
有人知道可能是什么问题吗?
问题好像是代理的2nd版本,Web hook错误应该是return页面的Error Code,但是没有。