我正在尝试执行API.AI教程,为Google智能助理构建一个天气机器人(这里有一个:https://dialogflow.com/docs/getting-started/basic-fulfillment-conversation )
我成功完成了一切,在API中创建了机器人,创建了Fulfillments,在我的电脑上安装了NodeJS,连接了Google Cloud Platform等.
然后我创建了index.js文件,通过使用来自World Weather Organization的API密钥(参见下文)将其完全复制到API.ai教程中.
但是当我使用机器人时,它不起作用.在Google Cloud Platform上,错误始终相同:
错误:getaddrinfo ENOTFOUND api.worldweatheronline.com api.worldweatheronline.com:80
Run Code Online (Sandbox Code Playgroud)at errnoException (dns.js:28) at GetAddrInfoReqWrap.onlookup (dns.js:76)
无论我多久都这样做,我得到同样的错误.所以我实际上并没有达到API.我试图看看是否有任何改变从WWO方面(URL等),但显然没有.我更新了NodeJS,但问题仍然存在.我完全刷新了Google云平台并没有帮助.
那一个我真的无法调试.有人可以帮忙吗?
这是API.ai的代码:
'use strict';
const http = require('http');
const host = 'api.worldweatheronline.com';
const wwoApiKey = '[YOUR_API_KEY]';
exports.weatherWebhook = (req, res) => {
// Get the city and date from the request
let city = req.body.result.parameters['geo-city']; // city is a required param
// Get the date for the weather forecast (if present)
let date = '';
if …Run Code Online (Sandbox Code Playgroud)