Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save business24ai/d543b5782a764c761dbd5d92a8517796 to your computer and use it in GitHub Desktop.
Save business24ai/d543b5782a764c761dbd5d92a8517796 to your computer and use it in GitHub Desktop.
Flowise get_the_current_weather_of_a_location
/*
* You can use any libraries imported in Flowise
* You can use properties specified in Output Schema as variables. Ex: Property = userid, Variable = $userid
* Must return a string value at the end of function
*/
const fetch = require('node-fetch');
const url = 'https://api.open-meteo.com/v1/forecast?latitude=' + $latitude + '&longitude=' + $longitude + '&current_weather=true';
const options = {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
};
try {
const response = await fetch(url, options);
const text = await response.text();
console.log('---< Weather function >---');
console.log(text);
return text;
} catch (error) {
console.error(error);
return '';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment