This tutorial is for advanced users who understand the basics of making API requests, and are able to read API documentation. It outlines how to implement the new feature but doesn’t go into too much detail on how it actually works. Beginner users should see this article.

Storyline has just rolled out a new feature, allowing you to have variables in URLs. This opens up many possibilities, however, in this case, I’m going to be making use of a public API which allows you to get weather data of a specific location. Please note, this tutorial assumes you have a basic knowledge of API requests. If not, I recommend that you read this article first for reference.

Link to Project

API Documentation I Used


  1. You’ll need to go to the API you want to use and find out the API URL. As I want to get the weather for a location, I’m using the MetaWeather API. To get the weather, we first need the city ID ({{id}}/), so let’s work out how to get that.
  2. The API Documentation says that we can search for the city ID with the URL{{city}}, but how exactly do we edit the URL with the city name?
  3. If you visit the link to the project I created above, you’ll see in the welcome block I have {city} as a user reply. This means that when the user replies with a city name, for example, London, their reply will be saved as a variable.
  4. However, for Alexa to work out that you’ve said ‘London’, we need to declare a variable slot type. Go to the ‘variables’ tab of the project, and click ‘new variable’. Declare your variable in the relevant category – mine is ‘UK city’.
  5. So, in the next block, I’ve created two API requests.
    The first one has this URL inside:{{city}}. To use our user’s reply in the URL, we must use double brackets. This means that {{city}} will be replaced with what the user says, in this case, London ( If we visit that link, it takes us to a JSON page, and if you see ‘woeid’ you can see the five-digit city ID. We need this ID to use in our next API request, so we can save this ID as ‘id’ by using id=api_response.woeid.
  6. Our next API request puts the ID in the URL and retrieves the weather status.
    In our URL ({{id}}/), {{id}} will be replaced with the five digit ID we saved in our previous API request ( If you visit that link, you’ll see the weather data for the city we mentioned, London. I want ‘weather_state_name: *weather*’ to be Alexa’s reply, so I’ve formatted the API request to save weather_state_name, which, at the moment, is light rain.
  7. Finally, to repeat the information back to the user, we just have to have {{weather}} in an Alexa says step. You can test this in the Developer Console or on your Alexa-enabled device.
Categories: APIsBuild

1 Comment

Making API requests with variables in the URL: BEGINNERS – Voicebox · August 9, 2018 at 5:36 pm

[…] This tutorial is for beginners who have little experience with API requests, and may not be able to fully understand API documentation. It goes into detail on how to use variables and what the user says in the API request URL. Advanced users should see this article. […]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.