Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by disabling your ad blocker.

BART Control Skill For Amazon’s Alexa Released

TwitterFacebookRedditLinkedInHacker News

I am pleased to announce that my first ever skill for Amazon Alexa powered devices has gone live in the Amazon Skill Marketplace. My skill, BART Control, accesses live information about the Bay Area Rapid Transit system in northern California.

If you’re unfamiliar with Amazon Alexa, it can be described as follows per Amazon:

Alexa, the voice service that powers Echo, provides capabilities, or skills, that enable customers to interact with devices in a more intuitive way using voice. Examples of these skills include the ability to play music, answer general questions, set an alarm or timer and more. Alexa is built in the cloud, so it is always getting smarter. The more customers use Alexa, the more she adapts to speech patterns, vocabulary, and personal preferences.

I personally own an Amazon Echo, but there is a wide variety of hardware that is compatible with Amazon’s voice service.

Now let me share some specifics about the skill that I developed and what I used to develop it.

The Bay Area Rapid Transit (BART) system exposes a public API with information about its trains and stations. I turned this API into something Alexa powered devices can understand. For example, take the following spoken command:

Alexa, ask BART Control when the next Walnut Creek train arrives

The above command will result in the Echo or similar telling when the next train arrives in any direction. This could be one train, or it can be multiple trains. This is useful to prevent you from waiting at a particular station for excessive amounts of time.

What if you’re a new BART rider and don’t know how much it costs to ride? You can ask Alexa the following:

Alexa, ask BART Control what the fare is from Fremont to SFO

The above command will result in the device telling how much a one way ticket costs between these two stations.

So what was necessary to create BART Control for Amazon Alexa?

I used one of Amazon’s Web Services (AWS) called Lambda which allowed me to create a scalable web application using one of a few popular programming languages. Of the language selection, I chose to use Node.js. There are a few moving parts when it comes to creating Alexa skills though. You have to plan for taking in requests, what to do with those requests, and how to respond based on those requests.

For example, take the following request against Alexa:

Alexa, ask BART Control if there are any advisories

This is the third possible request that I’ve mentioned. When developing these skills, we have to determine what request was asked. For the purpose of this skill, once we know the request, we can access the BART API to give us information based on the request. With that information we then need to format it in such a way that Amazon can speak it back to the user.

A full list of possible phrases are as follows:

Alexa, ask BART Control when the next {Source_Station} train arrives

Alexa, ask BART Control what the fare is from {Source_Station} to {Destination_Station}

Alexa, ask BART Control how much is parking at {Source_Station}

Alexa, ask BART Control how many trains are in operation

Alexa, ask BART Control if there are any advisories

Alexa, ask BART Control what is the elevator status

Just replace what is in the brackets with the appropriate station. If you ever forget the available options, you can always say:

Alexa, ask BART Control for help

At this point, you’ll receive a list of available phrases that you can say.


My first ever Amazon skill, BART Control, has been released to help people on their daily Bay Area Rapid Transit commute. While this was meant to be an announcement, I do plan to write a few tutorials on how to develop your own skills that will be compatible with Echo devices or similar. Skills can be written in a variety of programming languages and reach a variety of audiences. They are the ultimate cool project to work on and could provide a lot of value to general users.

If you own an Echo, please enable the skill and give it a five (5) star review. It won’t cost you anything as it is a free skill.

Nic Raboy

Nic Raboy

Nic Raboy is an advocate of modern web and mobile development technologies. He has experience in C#, JavaScript, Golang and a variety of frameworks such as Angular, NativeScript, and Unity. Nic writes about his development experiences related to making web and mobile development easier to understand.