-
Notifications
You must be signed in to change notification settings - Fork 0
Alexa Integration
To allow the user to interact with our system using voice commands, we are using an Amazon Echo device. The functionality for this is created by defining a custom 'Skill' which runs on the Echo, and can recognise the user's commands.
The following diagram describes how we see this part of the system interacting with our existing Node.js web app.
- Invocation Name - ‘Jukebox’
Language set to eng-US to ensure most compatibility.
- Intents - functions that respond to utterances.
QueueIntent - with sample utterances:
‘To queue Rick Astley’
‘To queue Hey Ya’
‘To queue a christmas song’
The logic to power this intent can be coded in Node.js as a AWS Lambda function. That backend logic can then be connected to this interaction/frontend via an ARN. So when a user interacts with our Skill, Alexa sends the request to the AWS Lambda function. The requests and responses are given in JSON format.
- Build Model - A model is built up from the given sample utterances, this is done by Amazon.
- Endpoint - A choice between AWS Lambda or an independent HTTPS web service.
- Supply a ARN to be invoked when users interact with the Skill.
- AWS Lambda supports Node.JS.
- Free for 1m requests per month which should suffice for our app.
On recognising the user's speech as relevant to the QueueIntent
, we can get their chosen song with this: const query = handlerInput.requestEnvelope.request.intent.slots.Query.value;
, which will then be set to the user's search query for the song they desire.
This step was more problematic, as it required an interfacing between the code (hosted on AWS Lambda), and our existing web app, as shown in the architecture diagram. A copy of this code is included in this repository, under the /alexa
folder, with a description of its function.
The core idea is that a new API route was created (in /routes/spotify.js
), this receives POST calls, the given search query is then sent to Spotify, and the first result is added to the queue, if there is one. Such a POST call can then be made from the AWS Lambda codebase.
This POST call is under the QueueIntentHandler
, and uses Node's in-built http
library, as no dependencies could be added to the Lambda codebase.
Group 14 - BJSS Office Jukebox
- Directory Structure
- Requirements
- Architecture
- Specification
- User Interface
- Deployment
-
Front End
- Components
- Pages
- Startup
- Alexa
- Static (assets)
-
Back End
-
Functions