I recently started using trains around Belfast. I was trying to use the app to figure out the times the trains where leaving the stations at. I found it clunky to use and hard to find the information that I wanted. I saw that Translink had an API for their train times and thought I would make an Alexa skill so that it is quick and easy to get the current train times. I think if the train times were quick and easy to get more people would use the trains in Northern Ireland, especially for commuting which in turn would lower traffic in the big towns and cities.

What it does

The Alexa skill can give you all the information that you need to know about the Translink train service in Northern Ireland and from Northern Ireland to Dublin. You can find out all the available train lines and all the stations on the train lines. You can get the times for the next trains coming to a particular station on all platforms. You can then find out where those trains stop after the station that you asked for. You get the times for the next few trains for a specific route. For example if you wanted to find out when the next train from Holywood to Bangor was, the skill will tell you when the next (up to) three trains are arriving at Holywood, what platform they are coming to and if they are on time, or the length of the delay. The skill also uses cards, so all of the important information is on a card which allows the user to ask Alexa for train times and run out the door to the train station and be able to look at the times in the Alexa app.

How I built it

The skill was built using an AWS Lambda function with NodeJS. The Translink API was used to get the information about the trains. link

Challenges I ran into

I ran into asynchronous issues with NodeJS. I'm not an experienced NodeJS developer and found it hard to "wait" on the HTTPS request and have it in a timely manner.

Accomplishments that I'm proud of

I'm proud that I now have a skill that is able to tell you accurate train times in a timely manner. I'm really happy with the screens that I created for the echo spot and echo show.

What I learned

I learnt how to use Promises in NodeJS to "wait" for the HTTPS request. I also learnt more about using the displays in the Alexa devices and the use of cards.

What's next for Translink train times in Ireland

It would be nice to extend the skill to include information like how much the train route that you just asked for would cost.

Built With

Share this project: