Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/powerbi/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Dialogflow es 如何在dialogflow中使用内联编辑器触发POST请求?_Dialogflow Es_Actions On Google_Dialogflow Es Fulfillment_Fulfillment - Fatal编程技术网

Dialogflow es 如何在dialogflow中使用内联编辑器触发POST请求?

Dialogflow es 如何在dialogflow中使用内联编辑器触发POST请求?,dialogflow-es,actions-on-google,dialogflow-es-fulfillment,fulfillment,Dialogflow Es,Actions On Google,Dialogflow Es Fulfillment,Fulfillment,代码: var rp = require('request-promise'); var options = { method: 'POST', uri: 'http://c663fe13.ngrok.io/ap/lighton', body: {"color": 'white'}, json: true // Automatically stringifies the

代码:

var rp = require('request-promise');
var options = {
                method: 'POST',
                uri: 'http://c663fe13.ngrok.io/ap/lighton',
                body: {"color": 'white'},
                json: true // Automatically stringifies the body to JSON
            };

            rp(options)
                .then(function (parsedBody) {
                    // POST succeeded...+
                    console.log("parsedBody", parsedBody);
                })
                .catch(function (err) {
                    // POST failed...
                    console.log("err", err);
                });
但这给了我以下错误:

{RequestError:Error:getaddrinfo EAI_再次c663fe13.ngrok.io:80 在new RequestError(/srv/node_modules/request promise core/lib/errors.js:14:15) at Request.pipeoping.callback(/srv/node_modules/Request promise core/lib/pipeoping.js:87:29) at Request.RP$callback[as _callback](/srv/node_modules/Request promise core/lib/pipeoping.js:46:31)

名称:'RequestError',消息:'Error:getaddrinfo EAI_ c663fe13.ngrok.io:80',
原因:{错误:getaddrinfo EAI_ c663fe13.ngrok.io:80 在GetAddrInfoReqWrap.onlookup[as oncomplete](dns.js:67:26) 呃,不,‘又来了’, 代码:'EAI_再次', 系统调用:“getaddrinfo”, 主机名:“c663fe13.ngrok.io”, 主持人:“c663fe13.ngrok.io”, 端口:80}


我尝试用postman调用该API,它运行良好。

如果您使用的是免费帐户,您将无法从Firebase云函数中访问任何第三方服务。如果您要使用免费ac,最好写下自己的webhook代码并使用fulfillment将该webhook与Dialogflow代理集成伯爵

更新
查看我共享的代码片段。你可以使用它来集成ExpressJS,然后添加你的POST代码并在本地托管。使用ngrok公开本地服务器,然后将该URL付诸实现。

好的,对于解决方案,你有什么例子吗?我应该全部使用这3个东西还是只使用带有Dialogflow的ExpressJS就足够了?这取决于关于你的使用。如果在Google上使用Action,你将需要第二个。如果你是NodeJS的新手,那么请先阅读一些在线教程,以便更好地理解。是的,我在Google上使用Action。我尝试了内联实现,但正如你所知,由于一个免费帐户,它无法完成。感谢节点建议,但我已经完成了node非常好的工作ell bro.只是混淆了dialogflow和action-on-google.ngrok提供了https选项。我正在使用它