And you hardly need me to remind you that there are those two different integration patterns for connecting
11 labs with N10.
The first one is when N8 ends the bus and it calls out to 11 labs, the API, just to do the text to
speech and the speech to text.
And that is, uh, the other way round.
We start with the speech to text, and then later we do the text to speech.
But that's not the best way to do it.
The best way to do it is to let 11 labs be the boss, let it manage the voice agent itself, and let
it treat n810 like it's a tool.
The whole of the NGN flow is a tool, and the way that you treat N810 as a tool is by having a webhook.
And you're going to call out to that webhook from 11 labs, it's going to have a tool, the tool and
11 labs calls into ten, which has a webhook, followed by the workflow.
That is the strategy that's it's actually quite easy to set it up, but conceptually it's harder to
figure out exactly what's going on.
All of these, these sets of tools, a tool that calls a tool, uh, that, uh, that you have to hang
it together in your mind.
But when you do, it makes total sense, and it's clear how that's able to be a much lower latency solution,
because 11 labs gets to handle the speech conversion while it's running its tool, and so on.
So that's what we're going to do.
What we've set up in N810 is the going to be like our business logic.
Our back end flow that's going to be triggered by a webhook.
And that webhook is going to be called by 11 labs in a tool.
I wouldn't be doing my job if I didn't show you one more time.
The deeper terminology on APIs.
If you don't kill me.
I said we'd review it often.
So calling API is when we talk about the web, it's what we mean when we make a web request using HTTP,
we call the URL an endpoint.
And you'd say stuff like I'm calling API by making an HTTP request to an endpoint.
That's that's how we're connecting from an end to super base.
We're calling endpoints.
And if you're on the receiving end of it, the way to think of it in reverse, you could think of it
like a reverse API is if you make available a webhook and say, hey, you can call this webhook, like
call this API to alert me about something as like a trigger to kick me off and like I've got you've
had an email notify your your your flow, your workflow that an email arrived, a document was dropped
in the Google Drive.
All those things might call webhooks and you might say, hey, I've set up a webhook.
Please do a web request there to tell me about something happening, or I want to tell you when something
happens.
Please tell me your webhook.
Those are examples of how you might use that in a sentence.
And then there are different flavors of HTTP requests.
It's known as the method.
You probably remember.
You saw a bunch of them.
The most popular ones are get and post is usually used in APIs to fetch information.
Uh, get is what's used in the internet just to collect a web page as well.
But get in this context is used to to to pull information about something, usually in the form of JSON.
And post is when you you send information.
It was originally in the internet, used when you submit a form that does a post, and a post is used
in this, this API world to send information.
And in the body of this you include JSON to describe what you're sending.
So there's something called the body associated with an HTTP post that contains the JSON being sent.
And whilst you don't need to know all the technical details of how this works, it's just good to have
the gist of it to understand the basic terminology and constructs, so that when we select post from
that drop down, you have some sense of why we're doing it.
Okay, so here we are back with our workflow.
We've set up our question answer.
Maybe we should rename this as well Agentic because nice definitive name.
Here it is.
We deleted the chat thing.
What's missing.
What we need to add.
Of course, like you said out loud, did you say it out loud?
Uh.
Is, uh.
Yes the webhook?
Yes.
Yes yes.
Webhook.
Um.
Oops.
Web hook.
There we go.
We want a web hook like so.
Uh, and as before, you remember, it gives us the URL.
This is Nan publishing a webhook, a URL we can use to trigger this.
And I, we're going to pick post because it's sending in information.
You can see the other ones there that uh you don't need to know about them.
But but at some point we maybe we'll use some of the others.
Uh, and we don't want to respond immediately.
We want to respond using a respond to webhook node that we'll put in in just a second.
And let me see now.
Oh, is there anything else?
No.
That's it for here.
Uh.
That's good.
This is all set up nicely.
Okay, back we go.
Click and escape.
All right.
That is our webhook.
Look, we just need to attach it.
We should do that.
There we go.
Done.
And it puts the word post there just to reassure us.
Okay.
Onwards.
Now you know well enough now that that this won't work.
This thing right here.
Because this is going to be set up to expect this being a chat input.
Look, if I double click you can see connected chat trigger node JSON chat input.
That's not going to work.
And you know that we have to change this to be defined below.
And then we want to turn this to an expression.
And we want to pull in something here that's going to work.
And I don't know if you remember from what we did on day two, can you remember what I should put in
here, assuming I mean, I guess you have to know how I'm going to set it up in 11 labs, but assuming
I do it exactly the same way, can you remember, do you have notes?
If you're taking notes, you can go and quickly look right here it is.
So it's an expression of course.
So that means two curlies on either side.
So we want to take the JSON that's coming in JSON dot.
We remember when you do an HTTP post that it contains a body and JSON body will give us the body.
And we're going to put in that body a field.
And I guess we're going to call it question.
Again.
We might as well oops I spelled it right JSON question.
That's what we'll, we'll, we'll use.
And of course it can't tell us a result right now because we haven't actually run this yet.
So it doesn't know.
But but that's what we'll do.
So just keep in mind we're going to add question a field question to the body of what 11 labs submits
in its post to the webhook endpoint.
Say that three times in a rush.
All right.
Okay, back we go.
We've now set up the webhook and the agent to expect the data coming in.
What's left to do?
One thing left to do.
Yes, there's one thing left to do.
We need to add over here, type webhook again and find the respond to webhook.
Okay.
And you can just leave it at the defaults here.
It's going to respond with what comes out of that agent.
What comes out is some JSON with output in it.
And then the response.
And that's going to be just fine.
That will work great for what goes back to our agent.
It will handle that.
This this should all be good.
This is a genetic rag.
Press the save button if you haven't already.
You should always do Ctrl s command S you should do that regularly.
We have set this up.
Uh, and, uh, it remains for us.
Uh, well, we'll leave it a bit before we press that button.
It's time for us to go to 11 labs.
Remember that.
It feels like an age away.
Uh, two days ago, we were last there.
I think we're going to go back there now and set up the voice agent part of this.