- [Instructor] So our agent has come a really long way.
We have already added three tools to our agent,
the knowledge tool
to gather information about the exhibition,
the calculator tool to calculate a price
for a given booth type,
and a quote generator tool
to actually create a quote in an HTML file.
The only missing piece now is a connection
to an email account
so the agent can actually also send out an email,
either directly through the client or store it as a draft
or send the client to our internal sales team
so they can actually follow up with that person.
Now, that's what we're gonna do now.
The good news is
we don't have to build this email integration from scratch.
In n8n, there are plenty
of pre-built email connectors available.
If you click Tools, you will see that under Other Tools,
there are lots of different integrations
to different email service providers.
If you want to connect it to a custom email integration,
you can use this Send Email tool,
which sends an email using a simple SMTP protocol.
For our purpose now, we will rely on a pre-built connector
that is using Gmail to send out the email.
So just look for Gmail at this tool,
and now you have the possibility to connect n8n
with your Gmail account.
Just select this dropdown and click Create New Credential.
For demo purposes, I highly recommend setting up
a new email account for this,
just for demonstration and learning purposes.
Once you have done that,
as I did it in my case here, you are connected to Gmail
and you can now automatically define which field should be
filled out by the AI.
We can leave the tool description
to be set automatically as a resource.
We don't select message, but we change it to draft
because we don't want n8n to send out emails right away.
For now, we just wanna see if everything is working.
And also at this point, it's quite a good idea
to have a human at least look over the emails
before they are being sent out to clients.
So as an operation, let's create a draft
and then define the different fields.
For example, the subject line,
we could either have AI generate that automatically,
or we could pre-fill it with a custom line
that is always being used as the subject line,
as for example, "Here is your quote."
This can be useful if you want to have more consistency
on especially things like a subject line.
You could of course, also specify a subject line
in the instructions of the prompt.
This will give you a higher probability
that the agent is actually using a subject line
as you define there.
So for now, I don't really care
about the subject line too much.
So I say that the model should define
this subject line parameter.
Next is the email type.
We can select between text and HTML.
In this case, I'm using HTML,
and I'm also letting the agent define the message for me.
If you check again the system prompt, you will see
that the system prompt contains some light instructions
on how the agent should formulate this email.
Of course, you could add your own templates here,
either in the instructions
or customize this message here according to your needs.
Now, there's one more thing we need to add,
which is the two email address.
So this is the email address that should be used,
and this is also something we want the AI agent to control.
So the AI agent should either add the email address
of the client here or the email address
of our internal sales department if the email should be
forwarded because maybe it's a very high-prospect leader,
they inquired for a really large booth size.
Now, let's close this for now
because this is everything we need
to set up the email integration.
And there you have it.
We have now four tools integrated into our agent.
We have the knowledge tool, the calculator tool,
the quote generator tool, and the Gmail tool.
And one quick heads up, of course, now we need
to at least have the email field defined
before we can actually send out an email
or the agent can use that.
So as I mentioned before, at some point we need
to tell the agent that this is a required field.
I added it here in the quote generator tool
where I added few more information about
what is the required information.
Since we need a quote before we can send out an email
and we now need an email
before we can generate a quote, everything is intact.
Just double-check that whatever you need in order
to call these tools is actually available
and you also let the agent know
that these fields are required at some point,
as I did here, for example, in the quote generator tool.
So let's close this and actually see the agent in action.