I've been able to fetch the data from the database, but then i'm trying to make use of it but it's not working,
var a = function() {
first
.find(
{ url: "https://guarded-everglades-31972.herokuapp.com/getCalls" },
{ url: 1 }
)
.then(url => {
if (!url) {
return console.log("url not found");
}
console.log("Todo by id", url);
})
.catch(e => console.log(e));
};
var accountSid = "…";
var authToken = "…";
var client = require("twilio")(accountSid, authToken);
client.calls.create(
{
url: a(),
to: "+2348033260017",
from: "+1 714 361 9371"
},
function(err, call) {
if (err) {
console.log(err);
} else {
console.log(call.sid);
}
}
);
I'm trying to use the fetched url from the function as the url for the twilio app, but it's telling me that i need to provide a url.