This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Amazon Echo

I recently got an Amazon Echo. Beside its out of the box features, what do you use it for? I'm looking for ideas. Currently i control my Phillips Hue Light system.

Parents Reply Children
  • As long as you promise not to laugh... this was literally my first swing at anything node.js (they support python 2.7 now). I named it Barry after bharris01​ our resident guru of all things WHD at Loop1. emoticons_wink.png

    So when I said "Alexa, launch Barry" it would say "You have 27 open tickets in the queue."

    // Alexa SDK for JavaScript v1.0.00

    // Copyright (c) 2015 Steven Klassen. All Rights Reserved. Use is subject to license terms.

    /**

    * Simply tell me how many tickets are open.

    */

    /**

    * App ID for the skill

    */

    var APP_ID = "you_app_id_here";

    /**

    * The AlexaSkill prototype and helper functions

    */

    var AlexaSkill = require('./AlexaSkill');

    var http = require("http");

    var concat = require("concat-stream");

    /**

    * Affirmations is a child of AlexaSkill.

    */

    var WebHelpDesk = function () {

        AlexaSkill.call(this, APP_ID);

    };

    // Extend AlexaSkill

    WebHelpDesk.prototype = Object.create(AlexaSkill.prototype);

    WebHelpDesk.prototype.constructor = WebHelpDesk;

    WebHelpDesk.prototype.eventHandlers.onSessionStarted = function (sessionStartedRequest, session) {

      console.log("WebHelpDesk onSessionStarted requestId: " + sessionStartedRequest.requestId

        + ", sessionId: " + session.sessionId);

      // any other initialization stuff goes here

    };

    WebHelpDesk.prototype.eventHandlers.onLaunch = function (launchRequest, session, response) {

      console.log("WebHelpDesk onLaunch requestId: " + launchRequest.requestId + ", sessionId: " + session.sessionId);

      handleTicketCountRequest(response);

    };

    /**

    * Overridden to show that a subclass can override this function to teardown session state.

    */

    WebHelpDesk.prototype.eventHandlers.onSessionEnded = function (sessionEndedRequest, session) {

      console.log("WebHelpDesk onSessionEnded requestId: " + sessionEndedRequest.requestId

        + ", sessionId: " + session.sessionId);

    };

    WebHelpDesk.prototype.intentHandlers = {

      GetTicketCountIntent: function (intent, session, response) {

        handleTicketCountRequest(response);

      },

      GetHighestPriorityIntent: function (intent, session, response) {

        handleHighestPriorityRequest(response);

      },

      HelpIntent: function (intent, session, response) {

        response.ask("You can ask web helpdesk how many tickets are open.");

      }

    };

    /**

    * Gets the current count of open tickets via the API.

    */

    function handleTicketCountRequest(response) {

       var hostname = "your_helpdesk_url_here";

       var apiKey = "your_api_key_here";

       var helpdesk = "http://your_helpdesk_url_here/"

       var request = "Tickets/?qualifier=((statustype.statusTypeName %21%3D 'Closed') and (statustype.statusTypeName %21%3D 'Resolved') and (statustype.statusTypeName %21%3D 'Cancelled') and (statustype.statusTypeName %21%3D 'Eng Hold'))&username=YOUR_USERNAME_HERE_BUT_SHOULD_BE_A_VARIABLE&apiKey=" + apiKey;

       var url = helpdesk + request;

       // get the tickets object

       http.get(url, function(res) {

         res.pipe(concat(function(body) {

           var tickets = JSON.parse(body.toString());

           var verb, ticketWord;

           if (tickets.length != 1) {

             verb = "are";

             ticketWord = "tickets";

           }

           else {

             verb = "is";

             ticketWord = "ticket";

           }

          var speechOutput = "There " + verb + " currently " + tickets.length + " outstanding " + ticketWord + " in the queue.";

          response.tell(speechOutput);

          //  console.log("There " + verb + " currently " + tickets.length + " open " + ticketWord + " in the queue.");

         }))

       });

    }

    // Create the handler that responds to the Alexa Request.

    exports.handler = function (event, context) {

        // Create an instance of the WebHelpDesk skill

        var whd = new WebHelpDesk();

        whd.execute(event, context);

    };

  • Not at all, It's very innovative. I wish there were more resources like this. Now with Google Home coming out, I'm afraid Alexa may become obsolete. I have a ton of IFTTT recipes if anyone wants to share. For example, I'm a Miami Dolphins fan (I know, I know) so every time they kickoff a new game, the lights in my house turn orange and blue. (I have Phillips Hue as well). I also set up an action so when Alexa counts down to zero all my lights turn bright white. (An easy way to change the light color without access to an app.)

  • I thought about turning this out as a skill on their marketplace, but I don't know how I'd get it configured for the user's own helpdesk. Or how any skill gets a configuration for that matter. It seems these need to be not-quite-customized in order to be useful to the masses.