MUNI Alexa Skill
Add incoming MUNI predictions to Amazon Echo's Alexa using this small skill. It's not published in the skills directory but you can deploy it with your own settings using AWS Lambda function and let it run for free.
Currently the skill only supports one stop and you need to hardcode the SFMTA stop number in index.js
. Look up the nearest stop around your place using 511.
Adding a new developer skill
To get started, add a new Alexa Skill Set in Amazon Developer Console. Once you created a new app, give it the following settings:
Skill Information
- Application Id - Copy this to
index.js
- Skill type: Custom Interaction Model
- Name: Name of your choosing, e.g. "Arriving Muni"
- Invocation Name: Command that your Alexa listens, e.g. "arriving muni"
Interaction model
For Intent Scema, set:
{
"intents": [
{
"intent": "GetNextMuni"
}
]
}
As this script is only invoced using the invocation name, no Sample Utterances is really needed, but as the form requires a value:
GetNextMuni lol
Configuration
It's dead simple to deploy Alexa skills using AWS Lambda, so for Endpoint select Lambda ARN (Amazon Resource Name). Now, construct your Lambda function with node_modules
directory. This is required as Lambda is unable to pull NPM modules and they need to be bundled with the code. Please note that at this point you should have set applicationId
and muniStop
variables in the index.js
:
git clone https://github.com/jorilallo/muni-alexa-skill.git
cd muni-alexa-skill
npm install
zip -r lambda_function.zip *
After this you'll need to deploy lambda_function.zip
as a Lambda function:
- Login to AWS Console and visit Lambda settings
- Select Create Lambda Function
- Skip blueprint selection
- Set function name, e.g.
nextMuni
and select Node.js runtime - Upload as a Zip file (
lambda_function.zip
) to Lambda function - Use
index.handler
handler and select Basic Execution Role for Role - Create Lambda function. Click the "Event Sources" tab and select "Alexa Skills Kit"
- Finally, copy ARN from top right corner to your custom Alexa skill settings.
Once you have completed these steps, and pointed Alexa skill to the Lambda function, you should be able to test your skill with your "Alexa, ask arriving muni". While this isn't really natural, the list of invocation words is still somewhat limited.