Skip to content

Instantly share code, notes, and snippets.

@iworkforthem
Created November 15, 2018 13:22
Show Gist options
  • Save iworkforthem/b2c686c2bd7ca1caaa4f381c7b9931b4 to your computer and use it in GitHub Desktop.
Save iworkforthem/b2c686c2bd7ca1caaa4f381c7b9931b4 to your computer and use it in GitHub Desktop.
// call external API
await this.getWeather(turnContext);
// external API via axios
async getWeather(turnContext) {
const axios = require('axios');
try {
const response = await axios.get('https://api.data.gov.sg/v1/environment/psi');
console.log(response.data);
await turnContext.sendActivity('The weather is ' + response.data.api_info.status);
} catch (error) {
console.error(error);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment