Board Game Answers is an Alexa Skill that answers common questions about the rules of board games. After too many arguments among my friends about how many cards to deal or when a game is over, I decided to try building a voice-operated solution to answer the questions we had. It is currently live on the Alexa Skills Store and available for use.
The skill code runs on AWS Lambda and is written in Python. In order to make the skill easily extendible, the questions, answers and response templates are separate from the code of the skill.
To test this skill, you will need an Alexa-enabled device like the Echo or Tap, or build your own Alexa device: https://github.com/amzn/alexa-avs-raspberry-pi. I managed to get the Alexa Java client running on my Macbook, and I used that to test as I developed.
Below are instructions for deploying this skill to your own Lambda function and Alexa account. Note: Lambda pricing includes 1 million free requests per month, so this should be 100% free to deploy and use.
Step 1: Fork/clone the alexa-boardgame-answers repository- If you have a Github account and plan on contributing to the project, fork it to your own account.
- Clone the repo using
git clone --recursive
https://github.com/btelle/alexa-boardgame-answers.git (or your forked copy)
- If you don't have a developer account, create one, then log in.
- Go to Alexa > Alexa Skills Kit > Add a New Skill
- Choose 'Custom Interaction Model' as the Skill Type.
- Choose a name.
- Choose an invocation name that conforms to the guidelines. I used "board games."
- Click 'Next' to continue to Interaction Model.
- Copy the contents of alexa/intents.txt from the git repo into the Intent Schema box.
- Add the Custom Slot Types contained in alexa/custom_slots by clicking 'Add Slot Type' and filling in the form. Type is the name of each slot file in all caps (i.e, BOARD_GAME_NAMES) and the values are the contents of each text file.
- Copy the contents of alexa/utterances.txt to the Sample Uttrerances box.
- Open a terminal and cd to your copy of alexa-boardgames-answers.
- cd to the lambda directory (
cd lambda
)
- run
python build_data_file.py
to create the data.json file.
- run
zip -r lambda.zip ./*
to create the zip file.
- Go to https://console.aws.amazon.com/, create an AWS account if you don't have one and log in.
- Click on 'Lambda.'
- Click on 'Get Started' or 'Create a Lambda Function.'
- We don't need a blueprint, click 'Skip.'
- Choose a name and description.
- Change the runtime to Python 2.7
- Choose Upload a ZIP file and choose the lambda.zip file you created in the previous step.
- Create a new Basic Execution Role by selecting 'Basic Execution Role' from the role drop down and clicking 'Allow.'
- The rest of the options can be left as their default values. Click 'Next' then 'Create Function.'
- Go to the Event Sources tab and Add an event source. Choose 'Alexa Skills Kit' for the source and create it.
- Copy your function's ARN for the next step
- Back on the Alexa Skills page, choose 'Lambda ARN' for the Endpoint type and paste your Lambda ARN in the text box.
- Board Game Answers doesn't allow account creation, so click 'No' and hit Next to continue.
You can choose to enable the skill you just created on your Amazon account to test it on an Alexa device, or start using it right away using the Service Simulator on the testing page. Typing a request into the Utterance box will show you the response your Lambda function generates. Try "What games do you know?"
As you may notice looking in the data directory of the git repo, there aren't a lot of games included in the skill right now. I open sourced Board Game Questions because I am not an expert on most board games and need help! The skill is easy to extend by adding game JSON files and rebuilding the data.json file. I am currently working on adding games to the skill for a new release soon, please feel free to add your own favorite games and submit a pull request!
Header photo credit Janet Galore: https://www.flickr.com/photos/janetgalore/4510874033
Comments