Colin McGraw
Published © GPL3+

The Tickle Monster! - An Alexa Game

Fun (maybe terror) for the whole family! Enter a list of participants, then ask the Tickle Monster to name who gets tickled next!

IntermediateProtip4 hours5,735

Things used in this project

Hardware components

Amazon Echo
Amazon Alexa Amazon Echo

Software apps and online services

AWS Lambda
Amazon Web Services AWS Lambda
Full source code provided in the "Code" section.
Alexa Skills Kit
Amazon Alexa Alexa Skills Kit


Read more


Files In Zip Format

Supporting files in zip format for those who prefer it to cutting/pasting from the project page's text.


AWS Lambda Function for Tickle Monster

Amazon's Lambda makes setup of a simple skill pretty easy and I included the source code in a format that is easy to copy/paste into the online editor.

See here for detail on how to set up something similar:
//The Tickle Monster speechlet. 
//This is a single file to make cutting/pasting/fiddling easier.
exports.handler = function (event, context) {
    //Security check. There's only one true Tickle Monster!
    var appId = "your app id";
    if (event.session.application.applicationId !== "" + appId) "Invalid Application ID");
                    //determine intent/see how to respond
            //participants not found or invalid
            function(error) {
                    //send back a message saying the user needs to configure participants
                            message: "Please view the message from Tickle Monster in your Alexa app and choose <break time='1ms'/> 'Link Account' <break time='1ms'/> to set up participant names.",
                            shouldResetNames: true,
                            shouldEndSession: true
      "Exception: " + err);

function getEventReponse(parsedEvent){
    //variables set according to conditions below and passed to a buildSpeechletResponse() function at the end.
    var responseInfo = {
        message: "",
        repromptText: "",
        intentName: parsedEvent.intentName,
        shouldResetNames: false,
        shouldEndSession: true
    //if user only says "launch Tickle Monster", then give instructions on use.
    if (parsedEvent.isLaunchRequest) 
    else if(parsedEvent.intentName === "AMAZON.HelpIntent") 
    else if(parsedEvent.intentName === "AMAZON.StopIntent") 
    else if(parsedEvent.intentName === "WhosNextIntent")
      whosNext(parsedEvent, responseInfo);
    else if(parsedEvent.intentName === "ResetNamesIntent")
    //if user is responding to the question of whether or not to reset the names
    else if(parsedEvent.previousIntentName === "ResetNamesIntent"){
        if(parsedEvent.intentName === "AMAZON.YesIntent")
        else if(parsedEvent.intentName === "AMAZON.NoIntent")
    return buildSpeechletResponse(responseInfo);

function parseEvent(event){
    var promise = new Promise(function(resolve, reject) {
        //Technically, I hacked the OAuth protocol to store the possible names in the access token
        //to avoid having to worry about management of credentials or even a database.
        //Typically the access token is only a key used to then lookup user information (not a storage mechanism FOR user info),
        //I'm just being tricky.
        var unparsedParticipants = event.session.user.accessToken;
        if(unparsedParticipants && unparsedParticipants !== "")
            var parsedParticipants = getParticipants(unparsedParticipants);
            var intent = event.request.intent ? : "";
            //track the previous intent so we can, for example, respond to a yes/no question
            var previousIntent = (event.session.attributes && event.session.attributes.previousIntentName);
            var isLaunchRequest = event.request.type === "LaunchRequest";
            //pass back the info we most care about
                    event: event, 
                    participants: parsedParticipants,
                    intentName: intent,
                    previousIntentName: previousIntent,
                    isLaunchRequest: isLaunchRequest
        else {
            reject(Error("No participants found!"));
    return promise;

//See the response section of this document for more detail on what's going on here: 
function buildSpeechletResponse(responseInfo) {
    var speechletResponse = { 
        version: "1.0",
        sessionAttributes: { previousIntentName: responseInfo.intentName },
        response: {
            //note the use of SSML (speech markup). this can alternately be plain text if you say so in the response.
            outputSpeech: {
                type: "SSML",
                ssml: "<speak>" + responseInfo.message + "</speak>"
            shouldEndSession: responseInfo.shouldEndSession
    //if we want to include repromt text (necessary for certification in case of LaunchRequest)
        speechletResponse.response.reprompt =
                    type: "SSML",
                    ssml: "<speak>" + responseInfo.repromptText + "</speak>"
    //if we want to reset the names, then send a "LinkAccount" card to the Alexa app so the user can do so.
    if(responseInfo.shouldResetNames) speechletResponse.response.card = { type: "LinkAccount" };
    return speechletResponse;

//keep the responses varied so they seem less robotic (and more fun!)
//uses rudamentary SSML for pauses. see here for details:
var variedTickleResponses = [
    'Hmmm. <break time="1s"/> Maybe {TickleVictim}!',
    'I think you should tickle <break time="1s"/> {TickleVictim}!',
    '{TickleVictim}! Definitely {TickleVictim}!',
    'This time? <break time="1s"/> I think {TickleVictim}',
    'Maybe <break time="1s"/> {TickleVictim}!',
    'How about <break time="1s"/> {TickleVictim}!',
    'Let me think. <break time="1s"/> Hmmm. <break time="1s"/> {TickleVictim}!',
    'You want to know who\'s next? <break time="1s"/> {TickleVictim}!',
    'Better watch out {TickleVictim}, you\'re next!',
    '{TickleVictim}! Get {TickleVictim}!',
    'I think {TickleVictim} could use some tickles!'
//Message Configuration
//********"Alexa, Launch Tickle Monster"**************************
function launchMessage(responseInfo){
  responseInfo.message = "All right! Let's get tickling! Just ask <break time='1ms'/> \"who's' next\", or say \"reset the participant names\".";
  responseInfo.repromptText = "I didn't hear a response. You can ask <break time='1ms'/> \"who's next\", or say \"reset the participant names\".";
  responseInfo.shouldEndSession = false;

//********"Alexa, Ask Tickle Monster For Help"*********************
function helpMessage(responseInfo){
  responseInfo.message = "To choose the next person to be tickled, just ask <break time='1ms'/> \"who's next\". Otherwise say \"reset the participant names\" to enter who's playing.";
  responseInfo.repromptText = "I didn't hear a response. " + responseInfo.message;
  responseInfo.shouldEndSession = false;

function stopMessage(responseInfo){
  responseInfo.message = "Okay. Tickle Monster signing off!";

//********"Alexa, Ask Tickle Monster Who's Next"********************
function whosNext(parsedEvent, responseInfo){
  responseInfo.message = getVariedTickleResponse(parsedEvent.participants);

//*********"Alexa, Ask Tickle Monster To Reset Participant Names"***
function confirmNameReset(responseInfo){
  responseInfo.message = "Are you sure you want Tickle Monster to reset the names?";
  responseInfo.repromptText = "Do you want to reset the participant names? Please answer \"yes\" or \"no\".";
  responseInfo.shouldEndSession = false;

//*********"Are You Sure You Want to Reset Participant Names?********
function yesResetNames(responseInfo){
  //there will be a link in the Alexa app 
  //that lets the user revisit the name setup page.
  responseInfo.message = "Please view the message from Tickle Monster in your Alexa app and choose <break time='1ms'/> 'Link Account' <break time='1ms'/> to finish resetting the names.";
  responseInfo.shouldResetNames = true;

//*********"Are You Sure You Want to Reset Participant Names?********
function noResetNames(responseInfo){
  responseInfo.message = "Okay. Cancelled.";

function getNextTickleVictim(participants){
    //add the possibility of "Everyone", just to spice things up a bit
    var chanceIn = 20;
    if(getRandomInt(0, chanceIn) == chanceIn) 
        return "Everyone";
    var participantsCount = participants.length;
    //get a random tickle victim to return.
    var randomIndex = getRandomInt(0, participantsCount - 1);
    return participants[randomIndex];

function getVariedTickleResponse(participants){
    var nextVictim = getNextTickleVictim(participants);
    var randomResponseIndex = getRandomInt(0, variedTickleResponses.length - 1)
    return variedTickleResponses[randomResponseIndex].replace(/{TickleVictim}/g, nextVictim);

function getParticipants(unparsedParticipants){
    //crude, reasonable validation for character limit.
    var charLimit = 1000;

    //crude validation using Regex. remove anything that's not a letter, comma, space or single quote
    unparsedParticipants = unparsedParticipants.replace(/[^a-z\s',]/gi, "");

    return unparsedParticipants.split(",");

function getRandomInt(min, max) {
    return Math.floor(Math.random() * (max - min + 1)) + min;

The Account Linking Web Page (With Javascript)

Amazon supports "Account Linking" via the OAuth 2 protocol. Here, I hack the protocol to store participant choices which I use to associate Tickle Monster game participants with an Amazon Echo.
<!DOCTYPE html>
      <title>Who Are The Tickled?</title>
      <meta name=viewport content="width=device-width, initial-scale=1">
      <link href='' rel='stylesheet' type='text/css'>
      <link href='' rel='stylesheet' type='text/css'>
      <script src="" integrity="sha256-a23g1Nt4dtEYOj7bR+vTu7+T8VP13humZFBJNIYoEJo=" crossorigin="anonymous"></script>
      <!--tag manager jQuery plugin. see>
      <script src=""></script>
      <link rel="stylesheet" href="">
      <!--I'm keeping everything in one file for simplicity/ease of tinkering-->
      <link rel="stylesheet" href="TickleMonster.css">
                var tags = $("#the-tickled").tagsManager("tags");
                if(tags.length == 0){
                  alert("The Tickle Monster needs to know who to tickle! Please enter some names.");
                  return false; //cancel click

                //assigned by Amazon
                var vendorId = "<<Amazon-assigned vendor ID goes here>>";
                var returnUrl = "" + vendorId;

                //get the query string values amazon passed to us
                var amazonValues = getQueryParameters();

                //hacking the OAuth protocol to store tickle victims'
                //names as the access token?!?
                //no need for databases or passwords?!? how sneaky and
                //mischievous! so like the Tickle Monster. 
                var theTickled = encodeURIComponent(tags.toString());
                //redirect the user back to Amazon 
                //so we can store their choices for use with the skill.
                //see description of implicit grant flow here: 
                location = returnUrl 
                            + "#state=" 
                            + amazonValues.state 
                            //the hack part
                            + "&access_token=" 
                            + theTickled 
                            + "&token_type=Bearer";

          function pushTag(){
            var text = $("#the-tickled").val();
            if(text != "") 
               $("#the-tickled").tagsManager("pushTag", text);

          function getQueryParameters(str) {
            return (str ||^\?)/,'').split("&").map(function(n){return n = n.split("="),this[n[0]] = n[1],this}.bind({}))[0];
      <div class="centered">
        <div><img src="/images/TickleMonster.png" alt="The Tickle Monster"/></div>
        <div id="tickle-monster-title">The Tickle Monster!</div> 
        <label for="the-tickled">
          Please add the names of those <br/>playing the tickle game!
        <div id="name-inputs">
          <input id="the-tickled" type="text" name="tags" placeholder="Enter A Name" class="tm-input-info big-space" />
          <input id="add-more" class="themed-button" type="button" value="Add 'Em!">
        <div class="centered"><a href="#" id="here-we-go">I'm Done Adding Names. <br/>Now Let's Get Tickling!</a></div>

TickleMonster.css (For Use With Account Linking Web Page)

Styling for account linking page (background, button, picker, etc.).
          background-color: #9DBCCA;
          font-size: 23px;
          font-family: 'Open Sans Condensed', sans-serif;
          padding: 20px;
          margin: 0 15px 0 15px;

          text-align: center;

          font-family: 'Dancing Script', cursive;
          font-size: 32px;
          text-shadow: 2px 2px 4px #000000;
          line-height: 1em;
          font-family: 'Open Sans Condensed', sans-serif;
          font-size: large;  

          margin: 10px 0;
          border: 1px dashed #717C90;
          padding: 8px;

          border-radius: 5px;
          background: #BECBD0;
          box-shadow: 0 2px #707C92;

          box-shadow: none;
          margin-top: 8px;
          width: 100%;
          box-shadow: 0px 1px 0px 0px #fff6af;
          background:linear-gradient(to bottom, #ffec64 5%, #ffab23 100%);
          border:1px solid #ffaa22;
          padding:6px 0;
          text-shadow:0px 1px 0px #ffee66;

         font-family: 'Open Sans Condensed', sans-serif;
          font-size: medium;
          margin-right: 15px;  


Colin McGraw

Colin McGraw

1 project • 5 followers
With 14 years in tech, I was a speaker at Microsoft events, competitive coder and I write awesome software and apps for a variety of industries.
Thanks to Jennifer Huebner.


Add projectSign up / Login