title: Passing parameters to dialog flow via fulfillment text
body: <pre><code>'use strict';
  var http = require('http');
  var request = require('request');
  var body="";
  exports.weatherWebhook = (req, res) =&gt; {
      const host = 'http://api.openweathermap.org/';
      const wwoApiKey = '7ffbb59524a81a6ac42ac3e942f68c5d';
      var city = req.body.queryResult.parameters['geo-city'];
      callWeatherApi(city).then((output) =&gt; {
          //console.log(output);
              res.json({ 'fulfillmentText': output }); // Return the results of the weather API to Dialogflow
       }).catch(() =&gt; {
          //console.log('ERROR');
              res.json({ 'fulfillmentText':'hello'});
      });
  }
      function callWeatherApi (city) {
        return new Promise((resolve, reject) =&gt; {
          var path = 'data/2.5/weather?' +'APPID=' + wwoApiKey +
          '&amp;q=' + encodeURIComponent(city)+'&amp;units=imperial';
           request(host+path,function(error,res,body)
          {   
              /*var response = JSON.parse(body);
                  var forecast = response['main']['temp'];
                  var output='Current temperature is '+forecast;
                  resolve(output);*/
              }).on('data', (d) =&gt; { body += d; console.log(body); })
          .on('end', () =&gt; {
              var response = JSON.parse(body);
                  var forecast = response['main']['temp'];
                  var output='Current temperature is ${forecast}';
                  resolve('abc')})
          .on('error', (error) =&gt; {
                  console.log(`Error calling the weather API: ${error}`)
                  reject();
              });
  
  
    });
  }
  </code></pre>
  
  <p>The output is not getting passed into webhook ,only hello is getting printed on the dialogflow console.When i remove the exports.webhook function and just hard code the city,output is getting printed on the terminal.why tis happens?</p>