The making of FunConcertFinder
I have had a couple of days to mull over this project and I think that I am ready to dive in. I am writing this post to help me document my thought process and also assist me in thinking through the process of developing this app.
The first step in programming for me is putting on some music that generally lacks singing. Samples of human voice or highly repetitive sung parts are acceptable, as are non-English lyrics. I just find a standard song sung in English too distracting. I created a channel in Pandora based around the band 'Burial' which has turned into an awesome meditative yet energetic soundtrack to my thinking and typing.
From there, I need to build out the speech and 'intents' for the Echo user. Intents are the voice answers provided by users to my app. I need to map out all the possible intents as well as provide some help and direction via spoken interactions from the Echo to the user. I imagine this to be an iterative process, since I want to offer three main services - find concerts from a specific band, find concerts at a specific venue, and find concerts in a specific city. Fortunately, the Amazon Echo sample code includes a High Tide finder service that has a little bit of similarity with what I am trying to do.
Last, it helps greatly if a text-based list can be entered of various proper nouns for the various 'slots' (Alexa speech variables) users will provide. Our three slots will most likely be band names, city names, and venue names. I am not quite sure where to find lists of all three, of which venue names are likely the most difficult. For band names, I can check Billboard charts and probably account for a plurality of all concert tickets sold just to the top acts. Of course, I would prefer more obscure bands to make this a more interesting app for niche music vans that are likely more enthusiastic 'super' users of an app like this.
First I learned the four main HTTP verbs of GET, POST, PUT and DELETE. From Rails, I learned about a few more such as NEW, CREATE and UPDATE but I am not going to be pedantic about it. GET retrieves data, POST sends data as a new record, PUT generally sends data as an update, and DELETE deletes a record.
Next, I learned that an HTTP request is made of three parts: the request line, the header, and the body. The request line will tell the server which verb we are using and what we are looking for. The header sends additional information such as information about my machine (the client). Last, the body is where the POST or PUT data goes. GET and DELETE requests will have an empty body.
For a long time, I was taught that the W3Schools site was not all that great (except at SEO because those fools are top ranked in everything related to programming). However, I found their JSON information extremely informative and easy to understand. This Tutorials Point link also proved helpful.
Node and JSON
XMLHttpRequest is or why I am here on Earth. Baby I was born to get info from a concert API and will not be denied.
Simple enough solution - the
XMLHttpRequest object is a browser object and not in Node. You have to download the module from NPM and add in a line of code to get this to work.
And with some futzing about combined with my brand new knowledge of Node.js I was able to get communications established with my new friends at BandsInTown! Now to write the other 1,000 lines of code for my Alexa project.