Built.io Blog

How To Build A Party Bot With Alexa, Lifx And Built.io® Flow

,

Achievement unlocked: I built a voice activated party bot using Amazon Alexa, LIFX smart light bulbs, and Dropbox to play music. The ultimate tool in your nerd belt, this bot is sure to make you the most popular guy or gal in the room this NYE (or anytime, really).

What You Need

Part 1: Song Selection

To get your Echo or Dot to play music you will need to upload your songs to a cloud storage service. I used Dropbox because it links directly to the file (the URL contains .mp3). Once you have uploaded your song(s),

  1. Click share
  2. Make sure the permissions are set so that “anyone with the link can view this file”.
  3. Copy the link and change the end of the URL so it reads “.mp3?dl=1” instead of “.mp3?dl=0”.

Part 2: Build Your Workflow

There are two approaches to building this party bot; one that is simpler and one that is more flexible and allows you to customize the “party”.

Built.io Flow Express Workflow

This workflow is allows you to control the lights and play the same song each time the party bot is triggered. All you have to do here drop in the URL to your song file.

  1. Import the template here. Follow the steps to set up your workflow.
  2. At the end it will ask you for the song parameter, this is where you want to drop in your song link.
  3. Copy the URL and add ”?sync=true” to the end so your URL will look something like this: https://runflow.built.io/run/00000?sync=true
  4. Save the URL for later when we set up the Alexa side of the bot.

Built.io Flow Enterprise Workflow

This workflow is more advanced and allows you to randomize which song plays each time the bot is triggered.

  1. Import the template here.
  2. Open the workflow, and double click on the green play button. Select “Webhook and copy the webhook. Make sure that it ends with “?sync=true”.
  3. Now double click on the “Node.js” block. You will see the song array where you can drop in the URLs for all of your songs.
  4. Save the URL for later when we set up the Alexa side of the bot.

Setting Up Alexa

Navigate to https://developer.amazon.com/home.html and sign in to your Amazon developer account. From there go the Alexa > Alexa Skills Kit > Add New Skill.

  1. Now to choose the name of you assistant. Enter the name in the “Invocation Name” slot.
  2. For the Global Fields, select “Yes” next to Audio Player.
  3. The Interaction Model is the guts of the Alexa part. Use the following for the Intent Schema:
    {  
      "intents":[  
         {  
            "intent":"AMAZON.ResumeIntent"
         },
         {  
            "intent":"AMAZON.PauseIntent"
         },
         {  
            "intent":"time"
         }
      ]
    }
        
  4. Use the following for the Sample Utterances:
    time it's party time
    time party time
        
  5. For the Configuration, select HTTPS > North America and drop in the webhook URL from your workflow here.
  6. The next section, SSL Certificate, choose the second option “My development endpoint is a sub-domain of a domain that has a wildcard certificate from a certificate authority”.
  7. The Alexa set up is done! Now you can test it out by entering “Alexa tell [assistant name] it’s party time”. If everything is working you will see some code under the Service Response section.

Part 3: DANCE PARTY

Leave us a video of your party bot in the comments.

Popular Posts

Subscribe to our blog