Node-RED nodes for the Alexa Voice Service
This node will allow you to interact with the Alexa Voice Service (the same API that powers Echo devices) You send in a short audio clip and get an audio response. This audio can come from alsmost any source either the microphone, reading a local file or be generated using a separate Text to Speech Node.
: payload (buffer) : the audio to send to the service. : dialogRequestId (string) : Where the audio is part of an existing dialog the ID from the previous response
: payload (object) : the response from the Alexa Voice Service, certain objects will be binary audio buffers. : dialogRequestId (string) : the dialog ID either as was set on the input or a new random string.
AVS responds with a multipart object, the Node will parse this into a single object,
msg.payload should be 16Khz PCM Mono audio, the node will attempt to convert any buffer input using ffmpeg but ideally you should capture in the correct format.
msg.dialogRequestId is used by AVS to assocaite multiple interactions within the same conversation, if you are starting a new dialog this does not need to be set on the input and the node will generate one. For replies it should match the previous response
AVS Endpoint is the avs server nearest to your application, Europe, US and Asia values are pre-set or advanced users can manually set this to another value.
Access Token should usually be passed in as a parameter on the message object as these have a limited time to live, however you can also hard code it or reference a context object.
Convert Audio Output will set the format on all the response buffer objects to the same format either 22.05Khz Mono MP3 or 16Khz Mono WAV. Sometimes AVS responds with different bit rate samples in the same multipart response
Path to ffmpeg The node will attempt to intstall ffmpeg binaries for common platforms but if this does not work you can manually install for your system and reference the binary path here eg
The examples folder contains flows for obtaining an Access Token via oAuth which you need to pass to the AVS node. In order to use oAuth you need to obtain a set of credentials from Amazon. Make a note of these credentials as you will need to put them into the auth flow nodes. Make sure to record your Product ID, Client ID, and Client Secret.
- Login at https://developer.amazon.com and go to
Your Alexa Consoles(top right) then
- You are at
- For the
Product nameuse something like alexaweb or whatever you want.
Descriptionenter whatever you want
- All other fields can be filled out how you plan to use your AlexaPi
- For the
- You are at
Create New Profile.
- Choose whatever for
Security Profile Nameand
Security Profile Description. Hit
Web: (assuming you are running Node-RED on localhost port 1880)
Allowed Origins- put there
Allowed Return URLsput
- You should now be at the devices page