If you want to tame your Alexa using graphical interface and TTS (text to speech) – this video is for you.

In this article I will show you how you can easily interact with the Alexa APIs. We will play a little bit with TTS & SSML. Don’t worry no coding skills are required.

If you don’t want to read then watch the video below!

SSML is a markup language that provides a standard way to mark up text for the generation of synthetic speech. The Alexa Skills Kit supports a subset of the tags defined in the SSML specification.

For example:
You may want a longer pause within the speech, or you may want a string of digits to be read as a standard telephone number or maybe you want to make Alexa to whisper like in the beginning of the video and so on so on.

Requirements:

The things that you need to complete this How-To are:

  1. Working Node-Red installation or Docker client
  2. Alexa device – Link
  3. Comment and share this article in your favourite social media (just kidding)

If you already have working Node-RED you can skip the “Steps with Docker” and go straight to “Steps in Node-RED” header.

Steps with Docker

After successful installation of the Docker client open a terminal/console/command prompt (whatever you like to name it).

To run Node-RED in Docker just type the following and don’t forget the -p 3456:3456 option, because it is very important for the Alexa API authentication:

docker run -it -p 1880:1880 -p 3456:3456 --name mynodered nodered/node-red

After successful execution of the above command you should have something similar in the console.

Successful start of Node-RED within Docker
Successful start of Node-RED within Docker

Now you can open the URL http://127.0.0.1:1880 (or whatever your IP and port is) in a browser. If you see the Node-RED dashboard you can continue happily ahead.

Steps in Node-RED

Open the “Manage palette” from the Node-RED menu in the upper right corner. In “Install” tab search for the following modules/plugins and install them:

  • node-red-dashboard – This module provides a set of nodes in Node-RED to quickly create a live data dashboard. If you wish to learn more, check the GitHub page of the project.
  • node-red-contrib-alexa-remote2 – which is node-red nodes for interacting with Alexa. Again If you wish to learn more, this is the GitHub page of the project.

Go to this page and copy one of the examples let’s say the 1. Alexa Speak Dashboard is a good for a start – link

Import the example using the Node-RED menu by pasting the copied text there and by click on the “import” button.

Import Menu in the Node-RED UI
Import Menu in the Node-RED UI

Double click on the nodes with the red triangle in their upper right corner

Alexa TTS example in Node-RED
Alexa TTS example in Node-RED

Click on the pencil button next to the “Add new alexa-remote-account…” label and…

Be careful here from this configuration more or less depends your success with enabling of the Alexa Text-To-Speach.

Adding new Alexa Account config node
Adding new Alexa Account config node

You want to double check the following things:

This IP field should be the IP where the Node-RED is installed. This maybe is the localhost or maybe it is different IP. If it’s different change it.

The Port should match the port in the Docker command. Remember the “-p 3456:3456” option. Most of the time you shouldn’t have to change this, so you can leave it like that.

File Path is the place where you should type something/anything, meaningful to you like “authFile”. The plugin will create a file with that name and inside the file, it will store your encrypted Amazon credentials. This is needed because otherwise it will ask you to re-login every time you re-deploy your Node-RED flow.

Service Host and Page

Then you want to change Service Host and Page depending of your location and the table below.

Have in mind that there are some cases when everything seems to be OK, there is no errors anywhere, but Alexa don’t want to speak at all. And the reason for this on all of the cases was the Service Host and Page.

Some nice guys from India manage to make this work by typing alexa.amazon.it and amazon.it as their Service Host and Page. And it worked for some reason. So if you face similar issue try change them one by one.

Service Host Page Language
USApitangui.amazon.comamazon.com en-US
UKalexa.amazon.co.ukamazon.co.uk en-UK
GERlayla.amazon.deamazon.de de-DE
ITAalexa.amazon.itamazon.it it-IT
AUSalexa.amazon.com.auamazon.com.au en-US

After you change the above things hit the “Deploy” button and if there is no errors, you should see something similar:

Successfully deployed flow asking to open a new URL
Successfully deployed flow asking to open a new URL

Open a new browser/tab and type the localhost:3456 or Whatever_your_IP_is:3456. Now you should see the amazon alexa sign-in page. And you should enter your Amazon credentials.

After you do that you will see a welcoming green ready under your Alexa nodes like this

green + ready = beautiful
green + ready = beautiful

Testing the Alexa TTS in the Node-RED dashboard

And the final and most fun part is to test our creation. Go to your Node-RED dashboard by either typing the http://localhost:1880/ui or by clicking the following buttons:

Open the Node-RED dashboard from the Node-RED menu
Open the Node-RED dashboard from the Node-RED menu

You should see something like this at the end.

Node-RED Alexa TTS dashboard
Node-RED Alexa TTS dashboard

Click on the blue refresh button and choose your Alexa device. In the text field below enter your text that you want Alexa to speak – like “Subscribe for the Kiril’s newsletter” and press the SPEAK button.

Question of the day

For what do you plan to use Alexa’s text to speech? Let me know your answers in the comments. Also let me know if you have any questions.

I’m really interested about what kind of clever ideas and routines you will create using TTS.

Support my work

Check my other post about Alexa, Node-Red & MQTT on this link

Furthermore feel free to add me on Twitter by search for this username – KPeyanski

I post there pretty much daily.

I really hope that you find this information useful and wish you good luck with your TTS enabled Alexa.

Thank you, stay safe and see you next time.


5 Comments

ravi · 13/02/2020 at 7:44 am

can you visit this link for clearing my doubt as i followed your turorial but having some troble in making alexa speak.
https://github.com/586837r/node-red-contrib-alexa-remote2/issues/55#issuecomment-584789390

    Kiril Peyanski · 13/02/2020 at 7:55 am

    Sure, I will take a look in an hour or so. Thanks for your comment.

    Kiril Peyanski · 13/02/2020 at 11:23 am

    Hey Ravi, check the comments under the video from Achyuth Kassa. He had the same problem and now he found that if he change the configuration to “alexa.amazon.it amazon.it it-IT” everything works fine. Let me know what happened. Good luck.

ravi · 14/02/2020 at 11:23 am

if we want to build speech to text then what we have to do can you help me out. so the requirement is like if we will say anything to alexa (echo dot 3rd generation) then it has to write it in plain text form. can you help me out with this.

Leave a Reply

Your email address will not be published. Required fields are marked *