Khalid Hoffman on Wake Up Call

Khalid HoffmanKhalid Hoffman received the Most Innovative Cisco Spark / Tropo Prize at TADHack Global Orlando in October 2016 for his hack Wake Up Call. In this weblog Khalid reviews his hack to provide more info on how it came about and how he built it. BTW we’ll be running a TADHack-mini Orlando in March, just before Enterprise Connect. Over to you Khalid…

A few months prior to TADHack, I had an idea to create an app that would call my phone as a wake-up call in the mornings rather than an alarm that seemed to only annoy me. The original goal was merely awakening, but such a phone call could serve many purposes.

I didn’t have an opportunity at the time to bring my idea into fruition, but I did not give up on it. I saved it in my Google keep and set a reminder for “someday”. A few weeks ago, that someday came. About a week before I was informed about TADHack, I received that reminder to create wake up call. It was perfect timing.

At first, the idea felt a bit trivial to me, but I truly believed that it was a great idea and should be completed. Thankfully, Tropo seemed to offer just what I needed. Their voice API served my purposes perfectly, and I honestly don’t think building a TTS (Text To Speech)-oriented service could have been any easier.

The Process

Overhead View

First, the app authenticates itself with Tropo. After authentication, the app operates accordingly with the help of Tropo’s API.

*WUC = Wake Up Call

  1. WUC requests authentication with Tropo’s TTS APP
  2. WUC waits for authorization, then builds and sends request to Tropo’s TTS API
  3. Tropo executes request (In this case, a phone call first)
  4. Tropo sends user’s response to WUC
  5. WUC responds to Tropo with the next requested action

Response Logic

The app is built on the idea of creating a map-like object which will serve as navigation for a conversation. Each property of the map object serves as a response and can generate a new series of actions by returning other map keys. The process from a code standpoint is as follows:

*WUC = Wake Up Call

  1. WUC accepts the user’s response and passes it to a callback function
  2. The designated callback function returns a key that maps to the next designated function (and also requests more user input in some instances)
  3. The newly designated callback function handles the user input and returns the next user response handler (or callback function)

This process can continue indefinitely via a conversation with the user.

The logic map is the only part that remains difficult to implement (and may always be), but using a plain old object for the map serves to ease integration with other technologies, while also keeping the current implementation simple and malleable.

Example Usage

Github: https://github.com/khalidhoffman/wake-up-call

var TropoDialer = require('./lib/tropo-dialer'),
    TropoSession = require('./lib/tropo-session'),


    testTropoDialer = new TropoDialer(),
    testTropoSession = new TropoSession('+15551230987', {
        // logic can be assigned here with a map like object
        start: {
            question:'Good morning. Are you awake?',
            options: "yes, no, tired",
            getNextAction: function (result) {
                switch (result.actions.value) {
                    // return values are used to execute the next action
                    case 'yes':
                        return false;
                    case 'tired':
                        return 'inspirational';
                    case 'no' :
                    default:
                        return 'notAwake';
                        break;
                }
            }
        },
        notAwake: {
            message: 'Then wake up!'
        },
        inspirational: {
            message: "Remember the early bird gets the worm"
        }
    });



testTropoDialer.pickup(function(){
    testTropoDialer.dial(testTropoSession, function(){
        console.log('session complete');
        testTropoDialer.hangup();
    })
});

In Conclusion

As I created this app I started to ponder upon abilities and untapped. Markets that I had not initially thought of, specifically that of older people who do not use technology as well as Millennials. Perhaps the engine behind wake-up call could become a natural bridge between the two generations. At the very least, it can serve as a smarter way to wake me up 🙂

(Editor’s Note: Thanks to Khalid for sharing how he created his hack Wake Up Call, and how powerful (and straight forward) the Tropo API is to use.)