A Fitbit Low Battery SMS Notification using AWS – Part 3

In Part 1, I introduced an app that sends an SMS notification when your Fitbit battery is low. Part 2 covered the Authentication Flow of the process. This post describes how the device status is checked and communicated to the user.

Fitbit-SMS-Sched2The flow is as follows:

  1. The CloudWatch Scheduler kicks off a Lambda job that pulls registered users from the DynamoDB table. This information is based to a SNS topic, which in turn…
  2. …kicks off the Lambda function that obtains the Fitbit device info. The Fitbit api is called, and the resulting message is processed by the Lambda function. The device information is stored in and retrieved from the DynamoDB table as needed for processing and history tracking.
  3. If the result was a success then the a message is sent to the SNS topic for the subscribed user – assuming that the battery status is low AND the user has not already been notified.
  4. If a “Token Expired” error is returned, then the Lambda function passes the required information to the Refresh User SNS topic. The Lambda function again calls a Fitbit API; this time to refresh the token.
  5. If the token is refreshed, then the information is saved to the DynamoDB table and passed to the Get Device Info Topic (starting the process all over again)
  6. If a failure occurs, then a message is sent to the user, directing them to re-authorize the application to access their Fitbit account.

Continue reading “A Fitbit Low Battery SMS Notification using AWS – Part 3”

My Favorite Albums: Songs In The Key Of Life

Songs_in_the_key_of_life[1]Last week, I ported over a 4-part series about Steve Wonder’s from my old blog. The posts were about his greatest recording period – the late 60’s and his 1970- 76 “Classic Period”1:

As I re-read the posts, I realized two things:

  1. I  never covered his “Commercial Period” (the 1980’s – where he was one of the most commercial artists of the decade).
  2. I talked about the albums from a technical viewpoint, but not from a personal point of view.

Maybe I’ll write about Stevie’s 1980’s output later on. Today, I’ll cover my favorite Stevie Wonder album; his magnum opus: Songs In The Key of Life. Continue reading “My Favorite Albums: Songs In The Key Of Life”

A Fitbit Low Battery SMS Notification using AWS – Part 2

In Part 1, I introduced an app that sends an SMS notification when your Fitbit battery is low. Part 2 covers the Authentication Flow of the process.

Fitbit-SMS-Auth

The flow is as follows:

  1. User accesses the sign-up page (and by default, provides authorization via Fitbit.com). The request is passed through an API Gateway to a Lambda function. The Lambda function calls a Fitbit api to authenticate the user.
  2. The Fitbit authentication returns to the Lambda code. From there: (3) the token is saved to a DynamoDB database, (4) a message is placed on a SNS topic, and (5) a success response is sent back to the webpage
  3. The user information (access_token, refresh_token, and mobile number) is saved to a DynamoDB table
  4. An SNe1079abb478cc4e04d13615bc10aa4ca[1]S topic receives the mobile number as a message
  5. A success message is sent back to the end user.
  6. The SNS topic (step 4) calls a second Lambda function.
  7. The Create_User_Topic lambda function creates a sns topic for the newly authenticated user.
  8. Once the topic is created, a notice is sent to the user’s mobile device – asking to confirm subscription.
  9. The user confirms the subscription.

Continue reading “A Fitbit Low Battery SMS Notification using AWS – Part 2”

A Fitbit Low Battery SMS Notification using AWS – Part 1

765a3f73cd8c5b0c0bc96bc3cd094740[1]

A few weeks ago, my Fitbit (one of my new favorite devices) died.

Not died, as in bricked; my battery died.

That was a bit surprising, as I am signed up for low battery notifications. Turns out, I did get a notice – in an email. Problem was, I wasn’t checking my email that day.1

fitbit_notificationThe next day, I went back to the Fitbit website to sign-up for SMS notifications; unfortunately, Fitbit doesn’t provide a low battery notification via SMS.

So, I built my own, using a handful of AWS services (Lambda, SNS, API Gateway, and DynamoDB) and exposed Fitbit APIs.

So far, it works well. After subscribing to the service, I got an introductory note telling my my battery status. A few hours later, I received a second notice – letting me know that my battery was low. Continue reading “A Fitbit Low Battery SMS Notification using AWS – Part 1”

My Favorite Animated Movie and TV Scenes: Part 2

Note: Part 1 of this post can be read here: http://darianbjohnson.com/2016/02/06/my-favorite-animated-movie-and-tv-scenes-part-1/

Snake Eyes’ Wordless Goodbye G.I. Joe: A Real American Hero (“The MASS Device”).

maxresdefault[1]Snake-Eyes – the coldest Joe ever. We never saw his face. He never said a word. He was a ninja. He had a wolf for a pet.

So this scene, where Snake-Eyes sacrifices himself to save the team, has to be high on the list.

The Joe team is trying to collect rare elements to build a M.A.S.S. Device (basically, a teleportation device). The team has to travel to a cave in the Arctic to obtain red crystals for the machine.1 The team is able to retrieve the crystals, but is ambushed by Cobra (they trigger a radioactive gas to fill the cave and poison the Joes). Snake-Eyes saves his teammates (and sacrifices himself) by triggering a shield to keep radioactive gas from the team. Unfortunately, he’s on the wrong side of the shield. Scarlett, knowing that Snake-Eyes is a goner, simply says goodbye by placing her palm on the glass2.

Continue reading “My Favorite Animated Movie and TV Scenes: Part 2”