Created
November 15, 2018 13:22
-
-
Save iworkforthem/b2c686c2bd7ca1caaa4f381c7b9931b4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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