Skip to content

Alexa skill to discover when the next tram is due using the Traveline NextBuses API

Notifications You must be signed in to change notification settings

conradhodge/next-tram

Repository files navigation

Next tram

build Quality Gate Status Go Report Card

An Alexa skill to discover when the next tram is due using the Traveline NextBuses API and an AWS Lambda written in Go.

Setup

AWS Lambda

You will require an Amazon Web Services (AWS) account and credentials to use the Traveline NextBuses API.

Please ensure the following dependencies are installed:

Configure the AWS CLI in the WSL console.

Then run:

make install

To deploy the infrastructure to AWS run:

make deploy USERNAME=[] PASSWORD=[] AWS_ACCOUNT_ID=[] AWS_REGION=[] NAPTAN_CODE=[]

Where:

  • USERNAME - the username for the Traveline NextBuses API
  • PASSWORD - the password for the Traveline NextBuses API
  • AWS_ACCOUNT_ID - the AWS account ID to install the infrastructure
  • AWS_REGION - the AWS region to install the infrastructure
  • NAPTAN_CODE - the NaPTAN code of the tram stop for the next tram times

To run the Lambda locally using the AWS SAM:

make sam-synth-cdk USERNAME=[] PASSWORD=[] NAPTAN_CODE=[]
make sam-local

Alexa skill

You will require an Amazon developer account.

Login to the alexa develop console and create a new skill with the following configuration.

Create a new skill

  • Skill name: Next tram
  • Default language: English (UK)
  • Choose a model to add to your skill: Custom
  • Choose a method to host your skill's backend resources: Provision your own

Build

Choose: Start from scratch

Invocation

  • Skill Invocation Name: next tram

Intents

  • Name: when
  • Sample Utterance: When is my next tram due

Endpoint

  • Service Endpoint Type: AWS Lambda ARN
  • Default Region: Use the ARN output when the infrastructure stack is deployed

You will then need to build the model.

Test

Select the Test tab in teh alexa developer console.

  • Skill testing is enabled in: Development

Alexa Simulator: ask next tram when my next tram is due

And the magic should happen!

About

Alexa skill to discover when the next tram is due using the Traveline NextBuses API

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published