In this lesson, we are going to establish the communication between Alexa and our PC.
In practice, we are going to enable the communication between the Alexa Voice assistant and a web server
on our PC that is going to be provided by Ngrok.
This way our PC will be able to receive messages from the voice assistant and also to process these
messages to actuate the robot accordingly.
To enable this communication.
As I said, we are going to use the Ngrok software, so let's start by downloading it.
So in Google, let's look for Ngrok.
And then let's click on the first one and here you are going to need an account to this website.
So if you don't have yet, please sign up.
Otherwise, if you have it, as in my case, just log in.
And now once we access this web page, let's download.
So let's download Ngrok for Linux.
So this is going to download an archive.
So let's open then the download folder in which it was downloaded and let's extract all the content.
And so now we have ngrok here that is ready to be used.
Now in order to use Ngrok, we need to open a new terminal.
And so let's go to the folder in which we just downloaded Rock.
And so in my case this is the downloads folder.
And then we did the downloads folder.
I downloaded a folder called Ngrok.
And then within this folder we can see that there is an executable called Ngrok.
We can start this executable with the command dot slash followed by the name of the executable that
is Ngrok.
And then we need to configure Ngrok in order to associate it with our account.
So here, as you can see in the point number two, we can copy this command here which contains a key
for your account.
So let's copy the command.
And let's paste it within the terminal.
And so let's press enter.
And this will have saved your key.
And so we'll have activated also your lock account.
And so from now on, we can start using this software.
Now, in order to use it, we can still run the executable.
So andyrock.
And now we need to specify the communication protocol that we want to use for the web server that we
are going to host.
And so let's use the Http protocol.
And now let's also specify the port.
So which is the port of our PC, which we want to open to the outside.
So to the internet and so which is the port that will be able to receive messages from the Amazon.
Alexa assistant, let's say the port number 5000.
So let's press enter.
And now Ngrok will make the port 5000 of our PC so the local host accessible to the external world and
so to the internet.
It also provides us an unique address.
So this one here, this is a unique address that is automatically generated by Ngrok.
And this address is what we need to configure in the Alexa developer console in order to allow the voice
assistant to send messages to our PC.
So let's copy this one.
The one that says Https.
So let's copy this link.
And now let's go back to the Alexa developer console and let's go back to the Arduino bot skill that
we are implementing.
Now let's take this on one side so that we can see the message exchange.
And here let's go to the endpoint section and in the default region in which we inserted a placeholder
address, now we can paste the actual address of our web service.
So the one that Nroc makes available on our PC, let's save the endpoint.
And now let's test this skill.
Communication.
So the communication between the Alexa developer console and our PC.
So this is running on our PC and this is running on the Amazon Alexa servers.
So now let's test the communication between these two systems.
So again, in the test tab.
Let's again activate the skill.
Activate robot.
There was a problem with the requested skills response.
And you can notice that two messages have been printed here in the terminal.
So in the Ngrok console, although these are error messages from the server indicating that it wasn't
able to process the message that it received, this still means that the Alexa console was able to contact
our PC, so was able to send a message to our PC through Ngrok and so through this address here that
ngrok provided.
I now that the Alexa voice assistant can communicate and so can send messages to the web server on our
PC.
We can finally add the logic that processes the messages that Alexa sends us and use their information
to send commands to our robot.