Okay.
And now we go back to our workflow and we'll give this another try.
We'll we'll refresh this and we'll say hi there and we'll see what happens.
Off it goes.
It's gone to Gemini.
It's converted to speech.
It all workflow ran successfully.
It didn't say anything to me.
Maybe you're expecting that, but it couldn't do that.
All we did was we called an API that generated a file which is an audio file.
Here it is.
We can now download it and listen to it.
I'm going to press the download button and it's just downloaded something.
And then we'll we'll go and listen okay.
So I've got like a I've just launched that that thing I've got this little player here.
Let's see what we got.
Hello.
How can I help you today.
Wow okay.
She's very chirpy today.
Hello.
How can I help you today?
That, I guess, is Miss Walker, uh, speaking, uh, with much enthusiasm to us.
And that is how we got.
We got through this API.
Let's just try changing this to another person.
Let's try.
Jason, I think we need someone to counteract that energy level.
Someone calm, meditative and soothing.
Again, this is going to be making an API request to 11 labs.
Back we go.
We will reset the chat session and we will say hi there.
Okay, here we go.
It goes across, it goes to the agent and it's converted.
That was all super quick.
We got back a bunch of stuff.
Now we come back into this node.
Here it is.
We download this file to and then I'm going to try right clicking on this.
Uh I'm going to show it in finder.
And then we will I'll bring up the player as before and we'll listen to this okay.
Here we go.
Let's listen.
Hello.
How can I help you today?
Definitely a more soothing Jason.
Thank you.
And so that gives us a good sense of how it works to generate audio.
Doesn't feel very satisfying yet.
We've got a little bit more to go.
Okay, so next up we're going to go back to our workflow.
And we're going to do some new things.
We're first of all going to get rid of this guy.
No more coming in that way.
Instead, we're going to come in a completely different way.
We are going to add a web hook.
So I'm going to go.
Plus I'm going to say on webhook call, this is saying I want to be triggered by a webhook.
Now we have already experienced this a few times because we've used things like Slack and Telegram as
well.
Both of them allowed us to set up a webhook using KNN nodes specifically designed for slack and for
telegram.
In this case, we're using the generic one, the one I mentioned that's generic.
This is the generic on webhook call node that allows us to configure any webhook, anyone that hits
this endpoint right here for test or this endpoint for production will trigger this particular webhook.
So it's going to sit there listening on this, and anyone that hits it will trigger this once we press
the listen for event button.
And that's that's how it works.
It's that simple.
There's no more configuration than that which which I just love.
It's so easy.
So So when something comes in, it's going to come in and hit this webhook.
All right.
So what are we going to do with this?
Well, if I, if I go back back to the canvas again, um, let's see where does it put that that that
webhook over here.
I don't know why it's over there, but we're going to move it right here.
So in comes that webhook.
All right.
And you can see that by the way, it has get uh, because uh, you can just look at it again.
There's this HTTP method that can be get or there are other things as well.
But I mentioned get and post are the most common things.
I'm actually going to change it from get to post because we're going to want this to be pushing information
to us.
Okay.
So so that is uh, that is set up.
And now what I'm going to do is whatever gets posted in is actually we're going to set it up so that
we can post some audio.
I'm going to want to send that to 11 labs again.
So here we're going to add in 11 labs.
This time it's something that's going to take audio and convert audio into text or it's going to transcribe.
So we come up here and we're going to say we want text.
We want a speech to text audio to take audio and turn it into text.
So this is what we're going to do.
And uh, this is going to connect with our 11 labs account.
It defaults to that which is ideal.
And now I'll go back to the canvas and we have this.
And once this has gone to text I'm simply going to want to plug that into the agent.
Wow.
Could it be as simple as that.
So it's basically the webhook we're going to we're going to have a URL that we'll be able to post audio
to.
When we do, it's going to call 11 labs to turn that into text.
And it's going to send the text to the agent.
Now you're, you're you're you're spotting that I'm doing something bad here.
There's something I'm missing.
And we will we will try this out.
We'll see that fail.
And then we will fix it so that we can get it just right.
So the main thing we've done wrong is, you probably guessed, is that we haven't we haven't configured
these different steps to be correctly looking at their inputs and figuring out how they should interpret
their inputs to do the job they got to do.
So in this case, with this node, we haven't told it how to read into the input data and pluck out
what it needs.
And similarly for the AI agent, remember this thing.
It's expecting to be connected to a chat trigger.
And it's not.
And so it's going to get confused.
It's not going to find chat input.
The easiest way to fix this is to actually try it, see the data that comes in and then correct it.
And that's what we're going to do.
But first there's one more step to this flow that we have to add in.
And I'm just going to show you that now the last step we have to add in is all about what happens when
this webhook is called, what gets returned to the web page that called this webhook or the caller.
Whoever the caller is, it is going to be a web page, but it needn't be.
It could be something.
Right now, the way we've got this set up is to respond immediately, which means when you call this
webhook, it's going to respond with with like, okay.
And it's meanwhile going to be kicking off this flow.
Now, that's kind of useless because what we want to come back to the web page is going to be the audio.
We're going to want it to say something back.
So we don't want to respond immediately.
You can there's a few different options here, but we're going to do respond using respond to webhook
node.
Okay.
And what that means is that it's going to want us to add another node to the end of this.
Let me just hide all of this for a second.
Give ourselves some more room.
We're going to want to add in a node right here.
And this is going to be of type respond to webhook.
Here it is.
So this is something that can respond with whatever came back here.
And we can respond with first incoming item.
What we actually want to respond with is we want to respond with the, uh, with with the field data.
You see, the way this comes in with data, we're going to want to respond with a binary file, which
is the data that comes back here.
So that's what we want it to do.
Okay.
Uh, potentially we might need to add some stuff here.
We'll see if this this hangs together.
We're gonna we're gonna fix this up once we've got the flow all in place.
So to recap, if we come back here, let's do the tidy button to tidy this all up.
But very nice.
Here we see what's happening.
We've set up a webhook that little lightning bolt represents.
It's a trigger when someone hits the URL that we can collect from this from here, it will then turn.
It will then collect some audio.
Turn that into text by calling to 11 labs.
Put that into our agent.
It will then convert the output back into speech which produces an audio file, and it will use that
as the thing that gets responded back to this webhook, to this URL that someone else has hit.
You got that?
Click around, make sure you understand what each of these different nodes does.
And then we're actually going to to test this thing out.
So on my desktop I've just got a file that is called voice HTML.
And I will put that in the course resources so you can get it too.
And it's a very simple web page.
And here it is.
It is one where you type in a URL and then you press Start recording to record in the web page in,
in this case a Chrome browser.
And then you press stop.
And when you press send to N810, it will take this URL and it will post that audio.
And then with what comes back you'll be able to play that.
And it's simple HTML, it's just a raw HTML file.
And I could tell you that I painstakingly wrote this HTML file, but it would be a complete lie.
I simply asked in this case I usually use Claude code, but I just said to ChatGPT, can you make this
HTML page?
And it just did.
It knew that and it even put nice stuff like tip, use the URL while you're building and then switch
to the production URL.
I didn't ask it to do that, but it's quite right.
So good for it.
And you could also write this from scratch if you wanted.
Or just use mine.
I'll make that available.
Uh, okay.
And so with that we're now going to go to and find this URL, put it in here and give it a whirl.
And it's not going to work to start with because we're going to need to fix up the workflow.
But let's at least try that.