Here we will describe how to get a weather forecast in response to the user's location:


Step 1. Choose the weather API service to get the weather from

In this example we'll use openweathermap.org. You'll need to create an account there to get the API key

Step 2. Add Location step which will ask for the current user's location

Step 3. Add Goto step, setting its value setting as {{forecast}} variable and using {{forecastStep}} variable in response:

Step 4. Enable developer mode

Step 5. Add variables:

  • location - type Step (select Step 1)
  • forecastStep - type Step (select Step 2)
  • forecast - type Script:
    • function(callback, variables) {
        // The `callback` argument has to be called with the result value in order to support the async operations. The `variables` argument is an object containing other variables
        var url = new quriobot.URL("https://api.openweathermap.org/data/2.5/weather", true)
        url.query.APPID = "YOUR-APPID"
        url.query.q = variables.location.text
        quriobot.ajax(url.toString(), function(responseText) {
          var response = JSON.parse(responseText);
            callback(response.weather && response.weather[0].description)
        })
      }

      where YOUR-APPID is your API key for  openweathermap


Step 6. Add Yes/No step if you want to loop the chat:


Live demo you can see here