Env : Using firebase cloud deployed google action. Action is using webhook to get results from functions. I am using Blaze plan so calling external URL should be legit. I am using dialogflow V2.
Part of my function's job is doing the following: I make an external API request using the following (Masked code detail):
var requestObj = require('request');
var options = {
url: 'my url',
headers: {
'User-Agent': 'request'
}
};
function callback(error, response, body) {
if (!error && response.statusCode == 200) {
var info = JSON.parse(body);
result = JSON.parse(body).element;
console.log('Title 0 ' + result);
}
}
requestObj(options, callback);
Once I have the result, I parse it and use it.
Following are my reference points that I tried from stack overflow solutions:
Would appreciate any help from the community.