How to make a Snips skill – Part 1 – Overview

24. December 2018 19:00
3 min reading
This post thumbnail

Today I will try to make a new skill for the Snips Platform. The skill should be able to answer questions about the timetable of trains, buses and trams within the Swiss Public Transport system. This blog post is written while I'm about to develop the skill. There might be some loops if there are some mistakes on the way to the goal. So bear with me if there is not a straight forward approach to the final application. While writing I also just found out it would be best to split the post into several parts. What you are reading right now is the overview of my approach to the challenge.

Table of Content

  1. Overview
  2. Intents – how to get data for slots and intents
  3. All about API – get the needed public transport data
  4. Data to spoken text – what about Multilanguage
  5. Develop the actions – tell Snips what to do
  6. Put everything together – publish and debug the App and Actions

Where do we start?

Every skill has 4 main components:

  • we need some intentions we can react upon
  • the intentions are chosen depending on the questions we ask, so we need appropriate questions
  • we need any means to find answers to the questions we asked, typically this is some API we can get data from
  • and finally we need some logic to answer the question trough the TTS component of Snips

Questions first

Let's try to put together some questions we might ask our skill to get train information. Further, let's assume our Snips skill knows where we live and which train station is closest (we will implement this later as a configuration option)


Since I'm German speaking I will also put the German questions here, but we start in English first to see where we get. Also we start with a small set of questions, later on we still can extend the way we might ask Snips:

  • when is the next train to Bern?
  • what time does the next train to Bern leave?
  • what are the next bus connections?
  • when is the next train leaving from Bern to Zurich

and the same questions in German:

  • Wann fährt der nächste Zug nach Bern?
  • Zu welcher Zeit fährt der nächste Zug nach Bern
  • Welches sind die nächsten Zug Verbindungen?
  • Wann fährt der nächste Zug von Bern nach Zürich?

I highlighted some items in the questions. These seem to be candidates to treat as slots in our Intent Training set. Furthermore we see that we always ask for the next train or bus. This might be something we can improve later on to ask for trains going at a particular time.


Looking at the questions we find 3 groups of answers we are looking for:

  1. we want to know the next train from our home station to a specific location
  2. we want to know the next few connections from our home station, no matter to what destination
  3. we want to know the next connection for a specific from to location

With this knowledge I decided for the following intents:

train_schedule_totransport typedestination-
station_timetabletransport type--
train_schedule_from_totransport typeorigindestination


There is a open data API to get connections from the Swiss Public Transport System. Actually there are two open data platforms and the data portal of SBB itself:

Open-Data-Platform öV Schweiz

This platform is operated by a private company assigned from Swiss Railway - SBB. There is an API to gather the information we want, however we need to get a API Key to be able to use the data. There is a rate limit of 50 calls per minute and 20'000 requests per day, this should be enough for our personal use. Data is sent back as XML - hmm this could be a show stopper for me. I love Rest API's with JSON as a result.

Swiss public transport API

The other platform seems more open, returns data in JSON. We don't need an API Key to get some results. The rate limit is described as: 1000 per day. Should also be enough once we finished developing the skill

SBB Open Data

On this platform we are able to get 57 different records from data concerning the swiss public transport system. We might gather a list of railway stations to feed our intents as slot for origin and destination.

Answers trough Snips TTS

This will gonna be the easiest part (I hope) we just need to get the results from the API and convert them into readable/speakable sentences and let the Snips TTS engine do the rest. Here are some examples of answers we would like to get:

  • the next train to Bern will leave at 17:04
  • the next connections from your base station are: 17:05 towards Bern, 17:07 towards Thun and 17:12 towards Belp
  • the next train from Bern to Zurich leaves at 17:32

That's enough for the overview of the project. In the next part we will look at Intents and how to get data for slots and phrases to train our NLU engine to understand what we are looking for.