Welcome to the first part of this lesson.
In this tutorial, I'm going to teach you how to build an MCP WhatsApp agent.
That is pretty amazing.
This agent can see written speak, so it can process and analyze images, and you can talk to it via
WhatsApp and it will respond with voice messages.
This agent can also fetch documents from your knowledge base or search the internet.
It's also connected to an MCP server, so you can ask it to manage your CRM and database.
In this example, it can read and send emails for you, manage your to do list or create social media
posts, and the MCP server can also be connected to AI tools like cloud, desktop app and cursor.
So you can use all these tools across different platforms.
Now let's do a quick demo.
First I'm going to send this dog photo.
And ask, what breed is this?
Now, as you can see, the worker is analyzing the image, is preparing the response.
Let's check.
The black and white and white dog in the image is likely a Boston Terrier or a French bulldog.
Alright, great.
Okay, now let's check if our agent can use DHCP server and help me manage my to do list.
Let's send a voice message.
Show me my current tasks, please.
But as you can see, audio is being transcribed now.
As you can see, the response is using Amqp client node Generating the voice.
Let's wait a second.
Let's listen to the response.
Here are your current tasks.
One.
Record a new tutorial.
Not completed.
Two.
Gym completed.
Three.
Read the book.
Not completed four.
Buy groceries five.
Feed the dog.
You have two tasks left to complete.
Recording the tutorial and reading the book.
Let me know if there's anything you'd like to do with them.
Excellent.
Now let's check my to do list.
As you can see, it's getting all my tasks from Airtable through the MCP connection.
I have two recording tutorial and read the book.
Now let's ask.
Please mark record a new tutorial.
As completed.
But I'm going to.
Test the workflow so you can see the flow.
I'm going to send the message.
Yes, indeed.
Using Amqp client.
Let's check.
Perfect.
Now, before we start building this workflow, let's learn how to set up a WhatsApp account to generate
API keys and all the credentials.
So it will be much easier later.
In order to connect our agents to WhatsApp, we need to set up a meta application first.
So let's head over to developers facebook.com and log in to your account.
Once you are logged in, you will see my apps at the top.
Click on that.
And then hit create app.
On the page that opens up.
Now we need to give our application a name.
I will call mine.
WhatsApp integration tutorial.
But you can name it whatever you like and also add your email.
In the contact field and click continue.
Click next.
Okay, certain terms like WhatsApp are not allowed, so I'm going to change it.
And click next.
Okay, great.
Next you will see different use case options.
So you want to select other from this list.
So just scroll down.
Select other and hit next.
Now on the following screen choose business since that's what we need for WhatsApp integration and confirm.
Go ahead and click create App to finish this step.
Perfect.
Now you will see a list of available products.
Look for WhatsApp in this list and click setup next to it.
And here is where you might need to create a business portfolio if you don't have one already.
So if the system asks for for this, don't worry, it's very simple to set up.
Just open a new tab and go to business.
Facebook.com.
Sign in with the same account, then look for the drop down menu on the left side.
Click on that, then click on Create a Business Portfolio.
From there.
It will ask you for basic information like your portfolio name and contact details.
So fill that out and create your portfolio.
Then come back to our app setup and select that portfolio from the drop down.
And click continue.
And now you should see WhatsApp appear in the left sidebar.
So click on that.
Click on API setup.
And we'll be coming back to this section several times.
The first thing we need to do is add our phone number for testing.
So under this to drop down click on Manage Phone Number list.
And then add phone number.
And follows the simple verification process to add your number.
You will get a code.
Alright, great.
Once that's done, select your number from the drop down.
Next we need to generate the access token.
So click on this button.
It might ask you to log in again.
So just reconnect.
This gives you Credentials.
We need to connect and they tend to WhatsApp.
Great.
Now let's test if everything is working.
So scroll down on this page until you see Set Message and click on this button and you should receive
a text message on your WhatsApp.
If you got that message perfect, our WhatsApp connection is ready and we can move.
We can move on to building our workflow.
Now there is something important to mention about this access token.
Right now we are working with a temporary token that expires every few hours.
So we need to refresh this token while we are building a Agents and automations in N810.
And this is totally fine for testing and development, but if you want to use this in production, you
will need a permanent access token.
And the reason we have this temporary tokens is because we are currently in development mode.
As you can see here.
For live application, you would want to upgrade to a permanent solution.
So to get a permanent token you need to verify your business with meta.
I won't go through the full verification process in this tutorial since it involves business documentation,
but this is also a very simple process.
You will need to go to your business portfolio and complete business verification.
So if you look at your business settings right here.
You will find.
Under business info.
Business verification status.
Just simply click on View details.
Guys.
And this takes you through Meta's verification process where you need to provide business information
and documentation.
So just simply click on Start Verification.
And once meta approves your business verification, you can then generate permanent API credentials
that won't expire.
For now, though, our temporary token works perfectly for building and testing our AI agents.
So let's continue with that.
Alright, now we can start building our WhatsApp agent.
So let me click on Create New Workflow.
I'll rename this workflow to.
WhatsApp MCP agent and click save To keep things organized.
Now for our trigger.
We need to search for the WhatsApp node.
So click on this plus button to open nodes panel.
Search for WhatsApp.
And click on this WhatsApp business cloud.
Now as a trigger we are going to choose on messages.
And next we need to set up our credentials.
So click on the dropdown Create New credential.
And now as you can see we need to provide client ID and client secret.
So we need to grab our app details from meta for the connection.
So let me go back to our meta dashboard.
Now under settings.
Click on basic.
So here I can copy the app ID and I will pass this into the client ID field.
Then I'm going to simply copy it.
And paste it right here.
And the same for App Secret.
So I need to click show.
Then copy that and paste it to the client secret field.
It might ask you to login to your Facebook account again.
So just simply reconnect.
Copy up secret.
Go back to ten and paste it into this field.
Hit save.
Perfect.
I can see the connection successful message, which means our workflow can now receive WhatsApp messages.
So I will close the credential window and test our setup.
So let me click Execute Workflow to start monitoring for incoming messages.
And now I'll switch to.
And now I will switch over to WhatsApp and send a simple message like.
Hi there.
Now let's see.
Great.
I can see we successfully captured that message.
And now when I open this WhatsApp sugar node.
Switch over to schema.
I can see there is a tons of information that WhatsApp provides.
Now the important part for us is the messages object, which holds the actual message content that we
process with our agent.
Okay, perfect.
Let's move on.
Now let's set our agent component.
So let's click on this plus button to add the next node.
AI agent.
Now for the prompt, let's select define below.
For the user message, I need to pull in the content from our WhatsApp trigger.
So let me click on the.
Messages.
Then from the text object, let's select a body value and drop it to this field.
Alright, perfect.
Now we need to add a large language model as a brain for our agent.
So I need to configure the language model.
So simply click on this plus button.
I will use OpenAI for this and stick with GPT for our model.
So I'm going to switch over to the older version because it's cheaper.
All right.
Perfect.
Now let me test this basic setup by executing the node.
Let's have a look.
And as you can see our agent responds with a standard greetings like hello, how can I assist you today.
So now let's make this more personalized by adding a system prompt.
So click on add option.
System message.
And by default you have you are a helpful assistant.
So I'll switch over to expression mode.
And create a custom system message.
So I will start with.
Your helpful assistant named Alex.
Let me expand this.
All right.
Great.
But I want to make this even more personalized.
So let me also include who the agent is talking to.
So I can grab the contact name.
Under contacts.
And from the profile object.
And paste and drop it right here.
And you can add prompt like you are currently speaking.
With.
All right.
Great.
Um.
We can also give the agent context about the current time.
So let's say the current date and time is open.
Double curly braces.
Choose now dot two ISO.
You can also expand this prompt as you wish.
Let's say always respond.
In a warm and helpful manner.
All right.
Great.
So now I want to add conversation memory.
So our agent remembers previous messages.
So let me add.
A simple memory.
So it stores in memory.
So no credentials required.
All right.
So for the session ID I will use the phone number since that uniquely identifies each user.
So for the session ID defined below.
Switch to expression.
So I will set this to pull the mobile number from our WhatsApp data.
So simply take this mobile number as the key.
All right.
For the context window I will set it to remember the last 15 messages.
Um, so that should give us good conversation continuity without using too much memory.
Alright, perfect.
Now our agent has memory and personality.
I'm going to hit save.
Now we need to send the agent's response back to WhatsApp.
So let me add another node.
Let's search for WhatsApp.
Send message because we want to send message back to the user as an action.
And this nodes.
This node needs its own credentials for sending messages.
So I will create new credential.
And call it call this node WhatsApp.
Reply.
Now we need two pieces of information here.
The access token and the business account ID.
So let me switch back to our dashboard and go to the WhatsApp API configuration.
So in the sidebar click on WhatsApp API setup.
And as you can remember here we can generate access token generate access token.
Now meta might ask you to log in to your Facebook account again.
So just simply reconnect.
Copy the access token.
Go back to N810 and paste it right here for the Business Account ID you can find that right here on
the same page.
As you can see WhatsApp business account ID, simply copy it.
And paste it into this field.
And hit save.
Perfect.
So if everything is configured correctly we should see a green connection status.
But if you get an error here, it's likely because the access token expired.
And remember these tokens are temporary.
So just regenerate it in meta and update N810.
Now let's configure this node.
Now we need to configure this node.
If you don't have a data in your flow just simply test workflow and send some message on WhatsApp.
Right.
The operation should stay as send message.
So for the send the phone number I will select my number.
But you can also select the test number for the recipient.
I need to grab the phone number from our incoming WhatsApp message.
So let's expand this node.
You can get the number from messages and from value over here.
Drag and drop it right here into this field.
Right.
Great.
Now I will put the response from our agent node.
That's the text we want to send back to the user.
So simply grab this output and drop it into this field.
All right.
Now let's test this node to see if it works.
So execute step.
All right.
Excellent.
I can see any errors and the output data right here.
So now let's check my WhatsApp.
Now let's check my WhatsApp.
All right.
Great.
I got a message.
Hello test I'm Alex.
I'm here to help you with anything you need.
What's your mind today?
All right.
Perfect.
We now have a working agent connected to WhatsApp.
The basic conversation flow is complete, but there is so much more we can do with this setup.
Now let's extend our agent to handle more than just text.
So in WhatsApp, users can send voice messages, images and documents.
So we need to build logic to process these different input types.
So I'm going to make a few changes to our workflow, and everything will become clear as we build this
out.
So our agent won't pull text directly from this WhatsApp trigger.
Anymore because users might send audio or images instead of text messages.
So I will add in the middle I will add a set node.
So let's search for set node.
I'm going to name this node.
Text handler.
And I will add just one field called text.
Where will where will you map the text content from our WhatsApp trigger?
So click on add field.
Username.
Text.
And it's pretty simple as a value we need to add this body value.
So hello.
So this is our text we received on WhatsApp.
Yes we received this text from WhatsApp signal.
All right.
Now let let me execute this note to to test it.
So execute step.
All right.
Perfect.
Now in the agent node I need to change the prompt Homes to use this text field from our set node instead
of the original trigger node.
So let's open agent node.
So now in the agent node let's replace this prompt.
Remove this with the text property from the set node.
Alright great.
And now when I test this by sending a WhatsApp message, everything should work the same.
So click on execute workflow.
Send message.
But actually we get an error.
So there is a problem with the memory node.
And this happened happens because the memory is looking at the node right before the agent which is
now our set node, not the WhatsApp signals.
But our set node doesn't have the contact information we need.
So I need to fix this by pointing back to our WhatsApp trigger node.
I'm going to update the session ID using an expression.
So let's open supplementary node.
Let's remove this.
Because as you can see this JSON is referring is referencing to the contacts which is in the object
from the WhatsApp trigger node right here.
So this is the number we are looking for.
Yeah.
As you can see there was a trigger node includes this contacts object with the WhatsApp number.
so we have to fix it.
So let's remove this.
Yes.
So just to clarify, the JSON is referring to the node just before the A agent which is this one.
Text handler.
But this one.
But this node doesn't contain the.
This object.
So what we need to do we need to map the values.
So let's remove it.
I will update the session id using an expression.
So let's expand it.
Let's open double curly braces.
Let's choose the node.
So what's up sugar.
That's a dot item, so select the first from suggested dot.
JSON dot messages.
And since this gives us an array, I will grab the first item and use the from field which has the phone
number.
And zero because in programming we start counting from zero.
and.com.
Because if you check the.
What's up trigger node.
You can see that from contains our WhatsApp number.
Alright.
Perfect.
Now let's test this workflow again.
So execute workflow.
Let's send simple message.
Hello.
And now as you can see, this time we got our response back perfectly.
I know it seems like you might be trying to get my attention.
How can I help you today?
Great.
When we open the WhatsApp business cloud node.
We can see the output from our agent, which is an input to our WhatsApp node.
And the text body.
Hello.
It seems like you are maybe trying to get my attention.
So this is the response from our agent.
Alright.
Perfect.
Now let's see how our workflow handles voice messages.
So click on Execute Workflow and I'm going to record an audio message.
Can you explain to me why the context protocol is so cool.
Back then.
So let's ignore this error for now.
But let's examine what data we receive from WhatsApp.
Now.
When someone sends audio looking at the messages, we can see that this is an array.
And we now get an audio object right here With completely different properties compared to the text
messages.
So this shows us we need to build conditional logic to handle different message types.
So whether someone sends text, voice notes or images.
So to handle these different scenarios I will add a switch node right after WhatsApp trigger node.
So let me search.
The search node between these two nodes.
So search for switch node.
So for example for the voice message path I will check if this audio object is present.
So let me set up that as the value.
So let's grab this audio object and drop it into the value field.
And now I will change this dropdown to object and exist because.
Because we are checking if this object saw the audio message exists in the flow.
Alright, perfect.
Now let's rename the output.
So when this condition is met we'll go down this path.
So I'm going to rename this output to Voice or Audio.
All right.
So now we've got this single voice output.
So I will also create the route for the text message.
So let's text.
So let's execute the workflow.
And in WhatsApp.
Let's send short message this time.
Text message either.
Then back in 2010 let's create another route.
So in the switch node.
Now we've got text object.
So let's create another route.
So click on adding a routing rule.
Let's grab this text object.
Drop it right here.
And the same let's switch to object.
Let's check if it exists.
Let's rename this output to text.
So if the text exists we wrote down the text path.
So now I need to remove the original connection.
Because it's the text path that should connect to our existing workflow.
So text handler.
So connect these two nodes.
Let's also be prepared and create a route for images.
So let me click Execute Workflow.
And I will upload any picture like.
Photographs.
Like this one.
Now back in our switch node.
So let's create another routing condition.
So for this scenario we get this image object to add routing rule.
Grab the image object.
Drop it right here.
Object.
We check if it exists.
Rename output to image.
So again we say that if the image object exists, then we wrote down this path, which will, uh, which
we call image.
All right.
Now let's, uh, build out the voice processing code.
So let me get some fresh data by going back to WhatsApp and recording short voice message.
So first execute workflow.
Hi.
How are you doing?
All right.
So now in N810, I can see the voice path is now being activated.
As you can see here, the voice object, uh, the audio object is green.
So now I don't want to keep sending messages every time I test this workflow.
So I'm so what I'm going to do I'm going to pin this data by clicking.
What's up trigger and pin icon.
So now I can easily retest this workflow by clicking Execute Workflow.
And it will use the pinned data.
So the same voice message I just sent.
The first step is to download that audio file.
So let me search for.
WhatsApp business cloud.
So WhatsApp.
And select download Media as an action.
So let me rename this node to.
We get audio.
File.
Make sure your WhatsApp account is connected and connected and you are using the same credentials as
for the other WhatsApp nodes.
In this workflow.
Next, make sure media is selected under resource and as operation.
We want to download the file.
Now we need to provide media ID so you can get it from the audio object.
Like that.
Now when I test this step.
So let's execute step.
As you can see, it gives me a URL.
So this is protected URL though.
So if you try to access it directly you will get an authorization error.
So when you copy this link and paste it into the browser.
You will get this authentication error.
All right.
Next I need to use that URL to actually download the file.
So let me add.
An HTTP request node.
So click on this plus button.
Let's organize it.
Okay.
All right.
Perfect.
So now let's add an HTTP request node to search for HTTP request.
Now into the URL field let's add this URL.
Now under the authentication.
I will select generic credential type.
And for the generic of type I will add an off header.
So header off.
Now let's create a new credential.
So click on this small pen.
For the name.
Leave it as it is.
So it has to be authorization and it needs to be spelled correctly exactly like this.
And for the value I'll switch over to the expression mode.
Expand it.
Remove it.
Type beta space.
Followed by my access token.
So I need to go back to my meta dashboard to grab my access token.
Just simply copy it.
And paste it right here.
Now let me save.
Perfect.
Now let's test our workflow.
So you can just test this specific node.
And I've got an error.
All right.
Let's fix it.
You can always use built in assistant for troubleshooting.
So let's let's see what it suggests.
So starting session it's analyzing the error.
Now.
Let's wait a moment.
Okay.
The error message.
Authorization failed.
Please check your credentials.
Authentication errors indicates that the HTTP request node is not able to authenticate with the larger
with the target server using the credentials provided.
Check the value set in your HTTP header or credential.
All right.
In case you don't understand the suggested solution, you can always copy it.
Go to the large language model of your choice, for example to ChatGPT.
Um, give it a role.
For example, I want.
You to act.
As.
An expert.
Paste the error.
Or the suggested solution.
And ask it to explain it to you step by step.
Step by step.
Fix up your workflow in return.
Check the authentication setting in the node.
Go to credentials.
Open the header of credential.
Confirm token is valid right?
So I hope I showed you how you can easily troubleshoot errors in N810.
I'm going to add the HTTP request Note once again, so search for HTTP request node.
Let's paste the URL right here as a notification.
Let's select generic credential type.
Header off the type.
I refresh my credentials.
And now let's execute this step once again.
All right perfect.
Now I have the actual audio file downloaded on the right side.
And you can view it listen to it.
You can download it right here.
I will rename this node to audio.
Now that I have the audio file, I need to transcribe it to convert the speech to text.
So let me add an open AI node.
Because we are going to use their model.
Now I will create a set node.
So let's search for set node.
And add a field called text.
With the transcribed audio as the value from the previous node.
Named text.
Now let me run this step.
And rename this node to audio handler.
Alright.
Perfect.
Finally, I will connect this node to our agent.
Now important note the field name needs to match between our text processing and audio processing.
So both text handler and audio handler should use text as the field name.
So the agent can process either input the same way.
So make sure the name of this of this field is text.
And match this one for text.
Alright.
Perfect.
And now when I run the agent.
It will be able to reply to me in a text format, even though I trigger it using a voice message.
So the agent is now processing input from this audio branch instead of the text branch.
Now if you want to, you could also make the agent respond with voice message.
And to me this is pretty logical.
If someone sends a voice note, they're probably busy or driving or something, so they would expect
a voice response back too.
So this is actually quite simple.
All we need to do is add an if node to determine whether we should send audio or text back.
So between the agent node and WhatsApp.
Um, let's add if node.
All right.
And in this if node I want to detect if we got audio from the WhatsApp trigger.
So let's expand this node.
So WhatsApp trigger node.
Let's grab the audio object.
And drop it right here.
So if we did get audio we will send audio back.
If not we'll just send text like normal.
So let me configure the condition to check our WhatsApp trigger node for an audio object.
So let's switch to object and exists.
True means we send audio.
Photos means we send text.
So I actually need to disconnect this existing link.
Because when the condition is false.
So no audio object.
We want to go with our standard text response.
And now let's rename this node to.
Send text.
Now how do we generate the audio response.
First step is to take the output from our agent and turn it into speech.
First let me execute this if node.
Alright, good.
Is taking that true branch since we sent a voice message.
We've got one item, as you can see here.
From here let me add an OpenAI node.
So click on this plus button.
Search for OpenAI.
And we're looking for generate audio.
So I will pull the response from our agent.
First let's expand the AI agent node.
And we've got an output here.
Let's drop it in the into the text input.
Now let me test this step.
So execute step and we get an audio file.
You can view it download and listen to it.
And here you can pick different voices if you want.
I will go with Nova.
So yeah if you want to experiment with different voices you can change that option and run the step
again and hear how it sounds.
So let me rename this node to Generate voice.
Great.
Now I need to send this audio through WhatsApp.
So let me add another WhatsApp business cloud node.
Search for WhatsApp.
To send message.
Now, as the sender phone number, I will pick my number.
But you can also select the test number and you also need to enter the recipient number.
So switch over to schema view from the binary to schema and from the WhatsApp trigger node.
And the messages.
Pick from number and drop it right here.
Great.
Now this is critical step for the message type.
I need to switch this from text to audio.
Then I will set Take audio from 2010.
So it uses the audio file from our previous step.
And now when I test this step.
It's a good step.
There is a problem.
Because we got an error about the Mime type being wrong.
So we are sending audio to MP3, but WhatsApp won't accept that format.
So we need to fix the Mime type to something WhatsApp likes.
So let me add a code node between these two steps.
So to clarify this node is going to grab this binary file and the WhatsApp is not going to accept this
format.
So we need to add the code node right here between those two nodes.
So search for code.
So I will put JavaScript code in the description.
And it will check for for a binary file and changes the Mime type from audio mp3.
So as you can see our Mime type is in audio mp3.
And we need to change it to audio amp.
So I'm going to paste the code snippet right here.
Just remove all of this.
And now as you can see we also have a comment.
So this line loop over input items and change the Mime type of binary data.
Then it checks if the item has a binary data.
Then this line finds the binary property name and if the Mime type is audio mp3.
So the format we just got in our audio file, it changes to audio MPEG.
So that's what this code does.
Okay.
So now let me let me test this test this step.
So on the left you see the original file with audio mp3 Mime type.
And on the right it's we change it to audio MPEG.
So now.
When I run the WhatsApp step again.
It works perfectly.
And we got our voice response in WhatsApp.
Okay, great.
Hi, I'm doing well.
Thank you for asking.
How are you?
If there's anything you need help with, feel free to let me know.
Well, I think I've just noticed that accidentally renamed.
If not instead of this WhatsApp output node.
So let's change it.
This is our if condition.
Verify logic.
Let's rename this node to.
Respond with audio.
And this one.
Respond with text.
Perfect.
Next we are going to tackle image processing.
So first thing I need to do is unpin this data.
So on the WhatsApp trigger node.
Click on pin.
And now I will send an image from WhatsApp.
First click on Execute workflow.
I'm going to.
Send this image.
All right.
Workflow executed successfully.
So actually I forgot to ask some question.
So let's do it again.
Let's send the same image.
And ask, what do you see?
In this image?
And send it.
All right.
So back in this image workflow is now triggered.
So I'm just going to move all the audio nodes up here.
Image here okay.
So I'm just going to add another node.
So I will search for WhatsApp Business Cloud again.
So type WhatsApp.
Select this node.
And now we want to download media.
So we want to download this image.
Now in our WhatsApp note.
So scroll down.
Expand this node.
All right.
Actually from switch node.
Yeah from switch node.
Let's grab the image ID.
Which is right here.
And drop it here.
Or not.
We successfully connected our credentials area.
All right.
Perfect.
Now let's rename this node to.
Get That image link.
Now let's run this step.
So execute step.
And just like with audio we get a URL back.
So I'm sure you can guess what's next.
We need to add an HTTP request node the same like here in audio processing.
So I'm going to move it here.
Search for http request node http.
So we will be able to actually download the image.
So I will add the URL to the other field.
Relief methods get.
Now under authentication.
I will select generic generic credential type.
Then the type we need header off and use the same header credentials we created for the audio section.
It should be set up automatically.
But remember every few hours you might need to refresh your WhatsApp credentials unless you verify your
business.
All right.
So now let's execute this and we get our image.
We should get our image back.
Yes.
Perfect.
We can view it.
Awesome.
Now I'll rename this node to the root image.
And hit save.
Now let's use AI to examine this image.
So I will search for OpenAI.
And then the action.
And under image actions.
Let's select analyze image.
Let me rename this node to analyze image.
All right.
Make sure your OpenAI account is connected for the model.
Let's select.
The ChatGPT for latest and for the text input.
I will say something like please.
Describe.
This image.
All right.
Now we need to change the input type to binary file.
So it grabs the image from our previous step.
Now let's test this step.
And we get we should get a comprehensive analysis of the image.
Let's check it.
Let's switch over to the table view.
This is a vibrant and joyful other image of two German Shepherd dogs, one adult and one puppy running
across.
All right, so as you can see, this is very detailed description of this image.
Perfect.
Now we need to create a prompt that combines this with any text the user sent.
So let's add a set node.
So the search for set mode.
And in the set mode I'm going to add a text property.
And switch over to expression mode.
Let's expand this value field and add something more detailed.
So I will say the user.
So remember this is the prompt to our agent.
So the user shares the following image.
And message.
Great.
Now under.
I didn't switch to expression, that's why.
Okay, so switch over to expression first and expand it.
Let's change it to.
Text to make it clear.
Okay.
So now the.
Now let's say image analysis.
And let's grab the content.
And drop it right here.
So this is the description from our analyze image node.
So for any text the user included I will pull that in as a user request.
So now this is, um, here is something important.
If you look at the image object in our WhatsApp trigger node.
We get the image ID which we use for downloading, but we also get the caption property.
So this is optional though by users don't have to include text with their images.
So we set the user message to this caption.
This caption value.
But if this property doesn't exist, I want it to fall back to a default.
Yes.
So as I said, let's set the user message to this caption value.
So just simply grab the caption and drop it right here.
But if this property doesn't exist.
So for example, if I.
It won't send this caption along with the image.
I want it to fall back to a default.
We can do this by adding double pipes.
And then within the course let's say something like describe.
This image in detail.
And this way if the user doesn't ask a specific question.
While uploading the image into the WhatsApp, our agent will just describe what it sees.
Now let's rename this node.
To image prompt.
All right.
Great.
And finally let's connect this to our agent as well.
Like that.
Now let's clean it a bit.
So I'm going to move this image part to the left.
Okay great.
So let's test this out.
I'm going to click on Execute Workflow and send an image from WhatsApp.
First I want to include any text, so it should use our fallback prompt.
I hit send.
Okay I need to refresh my credentials.
So as always go to your dashboard.
Copy Accesstoken.
And refresh your credentials.
I'm writing to generate the access token.
And paste it right here.
It's safe.
Perfect.
Now let's pin data so I don't need to upload the image again.
And execute workflow.
The same for this node.
Need to refresh credentials.
It's going to copy it.
Expression.
But a.
Safe.
Execute again.
Now you can see it's analyzing the image.
So now our agent is processing it okay.
And responding with text.
Yep.
So in WhatsApp let's open WhatsApp.
I forgot to unpin the data.
So let's open it.
All right.
Great.
Now let's go back to our WhatsApp.
Let's send the same image.
Okay.
How old?
Do you think?
The puppy is.
Of course.
We need to test the water first.
And send it.
Okay.
The water.
Analyzing the image.
Now.
Now our agent is preparing the response.
Let's check.
From the description, it sounds like the German Shepherd puppy is likely around 8 to 12 weeks old.
At this age, puppies typically display a mix of Characteristics such as soft, fluffy coat, playful
energy and one ear that may not yet be fully erect, which aligns with what you have described.
Okay.
That's perfect.
Now back in ten.
So yes, the image gets analyzed and our agent responded to our specific question instead of just describing
everything.
So what we can do now is activate this workflow so we don't have to click test execute workflow every
time.
So now make it active.
Confirm.
And now that it's active we can just chat normally.
So let me send.
Hello.
And we get a response.
Hello.
How can I assist you today?
Okay, it's working fine.
Now let's test our agent's memory.
So I'm going to.
Say something like, uh.
My name is.
Damien, I like dogs.
Hi.
Damien is great to meet you.
Dogs are wonderful companions.
Do you have a dog or is there a particular breed you like the most?
All right, now let's ask what's my name?
It's nice to chat with you.
All right.
Perfect.
Now, let's quickly test voice messages.
So the audio processing path I'm going to ask our agent.
Do you like dogs?
I think dogs are wonderful.
They bring so much joy and companionship to people's lives with their loving nature and playful spirits.
Each dog has its own personality, and it's heartwarming to see the bond they create with their humans.
What do you enjoy most about dogs?
That's absolutely true.
Right now, I'm not going to dive into adding more tools in this lesson, but quickly you can click
Add Tools.
And access hundreds of tools and offers.
However, in the next lesson, I'm going to teach you how to build an MVP server and add tools to read
and send emails and manage your to do list, and also how to generate posts on social media channels
and how to connect the WhatsApp agent we just created to our MVP server.
So it will be able to do all these tasks for you.
All right, that's it for this tutorial.
Thank you for spending time with me.
I hope you learned something new and see you in the next lesson.