Как вызвать внешний API в диалоговом потоке в редакторе строк? - PullRequest
0 голосов
/ 06 мая 2019

У меня проблема при вызове внешнего API в dialogflow, мне нужна помощь.

Вы найдете мой код ниже: index.js

Я получаю эту ошибку:

Ошибка: не удалось обработать запрос

const functions = require('firebase-functions');
    const {WebhookClient} = require('dialogflow-fulfillment');
    const {Card, Suggestion} = require('dialogflow-fulfillment');

    process.env.DEBUG = 'dialogflow:debug'; // enables lib debugging statements

    exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => {
      const agent = new WebhookClient({ request, response });
      console.log('Dialogflow Request headers: ' + JSON.stringify(request.headers));
      console.log('Dialogflow Request body: ' + JSON.stringify(request.body));


    function country(agent) {

        const request = require('request-promise-native');
        const url = "https://xxxxxxxxxx.hanatrial.ondemand.com/public/DBtest/xx.xsjs";
        agent.add(`Found a country:`);

          var options = {*strong text*
           uri: url,
           json: true };
      return request( options )
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...