Note: This is not an officially supported FitBark skill.
Link to published skill on Amazon: https://www.amazon.com/gp/product/B01MXX19JL
Synopsis:Dog Whisperer leverages the power of the FitBark dog activity and sleep monitor to provide real time data about your dog! In order to use this skill you will need a FitBark device and account.
Dog Whisperer enables you to receive real-time sleep and activity information about your dog through seamless voice interaction. You can start a conversation with your dog by saying "Alexa, ask Dog Whisperer to talk to Max for me". Then you can interact with the skill by saying things like, "What did you do today?", "Did you reach your daily goal?". Or you can ask full intent questions like "Alexa, ask Dog Whisperer how much Max slept yesterday".
Ask Alexa how active your dog was today, how much they slept, or how long they were playing. Find out if your dog has reached their FitBark daily goal, what your dogs breed is, when their birthday is, how old they are, or what their FitBark collar battery level is.
Why:When I first saw the contest advertisement while scrolling through Facebook one day I knew I wanted to integrate this awesome new technology in a way that would benefit mans best friend. After realizing it was an API mashup contest, I immediately though of FitBark and the data it provides through its open API.
“A dog is the only thing on earth that loves you more than he loves himself.” — Josh Billings
Dogs were a constant in my life while growing up. There were times where I wasn't sure if our energetic border collie mix, Shawnee, was getting the level of rest or activity she needed to stay healthy. There was no accurate way of tracking if the runs in the morning with my dad, or the walks in the afternoon with my mom were enough to keep Shawnee active, healthy and happy.
With the combination of Alexa and FitBark this problem is now solved with a simple question, "Alexa, ask Dog Whisperer if Shawnee reached her daily goal". The FitBark daily goal is a "proprietary breed specific point system that measures physical activity in line with best veterinary practices in terms of 'activity counts' generated from 3D accelerometer readings" (https://www.fitbark.com/articles/what-are-barkpoints/ ). I believe this custom skill will give dog owners a simple interface to insight on their dog's overall health and activity.
Possible uses:
- Owners can have "conversations" with their dog to see if they are hitting their goals or getting adequate rest.
- Joint owners with different work schedules can ensure there dog is receiving the proper level of activity without leaving little sticky notes for their partner to read.
- Dog sitters can receive information about a dog without contacting the owner. Information such as the dogs breed, medical conditions, age, or if they are reaching their target activity goals.
Side Note: Since FitBark did not have a Node API client at the time of creating this skill I had to write one from scratch. Currently, it only supports the endpoints I needed to get this project completed.
1.) FitBark API Access
First, head on over to the awesome people at fitbark.com/dev and register for API access. In my case, for dev purposes, they also kindly supplied me with a fake user account, that generates fake data every hour.
Information you will need:
- client_id
- client_secret
- redirect_uri
2.) Create AWS Lambda Function and IAM
- Clone the https://github.com/marioharper/dog-whisperer.git repository.
- Ensure you have configured your AWS CLI credentials.
- Run `npm install`
- Run `./deploy.sh` from the root project folder. ( This will create your AWS Lambda function and IAM roles and privileges)
- You should now have a lambda in AWS under the us-east-1 region called :dog-whisperer_dogWhisperer
3.) Create Amazon Alexa Custom Skill
- Log into your developers.amazon.com account.
- Navigate to Alexa > Get Started (under Alexa Skills Kit) > Add a New Skill.
Skill Information:
- Fill out Name and Invocation Name.
Interaction Model:
- Copy over Intent Schema, the DOG_NAMES Custom Slot Type, and the Sample Utterances from the `speech-assets` folder in the GitHub repositoy.
Configuration:
- Service Endpoint Type: AWS Lambda
- Input your lambda functions ARN. Example: arn:aws:lambda:us-east-1:<aws_accunt_id>:function:dog-whisperer_dogWhisperer
- Enable Account Linking
- Authorization URL: https://app.fitbark.com/oauth/authorize
- Client Id: From step 1 above
- Take note of Redirect URLs
- Authorization Grant Type: Auth Code Grant
- Access Token URI: https://app.fitbark.com/oauth/token
- Client Secret: From step 1 above
- Privacy Policy URL: link to your privacy policy.
Continue to fill out Publishing Information and Privacy and Compliance information.
4.) Update FitBark API Redirection URLs
- Get client access token.
curl -X POST -H "Content-Type: application/json" -H "Cache-Control: no-cache" -d '{ "grant_type": "client_credentials", "client_id": "<from step 1 above>", "client_secret": "<from step 1 above>", "scope" :"fitbark_open_api_2745H78RVS" }' "https://app.fitbark.com/oauth/token"
- Using the Redirect URLs from step 3 Configuration section. Create a string that is the new redirect URI's and post them to the FitBark API. Multiple redirect URI's are separated by '\r'
curl -X POST -H "Authorization: Bearer <your access token from step 4.1>" -H "Content-Type: application/json" -d '{ "redirect_uri":"urn:ietf:wg:oauth:2.0:oob\rhttps://layla.amazon.com/api/skill/link/MBIMH03FQPUFO\rhttps://pitangui.amazon.com/api/skill/link/MBIMH03FQPUFO" }' "https://app.fitbark.com/api/v2/redirect_urls"
5.) Link your account with FitBark and Test!
- Using the Alexa app, enable the skill and login using your FitBark credentials.
- Now that your account is linked you can head back over to the Test section of your skill in developer.amazon.com
- Type example requests where it says "Enter Utterance".
- Your skill should return data about your dog!
Comments