Skip to content

daemonsy/nyc-subway

Repository files navigation

NYC Subway

CircleCI

NYC Subway is an Alexa Custom Skill that gives you an update on subway statuses.

This repository contains code for the skill's lambda handler.

What this does

This skill queries MTA's Status API (more like a XML feed -_-) and responds with speech output depending on the utterance.

Full update

"Alexa, ask NY subway for an update | Alexa, open NYC subway"

This hits fullStatusUpdate which returns statuses on all lines, grouped by the issue type. For example:

Alexa: The 123, ACE lines are undergoing service change. Good service on all other lines.

Checking a specific line

"Alexa, ask NY subway to check the NQR lines"

This hits statusOfLine which returns the status of the line group in question. It also adds a card with the issue details to your Alexa app.

Alexa: The NQR line is undergoing service change. I've added a card with the details on the Alexa app.

Development Workflow

  • TDD a feature
  • Let CircleCI run dem tests
  • Merge to master
  • It ships to AWS Lambda and publishes a version
  • Point the Production alias to the version

Dependencies

  • alexa-sdk for the handler. It's awesome, makes it really easy to write a skill handler.
  • Isomorphic Fetch
  • xml2js for parsing the MTA XML feed.
  • Lodash is still a good swiss army knife that makes JS more fun.

Testing

  • AVA allowed me to write/run tests in ES6 with just one package.
  • Lambda Tester is great for exercising the handlers and abstracting away ceremonies.
  • fetchMock for mocking fetches in tests

To run tests, use yarn test

Contributing

Feel free to implement any of the features on the roadmap. If you wish to do something outside it, feel free to start an issue to discuss it.

Implement, write tests and PR it. I've left the utterances and intents so anyone can reproduce the skill.

About

NYC Subway is an Alexa Custom Skill that gives you an update on subway statuses.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published