Welcome to Nick Ate, an Alexa skill that allows you to log your food consumption to Fitbit if you like or will begrudgingly accept being called Nick. Due to potential Lambda costs if this somehow became popular, I'm providing steps to recreate this skill in your own dev environment and enjoy being called Nick and logging your food from the comfort of your own home.
Enjoy a variety of conversation flows!
Smooth sailing
Nick: Alexa, open Nick Ate
Alexa: Welcome to Nick Ate! What did Nick Eat?
Nick: Nick ate a banana
Alexa: I found Banana, with a default serving size of 100 grams and 90 calories. Would you like me to log this item?
Nick: Yes
Alexa: Wicked! Logged that banana to Fitbit
Master of numbers
Nick: Alexa, open Nick Ate
Alexa: Welcome to Nick Ate! What did Nick Eat?
Nick: Nick ate a banana
Alexa: I found Banana, with a default serving size of 100 grams and 90 calories. Would you like me to log this item?
Nick: Update quantity to 2
Alexa: Wicked, logged 2.0 grams of Banana to Fitbit
Lying in wait
Nick: Alexa, open Nick Ate
Alexa: Welcome to Nick Ate! What did Nick Eat?
Nick: Nick ate a banana
Alexa: I found Banana, with a default serving size of 100 grams and 90 calories. Would you like me to log this item?
Nick: Next
Alexa: How about Banana, Raw, with a default serving size of 1 extra-small and 72 calories. Would you like me to log that instead?
Nick: Next
...
Before you begin, you'll need
- An AWS account
- An Amazon Developer account for creating Alexa skills
- A Fitbit developer account for creating a Fitbit app
- Log in to your Fitbit developer account at dev.fitbit.com
- Create a new Fitbit app and note down the client id and client secrets, generated for your Fitbit app, which will be required by the Lambda
- Use the client id and client secret along with the url provided to retrieve your first access and refresh tokens
- In the AWS Management Console, navigate to AWS Secrets Manager.
- Create new secrets for your Fitbit app.
- Store the FITBIT_CLIENT_ID, FITBIT_CLIENT_SECRET, FITBIT_REFRESH_TOKEN, and FITBIT_ACCESS_TOKEN secret values in AWS Secrets Manager.
- Clone down this repository
- Locally, pip install the requirements in requirements.txt
pip3 install -r requirements.txt -t . - Create the deployment package
zip -r deployment_package.zip .
- In the AWS Management Console, navigate to AWS Lambda.
- Create a new Lambda function.
- Upload the deployment package created in section 3
- Configure the Lambda function with appropriate permissions, such as Secrets Manager access and allow execution from Alexa.
-
Log in to your Amazon Developer account.
-
Create a new Alexa skill called Nick Ate
-
Set the invocation name to "nick ate" or "Nick eight"
-
Configure the skill's interaction model providing the following intent handlers
a. LogFoodIntent handler with a variable option for FoodItem and utterance examples like as "Nick ate {FoodItem}". Protip: Alexa mishears, so do both "ate" and "eight"
b. ConfirmFoodIntent with example utterances like "yes" and "confirm"
c. UpdateQuantityIntent with a variable of "quantity" and examples such as "Update quantity to {quantity}"
d. SwitchFoodIntent with utterances like "next" or "wrong"
-
Set up the skill's endpoint to point to the AWS Lambda function you created earlier.
-
Build your Alexa skill in development
-
Test your Alexa skill in the Alexa Developer Console to ensure it works correctly.
- Deploy your Alexa skill and Lambda function.
- If your dev account and Alexa device use the same account, you should be able to use the skill on your device.
So, what are you waiting for, deploy Nick Ate, log your food and enjoy your new name today.