WEBVTT

00:00.120 --> 00:02.200
Welcome to the first part of this lesson.

00:02.360 --> 00:07.280
In this tutorial, I'm going to teach you how to build an MCP WhatsApp agent.

00:07.280 --> 00:08.560
That is pretty amazing.

00:09.240 --> 00:17.480
This agent can see written speak, so it can process and analyze images, and you can talk to it via

00:17.480 --> 00:20.640
WhatsApp and it will respond with voice messages.

00:20.760 --> 00:25.880
This agent can also fetch documents from your knowledge base or search the internet.

00:25.880 --> 00:32.200
It's also connected to an MCP server, so you can ask it to manage your CRM and database.

00:32.480 --> 00:40.520
In this example, it can read and send emails for you, manage your to do list or create social media

00:40.520 --> 00:49.400
posts, and the MCP server can also be connected to AI tools like cloud, desktop app and cursor.

00:52.040 --> 00:55.000
So you can use all these tools across different platforms.

00:55.240 --> 00:56.480
Now let's do a quick demo.

00:56.520 --> 00:58.920
First I'm going to send this dog photo.

01:01.390 --> 01:03.510
And ask, what breed is this?

01:07.510 --> 01:12.790
Now, as you can see, the worker is analyzing the image, is preparing the response.

01:14.830 --> 01:15.550
Let's check.

01:17.990 --> 01:22.590
The black and white and white dog in the image is likely a Boston Terrier or a French bulldog.

01:22.950 --> 01:23.750
Alright, great.

01:26.350 --> 01:31.670
Okay, now let's check if our agent can use DHCP server and help me manage my to do list.

01:34.270 --> 01:35.670
Let's send a voice message.

01:40.750 --> 01:42.550
Show me my current tasks, please.

01:49.070 --> 01:51.350
But as you can see, audio is being transcribed now.

01:53.030 --> 01:59.260
As you can see, the response is using Amqp client node Generating the voice.

02:02.140 --> 02:03.220
Let's wait a second.

02:04.140 --> 02:05.660
Let's listen to the response.

02:06.420 --> 02:07.940
Here are your current tasks.

02:08.260 --> 02:08.660
One.

02:08.660 --> 02:09.980
Record a new tutorial.

02:09.980 --> 02:11.100
Not completed.

02:11.140 --> 02:11.660
Two.

02:11.900 --> 02:13.380
Gym completed.

02:13.380 --> 02:13.980
Three.

02:14.020 --> 02:14.740
Read the book.

02:14.780 --> 02:16.180
Not completed four.

02:16.340 --> 02:18.540
Buy groceries five.

02:18.740 --> 02:19.620
Feed the dog.

02:20.340 --> 02:22.500
You have two tasks left to complete.

02:22.740 --> 02:25.300
Recording the tutorial and reading the book.

02:25.500 --> 02:27.700
Let me know if there's anything you'd like to do with them.

02:28.900 --> 02:29.580
Excellent.

02:29.620 --> 02:31.340
Now let's check my to do list.

02:32.740 --> 02:37.260
As you can see, it's getting all my tasks from Airtable through the MCP connection.

02:37.740 --> 02:39.940
I have two recording tutorial and read the book.

02:40.420 --> 02:41.300
Now let's ask.

02:43.500 --> 02:50.380
Please mark record a new tutorial.

02:54.300 --> 02:55.180
As completed.

02:59.760 --> 03:00.880
But I'm going to.

03:03.040 --> 03:04.640
Test the workflow so you can see the flow.

03:07.840 --> 03:09.200
I'm going to send the message.

03:15.200 --> 03:16.240
Yes, indeed.

03:16.240 --> 03:17.600
Using Amqp client.

03:20.080 --> 03:20.800
Let's check.

03:22.800 --> 03:23.440
Perfect.

03:23.800 --> 03:30.840
Now, before we start building this workflow, let's learn how to set up a WhatsApp account to generate

03:30.840 --> 03:33.680
API keys and all the credentials.

03:33.880 --> 03:35.560
So it will be much easier later.

03:36.120 --> 03:42.560
In order to connect our agents to WhatsApp, we need to set up a meta application first.

03:43.160 --> 03:49.920
So let's head over to developers facebook.com and log in to your account.

03:50.600 --> 03:55.910
Once you are logged in, you will see my apps at the top.

03:56.710 --> 03:57.630
Click on that.

04:04.750 --> 04:06.430
And then hit create app.

04:06.470 --> 04:07.830
On the page that opens up.

04:12.190 --> 04:14.710
Now we need to give our application a name.

04:15.230 --> 04:16.670
I will call mine.

04:22.390 --> 04:27.390
WhatsApp integration tutorial.

04:30.030 --> 04:35.230
But you can name it whatever you like and also add your email.

04:43.830 --> 04:46.150
In the contact field and click continue.

04:46.830 --> 04:47.630
Click next.

04:52.670 --> 04:56.380
Okay, certain terms like WhatsApp are not allowed, so I'm going to change it.

05:00.820 --> 05:01.740
And click next.

05:02.460 --> 05:03.340
Okay, great.

05:03.940 --> 05:06.700
Next you will see different use case options.

05:06.860 --> 05:09.940
So you want to select other from this list.

05:10.420 --> 05:11.580
So just scroll down.

05:15.500 --> 05:18.860
Select other and hit next.

05:21.620 --> 05:30.420
Now on the following screen choose business since that's what we need for WhatsApp integration and confirm.

05:32.980 --> 05:36.580
Go ahead and click create App to finish this step.

05:37.300 --> 05:38.020
Perfect.

05:38.060 --> 05:40.580
Now you will see a list of available products.

05:41.620 --> 05:46.140
Look for WhatsApp in this list and click setup next to it.

05:51.820 --> 05:56.850
And here is where you might need to create a business portfolio if you don't have one already.

05:56.930 --> 06:01.890
So if the system asks for for this, don't worry, it's very simple to set up.

06:02.210 --> 06:05.530
Just open a new tab and go to business.

06:05.810 --> 06:06.850
Facebook.com.

06:07.490 --> 06:12.490
Sign in with the same account, then look for the drop down menu on the left side.

06:14.290 --> 06:18.690
Click on that, then click on Create a Business Portfolio.

06:18.810 --> 06:19.490
From there.

06:22.570 --> 06:27.810
It will ask you for basic information like your portfolio name and contact details.

06:28.210 --> 06:31.130
So fill that out and create your portfolio.

06:34.370 --> 06:38.490
Then come back to our app setup and select that portfolio from the drop down.

06:41.410 --> 06:42.610
And click continue.

06:44.370 --> 06:47.370
And now you should see WhatsApp appear in the left sidebar.

06:48.250 --> 06:49.650
So click on that.

06:52.270 --> 06:53.950
Click on API setup.

06:58.310 --> 07:01.750
And we'll be coming back to this section several times.

07:02.270 --> 07:06.030
The first thing we need to do is add our phone number for testing.

07:06.790 --> 07:12.670
So under this to drop down click on Manage Phone Number list.

07:14.870 --> 07:16.270
And then add phone number.

07:18.430 --> 07:22.030
And follows the simple verification process to add your number.

07:22.710 --> 07:24.350
You will get a code.

07:24.790 --> 07:25.670
Alright, great.

07:30.550 --> 07:33.630
Once that's done, select your number from the drop down.

07:38.670 --> 07:42.630
Next we need to generate the access token.

07:43.230 --> 07:44.430
So click on this button.

07:44.710 --> 07:46.750
It might ask you to log in again.

07:46.750 --> 07:47.830
So just reconnect.

07:48.110 --> 07:51.180
This gives you Credentials.

07:51.180 --> 07:54.540
We need to connect and they tend to WhatsApp.

07:56.100 --> 07:56.580
Great.

07:56.620 --> 07:58.900
Now let's test if everything is working.

07:59.220 --> 08:07.060
So scroll down on this page until you see Set Message and click on this button and you should receive

08:07.100 --> 08:08.980
a text message on your WhatsApp.

08:10.700 --> 08:15.100
If you got that message perfect, our WhatsApp connection is ready and we can move.

08:15.660 --> 08:18.020
We can move on to building our workflow.

08:18.260 --> 08:22.180
Now there is something important to mention about this access token.

08:23.700 --> 08:28.300
Right now we are working with a temporary token that expires every few hours.

08:29.460 --> 08:36.060
So we need to refresh this token while we are building a Agents and automations in N810.

08:36.980 --> 08:43.460
And this is totally fine for testing and development, but if you want to use this in production, you

08:43.500 --> 08:45.740
will need a permanent access token.

08:46.380 --> 08:51.930
And the reason we have this temporary tokens is because we are currently in development mode.

08:52.330 --> 08:53.330
As you can see here.

08:55.450 --> 09:01.370
For live application, you would want to upgrade to a permanent solution.

09:01.970 --> 09:06.530
So to get a permanent token you need to verify your business with meta.

09:07.850 --> 09:13.730
I won't go through the full verification process in this tutorial since it involves business documentation,

09:14.170 --> 09:16.290
but this is also a very simple process.

09:19.130 --> 09:23.490
You will need to go to your business portfolio and complete business verification.

09:26.170 --> 09:29.170
So if you look at your business settings right here.

09:34.170 --> 09:35.130
You will find.

09:37.330 --> 09:38.650
Under business info.

09:41.450 --> 09:43.130
Business verification status.

09:45.330 --> 09:47.250
Just simply click on View details.

09:47.250 --> 09:47.320
Guys.

09:53.840 --> 09:59.080
And this takes you through Meta's verification process where you need to provide business information

09:59.080 --> 10:00.160
and documentation.

10:00.400 --> 10:02.440
So just simply click on Start Verification.

10:03.200 --> 10:09.160
And once meta approves your business verification, you can then generate permanent API credentials

10:09.160 --> 10:10.360
that won't expire.

10:10.480 --> 10:16.560
For now, though, our temporary token works perfectly for building and testing our AI agents.

10:16.560 --> 10:18.000
So let's continue with that.

10:21.920 --> 10:25.480
Alright, now we can start building our WhatsApp agent.

10:26.120 --> 10:28.960
So let me click on Create New Workflow.

10:33.480 --> 10:35.160
I'll rename this workflow to.

10:38.800 --> 10:47.940
WhatsApp MCP agent and click save To keep things organized.

10:48.660 --> 10:49.780
Now for our trigger.

10:49.820 --> 10:51.900
We need to search for the WhatsApp node.

10:51.900 --> 10:57.380
So click on this plus button to open nodes panel.

10:58.660 --> 11:00.460
Search for WhatsApp.

11:03.620 --> 11:05.940
And click on this WhatsApp business cloud.

11:09.180 --> 11:13.700
Now as a trigger we are going to choose on messages.

11:16.980 --> 11:19.380
And next we need to set up our credentials.

11:21.620 --> 11:24.980
So click on the dropdown Create New credential.

11:25.580 --> 11:28.820
And now as you can see we need to provide client ID and client secret.

11:32.460 --> 11:36.140
So we need to grab our app details from meta for the connection.

11:36.740 --> 11:39.620
So let me go back to our meta dashboard.

11:48.650 --> 11:50.250
Now under settings.

11:51.970 --> 11:53.010
Click on basic.

12:04.810 --> 12:08.930
So here I can copy the app ID and I will pass this into the client ID field.

12:09.330 --> 12:13.370
Then I'm going to simply copy it.

12:17.050 --> 12:18.250
And paste it right here.

12:23.610 --> 12:25.330
And the same for App Secret.

12:30.890 --> 12:32.250
So I need to click show.

12:34.130 --> 12:37.170
Then copy that and paste it to the client secret field.

12:39.330 --> 12:43.330
It might ask you to login to your Facebook account again.

12:43.640 --> 12:45.200
So just simply reconnect.

12:46.160 --> 12:47.400
Copy up secret.

12:49.640 --> 12:54.240
Go back to ten and paste it into this field.

12:55.920 --> 12:56.680
Hit save.

13:01.960 --> 13:02.560
Perfect.

13:02.560 --> 13:09.840
I can see the connection successful message, which means our workflow can now receive WhatsApp messages.

13:10.920 --> 13:14.200
So I will close the credential window and test our setup.

13:19.160 --> 13:25.040
So let me click Execute Workflow to start monitoring for incoming messages.

13:25.720 --> 13:27.080
And now I'll switch to.

13:28.600 --> 13:32.080
And now I will switch over to WhatsApp and send a simple message like.

13:41.120 --> 13:41.720
Hi there.

13:52.310 --> 13:53.110
Now let's see.

13:53.150 --> 13:53.710
Great.

13:56.070 --> 13:58.550
I can see we successfully captured that message.

13:59.270 --> 14:01.910
And now when I open this WhatsApp sugar node.

14:07.470 --> 14:08.990
Switch over to schema.

14:14.990 --> 14:19.110
I can see there is a tons of information that WhatsApp provides.

14:19.550 --> 14:29.230
Now the important part for us is the messages object, which holds the actual message content that we

14:29.230 --> 14:30.750
process with our agent.

14:32.070 --> 14:33.030
Okay, perfect.

14:33.710 --> 14:34.470
Let's move on.

14:36.390 --> 14:38.470
Now let's set our agent component.

14:39.390 --> 14:43.090
So let's click on this plus button to add the next node.

14:46.970 --> 14:49.090
AI agent.

14:51.290 --> 14:53.970
Now for the prompt, let's select define below.

14:56.970 --> 15:01.730
For the user message, I need to pull in the content from our WhatsApp trigger.

15:02.370 --> 15:04.130
So let me click on the.

15:06.650 --> 15:07.330
Messages.

15:07.970 --> 15:14.490
Then from the text object, let's select a body value and drop it to this field.

15:16.890 --> 15:17.770
Alright, perfect.

15:18.490 --> 15:24.210
Now we need to add a large language model as a brain for our agent.

15:25.410 --> 15:27.890
So I need to configure the language model.

15:28.850 --> 15:30.690
So simply click on this plus button.

15:32.850 --> 15:38.770
I will use OpenAI for this and stick with GPT for our model.

15:40.880 --> 15:47.040
So I'm going to switch over to the older version because it's cheaper.

15:50.120 --> 15:50.520
All right.

15:50.520 --> 15:51.080
Perfect.

15:56.920 --> 16:00.760
Now let me test this basic setup by executing the node.

16:03.520 --> 16:04.360
Let's have a look.

16:06.040 --> 16:12.640
And as you can see our agent responds with a standard greetings like hello, how can I assist you today.

16:14.240 --> 16:18.160
So now let's make this more personalized by adding a system prompt.

16:18.760 --> 16:20.120
So click on add option.

16:20.840 --> 16:21.880
System message.

16:23.080 --> 16:25.920
And by default you have you are a helpful assistant.

16:27.520 --> 16:30.240
So I'll switch over to expression mode.

16:32.440 --> 16:34.320
And create a custom system message.

16:35.360 --> 16:36.680
So I will start with.

16:39.230 --> 16:45.110
Your helpful assistant named Alex.

16:47.710 --> 16:49.230
Let me expand this.

16:51.750 --> 16:52.070
All right.

16:52.070 --> 16:52.630
Great.

16:54.190 --> 16:56.470
But I want to make this even more personalized.

16:56.470 --> 17:00.670
So let me also include who the agent is talking to.

17:06.790 --> 17:08.550
So I can grab the contact name.

17:10.230 --> 17:11.310
Under contacts.

17:11.830 --> 17:13.350
And from the profile object.

17:15.830 --> 17:18.350
And paste and drop it right here.

17:22.430 --> 17:29.790
And you can add prompt like you are currently speaking.

17:35.190 --> 17:35.830
With.

17:38.420 --> 17:38.860
All right.

17:38.860 --> 17:39.340
Great.

17:39.700 --> 17:40.100
Um.

17:43.500 --> 17:48.300
We can also give the agent context about the current time.

17:54.260 --> 18:02.540
So let's say the current date and time is open.

18:02.580 --> 18:03.780
Double curly braces.

18:06.060 --> 18:10.660
Choose now dot two ISO.

18:12.340 --> 18:15.060
You can also expand this prompt as you wish.

18:17.980 --> 18:21.580
Let's say always respond.

18:24.860 --> 18:27.500
In a warm and helpful manner.

18:33.260 --> 18:33.660
All right.

18:33.660 --> 18:34.020
Great.

18:34.020 --> 18:36.440
So now I want to add conversation memory.

18:36.440 --> 18:40.280
So our agent remembers previous messages.

18:41.040 --> 18:42.040
So let me add.

18:44.240 --> 18:45.200
A simple memory.

18:47.440 --> 18:49.600
So it stores in memory.

18:49.600 --> 18:51.200
So no credentials required.

18:54.200 --> 18:54.800
All right.

18:57.720 --> 19:05.440
So for the session ID I will use the phone number since that uniquely identifies each user.

19:08.000 --> 19:10.920
So for the session ID defined below.

19:12.960 --> 19:14.560
Switch to expression.

19:16.920 --> 19:21.520
So I will set this to pull the mobile number from our WhatsApp data.

19:22.960 --> 19:27.640
So simply take this mobile number as the key.

19:29.800 --> 19:30.120
All right.

19:30.120 --> 19:34.040
For the context window I will set it to remember the last 15 messages.

19:36.350 --> 19:42.390
Um, so that should give us good conversation continuity without using too much memory.

19:44.870 --> 19:45.870
Alright, perfect.

19:45.910 --> 19:48.190
Now our agent has memory and personality.

19:50.190 --> 19:51.190
I'm going to hit save.

19:54.750 --> 19:58.830
Now we need to send the agent's response back to WhatsApp.

19:59.830 --> 20:01.430
So let me add another node.

20:03.870 --> 20:05.950
Let's search for WhatsApp.

20:08.870 --> 20:13.150
Send message because we want to send message back to the user as an action.

20:15.870 --> 20:16.870
And this nodes.

20:16.910 --> 20:21.070
This node needs its own credentials for sending messages.

20:22.070 --> 20:23.790
So I will create new credential.

20:28.350 --> 20:32.790
And call it call this node WhatsApp.

20:36.140 --> 20:36.900
Reply.

20:40.740 --> 20:45.140
Now we need two pieces of information here.

20:45.420 --> 20:48.260
The access token and the business account ID.

20:48.660 --> 20:53.900
So let me switch back to our dashboard and go to the WhatsApp API configuration.

20:58.820 --> 21:03.820
So in the sidebar click on WhatsApp API setup.

21:18.740 --> 21:23.660
And as you can remember here we can generate access token generate access token.

21:24.380 --> 21:30.420
Now meta might ask you to log in to your Facebook account again.

21:30.580 --> 21:32.130
So just simply reconnect.

21:35.250 --> 21:36.570
Copy the access token.

21:39.090 --> 21:49.690
Go back to N810 and paste it right here for the Business Account ID you can find that right here on

21:49.690 --> 21:50.610
the same page.

21:53.730 --> 21:57.490
As you can see WhatsApp business account ID, simply copy it.

21:59.930 --> 22:01.850
And paste it into this field.

22:04.970 --> 22:05.890
And hit save.

22:08.450 --> 22:09.170
Perfect.

22:09.930 --> 22:15.090
So if everything is configured correctly we should see a green connection status.

22:16.810 --> 22:22.290
But if you get an error here, it's likely because the access token expired.

22:22.570 --> 22:25.570
And remember these tokens are temporary.

22:25.890 --> 22:29.330
So just regenerate it in meta and update N810.

22:30.130 --> 22:31.630
Now let's configure this node.

22:31.670 --> 22:33.230
Now we need to configure this node.

22:33.510 --> 22:40.630
If you don't have a data in your flow just simply test workflow and send some message on WhatsApp.

22:41.230 --> 22:41.590
Right.

22:41.630 --> 22:44.390
The operation should stay as send message.

22:45.430 --> 22:52.190
So for the send the phone number I will select my number.

22:53.350 --> 22:58.070
But you can also select the test number for the recipient.

22:58.070 --> 23:02.630
I need to grab the phone number from our incoming WhatsApp message.

23:03.790 --> 23:05.110
So let's expand this node.

23:08.790 --> 23:13.270
You can get the number from messages and from value over here.

23:17.190 --> 23:19.230
Drag and drop it right here into this field.

23:21.150 --> 23:21.470
Right.

23:21.470 --> 23:21.870
Great.

23:23.510 --> 23:26.390
Now I will put the response from our agent node.

23:26.430 --> 23:29.700
That's the text we want to send back to the user.

23:30.300 --> 23:35.580
So simply grab this output and drop it into this field.

23:37.700 --> 23:38.100
All right.

23:38.140 --> 23:40.340
Now let's test this node to see if it works.

23:41.500 --> 23:42.580
So execute step.

23:45.260 --> 23:45.500
All right.

23:45.540 --> 23:46.260
Excellent.

23:51.300 --> 23:54.300
I can see any errors and the output data right here.

23:54.900 --> 23:56.420
So now let's check my WhatsApp.

23:56.820 --> 23:58.220
Now let's check my WhatsApp.

24:01.500 --> 24:01.940
All right.

24:01.940 --> 24:02.380
Great.

24:02.420 --> 24:03.460
I got a message.

24:03.700 --> 24:05.100
Hello test I'm Alex.

24:05.460 --> 24:07.620
I'm here to help you with anything you need.

24:07.940 --> 24:09.220
What's your mind today?

24:11.060 --> 24:11.500
All right.

24:11.500 --> 24:12.100
Perfect.

24:12.820 --> 24:15.500
We now have a working agent connected to WhatsApp.

24:15.820 --> 24:20.660
The basic conversation flow is complete, but there is so much more we can do with this setup.

24:21.260 --> 24:24.820
Now let's extend our agent to handle more than just text.

24:25.180 --> 24:30.610
So in WhatsApp, users can send voice messages, images and documents.

24:30.610 --> 24:35.650
So we need to build logic to process these different input types.

24:36.090 --> 24:43.010
So I'm going to make a few changes to our workflow, and everything will become clear as we build this

24:43.010 --> 24:43.370
out.

24:43.890 --> 24:50.570
So our agent won't pull text directly from this WhatsApp trigger.

24:52.850 --> 24:58.090
Anymore because users might send audio or images instead of text messages.

24:58.890 --> 25:03.850
So I will add in the middle I will add a set node.

25:04.290 --> 25:05.730
So let's search for set node.

25:13.490 --> 25:16.610
I'm going to name this node.

25:20.570 --> 25:21.370
Text handler.

25:27.240 --> 25:30.240
And I will add just one field called text.

25:30.720 --> 25:35.200
Where will where will you map the text content from our WhatsApp trigger?

25:35.880 --> 25:37.120
So click on add field.

25:41.840 --> 25:42.440
Username.

25:42.880 --> 25:43.400
Text.

25:48.000 --> 25:55.920
And it's pretty simple as a value we need to add this body value.

25:55.920 --> 25:56.600
So hello.

25:59.640 --> 26:01.920
So this is our text we received on WhatsApp.

26:05.120 --> 26:08.080
Yes we received this text from WhatsApp signal.

26:09.640 --> 26:10.280
All right.

26:10.640 --> 26:13.880
Now let let me execute this note to to test it.

26:14.320 --> 26:15.360
So execute step.

26:18.440 --> 26:18.840
All right.

26:18.840 --> 26:19.440
Perfect.

26:20.840 --> 26:29.740
Now in the agent node I need to change the prompt Homes to use this text field from our set node instead

26:29.740 --> 26:31.780
of the original trigger node.

26:32.820 --> 26:34.420
So let's open agent node.

26:35.660 --> 26:41.020
So now in the agent node let's replace this prompt.

26:42.460 --> 26:47.300
Remove this with the text property from the set node.

26:50.540 --> 26:51.260
Alright great.

26:52.020 --> 26:56.380
And now when I test this by sending a WhatsApp message, everything should work the same.

26:56.980 --> 26:58.500
So click on execute workflow.

27:00.860 --> 27:01.700
Send message.

27:08.460 --> 27:10.100
But actually we get an error.

27:10.500 --> 27:13.060
So there is a problem with the memory node.

27:13.060 --> 27:20.820
And this happened happens because the memory is looking at the node right before the agent which is

27:20.820 --> 27:24.730
now our set node, not the WhatsApp signals.

27:27.770 --> 27:31.370
But our set node doesn't have the contact information we need.

27:31.610 --> 27:35.410
So I need to fix this by pointing back to our WhatsApp trigger node.

27:35.770 --> 27:39.450
I'm going to update the session ID using an expression.

27:40.090 --> 27:41.850
So let's open supplementary node.

27:46.010 --> 27:46.890
Let's remove this.

27:51.690 --> 28:01.170
Because as you can see this JSON is referring is referencing to the contacts which is in the object

28:01.810 --> 28:05.690
from the WhatsApp trigger node right here.

28:06.970 --> 28:08.650
So this is the number we are looking for.

28:14.210 --> 28:14.490
Yeah.

28:14.530 --> 28:21.890
As you can see there was a trigger node includes this contacts object with the WhatsApp number.

28:23.160 --> 28:24.280
so we have to fix it.

28:26.720 --> 28:27.800
So let's remove this.

28:29.960 --> 28:30.200
Yes.

28:30.200 --> 28:39.440
So just to clarify, the JSON is referring to the node just before the A agent which is this one.

28:39.480 --> 28:40.280
Text handler.

28:41.320 --> 28:42.160
But this one.

28:42.800 --> 28:44.760
But this node doesn't contain the.

28:47.920 --> 28:49.400
This object.

28:50.440 --> 28:52.840
So what we need to do we need to map the values.

28:53.280 --> 28:54.360
So let's remove it.

28:55.120 --> 28:58.360
I will update the session id using an expression.

28:59.600 --> 29:00.720
So let's expand it.

29:05.840 --> 29:07.480
Let's open double curly braces.

29:10.480 --> 29:12.040
Let's choose the node.

29:12.480 --> 29:13.520
So what's up sugar.

29:21.470 --> 29:28.310
That's a dot item, so select the first from suggested dot.

29:33.270 --> 29:35.830
JSON dot messages.

29:39.150 --> 29:46.590
And since this gives us an array, I will grab the first item and use the from field which has the phone

29:46.590 --> 29:46.990
number.

29:52.030 --> 29:56.510
And zero because in programming we start counting from zero.

29:58.550 --> 30:00.950
and.com.

30:03.630 --> 30:06.510
Because if you check the.

30:08.950 --> 30:10.150
What's up trigger node.

30:14.190 --> 30:18.470
You can see that from contains our WhatsApp number.

30:22.650 --> 30:23.010
Alright.

30:23.010 --> 30:23.570
Perfect.

30:24.530 --> 30:26.210
Now let's test this workflow again.

30:27.050 --> 30:28.210
So execute workflow.

30:31.090 --> 30:32.570
Let's send simple message.

30:34.770 --> 30:35.250
Hello.

30:40.930 --> 30:45.050
And now as you can see, this time we got our response back perfectly.

30:48.170 --> 30:50.890
I know it seems like you might be trying to get my attention.

30:50.930 --> 30:52.050
How can I help you today?

30:54.730 --> 30:55.130
Great.

30:55.530 --> 30:58.650
When we open the WhatsApp business cloud node.

31:03.450 --> 31:09.330
We can see the output from our agent, which is an input to our WhatsApp node.

31:09.690 --> 31:10.770
And the text body.

31:11.770 --> 31:12.050
Hello.

31:12.050 --> 31:14.210
It seems like you are maybe trying to get my attention.

31:14.610 --> 31:18.480
So this is the response from our agent.

31:19.160 --> 31:19.440
Alright.

31:19.440 --> 31:20.000
Perfect.

31:20.520 --> 31:24.120
Now let's see how our workflow handles voice messages.

31:25.320 --> 31:30.720
So click on Execute Workflow and I'm going to record an audio message.

31:35.160 --> 31:40.000
Can you explain to me why the context protocol is so cool.

31:44.400 --> 31:45.320
Back then.

31:45.360 --> 31:48.880
So let's ignore this error for now.

31:48.880 --> 31:53.240
But let's examine what data we receive from WhatsApp.

31:57.600 --> 31:58.120
Now.

32:00.720 --> 32:10.760
When someone sends audio looking at the messages, we can see that this is an array.

32:11.200 --> 32:19.830
And we now get an audio object right here With completely different properties compared to the text

32:19.830 --> 32:20.430
messages.

32:20.910 --> 32:26.550
So this shows us we need to build conditional logic to handle different message types.

32:26.950 --> 32:30.590
So whether someone sends text, voice notes or images.

32:31.070 --> 32:39.270
So to handle these different scenarios I will add a switch node right after WhatsApp trigger node.

32:40.190 --> 32:41.350
So let me search.

32:43.390 --> 32:45.470
The search node between these two nodes.

32:47.230 --> 32:49.150
So search for switch node.

32:54.350 --> 33:00.670
So for example for the voice message path I will check if this audio object is present.

33:01.030 --> 33:04.870
So let me set up that as the value.

33:05.870 --> 33:11.910
So let's grab this audio object and drop it into the value field.

33:14.390 --> 33:23.100
And now I will change this dropdown to object and exist because.

33:23.140 --> 33:27.900
Because we are checking if this object saw the audio message exists in the flow.

33:30.460 --> 33:31.340
Alright, perfect.

33:31.780 --> 33:33.140
Now let's rename the output.

33:36.780 --> 33:39.860
So when this condition is met we'll go down this path.

33:41.900 --> 33:47.380
So I'm going to rename this output to Voice or Audio.

33:57.380 --> 33:57.940
All right.

33:57.940 --> 34:04.580
So now we've got this single voice output.

34:04.980 --> 34:07.820
So I will also create the route for the text message.

34:08.300 --> 34:09.980
So let's text.

34:11.060 --> 34:12.580
So let's execute the workflow.

34:16.400 --> 34:17.440
And in WhatsApp.

34:17.440 --> 34:21.440
Let's send short message this time.

34:21.440 --> 34:24.800
Text message either.

34:31.760 --> 34:34.120
Then back in 2010 let's create another route.

34:34.120 --> 34:36.800
So in the switch node.

34:41.640 --> 34:44.760
Now we've got text object.

34:46.240 --> 34:48.680
So let's create another route.

34:49.520 --> 34:51.760
So click on adding a routing rule.

34:54.800 --> 34:57.960
Let's grab this text object.

34:59.280 --> 35:00.200
Drop it right here.

35:02.880 --> 35:06.040
And the same let's switch to object.

35:07.040 --> 35:08.520
Let's check if it exists.

35:13.510 --> 35:16.350
Let's rename this output to text.

35:22.190 --> 35:25.910
So if the text exists we wrote down the text path.

35:26.630 --> 35:31.310
So now I need to remove the original connection.

35:37.870 --> 35:42.950
Because it's the text path that should connect to our existing workflow.

35:44.150 --> 35:45.270
So text handler.

35:47.430 --> 35:48.670
So connect these two nodes.

35:49.790 --> 35:52.990
Let's also be prepared and create a route for images.

35:53.310 --> 35:56.190
So let me click Execute Workflow.

36:01.390 --> 36:03.270
And I will upload any picture like.

36:09.350 --> 36:10.550
Photographs.

36:19.540 --> 36:20.220
Like this one.

36:31.260 --> 36:32.860
Now back in our switch node.

36:36.860 --> 36:38.780
So let's create another routing condition.

36:38.780 --> 36:45.300
So for this scenario we get this image object to add routing rule.

36:47.940 --> 36:49.260
Grab the image object.

36:50.460 --> 36:51.420
Drop it right here.

36:55.500 --> 36:56.380
Object.

36:57.260 --> 36:58.580
We check if it exists.

37:01.220 --> 37:02.740
Rename output to image.

37:06.060 --> 37:16.410
So again we say that if the image object exists, then we wrote down this path, which will, uh, which

37:16.410 --> 37:17.250
we call image.

37:17.970 --> 37:18.450
All right.

37:18.490 --> 37:22.330
Now let's, uh, build out the voice processing code.

37:22.850 --> 37:29.890
So let me get some fresh data by going back to WhatsApp and recording short voice message.

37:33.370 --> 37:34.770
So first execute workflow.

37:43.690 --> 37:43.930
Hi.

37:43.930 --> 37:44.770
How are you doing?

37:50.250 --> 37:50.930
All right.

37:51.850 --> 37:55.890
So now in N810, I can see the voice path is now being activated.

38:05.410 --> 38:10.390
As you can see here, the voice object, uh, the audio object is green.

38:11.110 --> 38:15.990
So now I don't want to keep sending messages every time I test this workflow.

38:15.990 --> 38:20.790
So I'm so what I'm going to do I'm going to pin this data by clicking.

38:23.830 --> 38:27.390
What's up trigger and pin icon.

38:31.710 --> 38:36.670
So now I can easily retest this workflow by clicking Execute Workflow.

38:36.670 --> 38:39.230
And it will use the pinned data.

38:39.990 --> 38:42.350
So the same voice message I just sent.

38:42.830 --> 38:46.070
The first step is to download that audio file.

38:46.710 --> 38:48.190
So let me search for.

38:53.910 --> 38:55.150
WhatsApp business cloud.

38:55.430 --> 38:56.390
So WhatsApp.

38:59.830 --> 39:03.390
And select download Media as an action.

39:07.350 --> 39:09.260
So let me rename this node to.

39:12.820 --> 39:14.900
We get audio.

39:17.980 --> 39:18.460
File.

39:22.180 --> 39:29.060
Make sure your WhatsApp account is connected and connected and you are using the same credentials as

39:29.060 --> 39:30.980
for the other WhatsApp nodes.

39:31.020 --> 39:31.900
In this workflow.

39:32.740 --> 39:39.580
Next, make sure media is selected under resource and as operation.

39:39.580 --> 39:41.180
We want to download the file.

39:44.300 --> 39:51.020
Now we need to provide media ID so you can get it from the audio object.

39:54.060 --> 39:54.820
Like that.

39:57.900 --> 39:59.980
Now when I test this step.

40:01.500 --> 40:03.020
So let's execute step.

40:05.420 --> 40:08.490
As you can see, it gives me a URL.

40:09.250 --> 40:11.850
So this is protected URL though.

40:12.250 --> 40:17.170
So if you try to access it directly you will get an authorization error.

40:18.330 --> 40:22.490
So when you copy this link and paste it into the browser.

40:31.050 --> 40:33.090
You will get this authentication error.

40:35.650 --> 40:36.290
All right.

40:40.610 --> 40:44.530
Next I need to use that URL to actually download the file.

40:44.970 --> 40:48.050
So let me add.

40:50.970 --> 40:52.530
An HTTP request node.

40:53.650 --> 40:54.930
So click on this plus button.

40:56.090 --> 40:57.290
Let's organize it.

41:02.290 --> 41:02.850
Okay.

41:10.440 --> 41:10.760
All right.

41:10.800 --> 41:11.360
Perfect.

41:13.880 --> 41:21.720
So now let's add an HTTP request node to search for HTTP request.

41:27.720 --> 41:31.920
Now into the URL field let's add this URL.

41:38.600 --> 41:42.000
Now under the authentication.

41:45.480 --> 41:48.080
I will select generic credential type.

41:51.320 --> 41:56.840
And for the generic of type I will add an off header.

41:58.680 --> 41:59.720
So header off.

42:02.360 --> 42:04.910
Now let's create a new credential.

42:05.510 --> 42:08.550
So click on this small pen.

42:15.550 --> 42:16.430
For the name.

42:18.910 --> 42:19.950
Leave it as it is.

42:19.950 --> 42:26.630
So it has to be authorization and it needs to be spelled correctly exactly like this.

42:27.270 --> 42:30.910
And for the value I'll switch over to the expression mode.

42:32.790 --> 42:33.710
Expand it.

42:36.390 --> 42:37.190
Remove it.

42:38.430 --> 42:42.110
Type beta space.

42:46.790 --> 42:48.670
Followed by my access token.

42:49.030 --> 42:54.310
So I need to go back to my meta dashboard to grab my access token.

42:58.150 --> 42:59.790
Just simply copy it.

43:03.730 --> 43:04.850
And paste it right here.

43:08.690 --> 43:09.770
Now let me save.

43:14.570 --> 43:15.250
Perfect.

43:19.610 --> 43:20.970
Now let's test our workflow.

43:23.250 --> 43:26.450
So you can just test this specific node.

43:29.570 --> 43:30.530
And I've got an error.

43:34.930 --> 43:35.610
All right.

43:41.170 --> 43:42.090
Let's fix it.

43:42.650 --> 43:47.890
You can always use built in assistant for troubleshooting.

43:48.890 --> 43:51.770
So let's let's see what it suggests.

43:52.610 --> 43:56.290
So starting session it's analyzing the error.

43:56.330 --> 43:56.650
Now.

44:02.040 --> 44:03.040
Let's wait a moment.

44:04.400 --> 44:04.640
Okay.

44:04.640 --> 44:05.400
The error message.

44:05.440 --> 44:07.120
Authorization failed.

44:07.160 --> 44:08.640
Please check your credentials.

44:08.680 --> 44:15.120
Authentication errors indicates that the HTTP request node is not able to authenticate with the larger

44:15.160 --> 44:20.320
with the target server using the credentials provided.

44:21.960 --> 44:25.320
Check the value set in your HTTP header or credential.

44:26.600 --> 44:27.280
All right.

44:29.120 --> 44:34.280
In case you don't understand the suggested solution, you can always copy it.

44:35.760 --> 44:39.160
Go to the large language model of your choice, for example to ChatGPT.

44:41.960 --> 44:43.400
Um, give it a role.

44:43.480 --> 44:44.640
For example, I want.

44:46.800 --> 44:49.120
You to act.

44:51.480 --> 44:51.800
As.

44:54.400 --> 44:55.240
An expert.

44:59.040 --> 45:00.390
Paste the error.

45:06.790 --> 45:08.190
Or the suggested solution.

45:18.430 --> 45:21.510
And ask it to explain it to you step by step.

45:36.990 --> 45:37.550
Step by step.

45:37.550 --> 45:38.910
Fix up your workflow in return.

45:38.950 --> 45:41.230
Check the authentication setting in the node.

45:41.670 --> 45:42.790
Go to credentials.

45:42.790 --> 45:44.790
Open the header of credential.

45:46.790 --> 45:49.350
Confirm token is valid right?

45:49.390 --> 45:55.270
So I hope I showed you how you can easily troubleshoot errors in N810.

45:55.670 --> 46:04.300
I'm going to add the HTTP request Note once again, so search for HTTP request node.

46:07.260 --> 46:12.780
Let's paste the URL right here as a notification.

46:13.180 --> 46:15.340
Let's select generic credential type.

46:17.900 --> 46:20.380
Header off the type.

46:22.300 --> 46:23.820
I refresh my credentials.

46:25.340 --> 46:27.540
And now let's execute this step once again.

46:29.620 --> 46:30.580
All right perfect.

46:30.940 --> 46:34.380
Now I have the actual audio file downloaded on the right side.

46:35.220 --> 46:40.420
And you can view it listen to it.

46:43.780 --> 46:45.460
You can download it right here.

46:46.060 --> 46:50.020
I will rename this node to audio.

46:57.440 --> 47:03.640
Now that I have the audio file, I need to transcribe it to convert the speech to text.

47:04.360 --> 47:06.600
So let me add an open AI node.

47:09.200 --> 47:11.280
Because we are going to use their model.

47:13.560 --> 47:15.440
Now I will create a set node.

47:16.480 --> 47:18.360
So let's search for set node.

47:23.760 --> 47:27.080
And add a field called text.

47:30.800 --> 47:36.160
With the transcribed audio as the value from the previous node.

47:40.120 --> 47:41.120
Named text.

47:43.840 --> 47:45.440
Now let me run this step.

47:48.920 --> 47:52.480
And rename this node to audio handler.

47:59.590 --> 47:59.990
Alright.

47:59.990 --> 48:00.550
Perfect.

48:06.110 --> 48:09.630
Finally, I will connect this node to our agent.

48:17.550 --> 48:25.670
Now important note the field name needs to match between our text processing and audio processing.

48:26.390 --> 48:33.110
So both text handler and audio handler should use text as the field name.

48:33.350 --> 48:37.990
So the agent can process either input the same way.

48:39.030 --> 48:44.390
So make sure the name of this of this field is text.

48:48.830 --> 48:50.870
And match this one for text.

48:52.950 --> 48:53.270
Alright.

48:53.270 --> 48:53.830
Perfect.

48:54.740 --> 48:56.780
And now when I run the agent.

49:04.620 --> 49:15.220
It will be able to reply to me in a text format, even though I trigger it using a voice message.

49:15.980 --> 49:21.740
So the agent is now processing input from this audio branch instead of the text branch.

49:21.900 --> 49:27.060
Now if you want to, you could also make the agent respond with voice message.

49:27.820 --> 49:29.860
And to me this is pretty logical.

49:29.940 --> 49:36.900
If someone sends a voice note, they're probably busy or driving or something, so they would expect

49:36.940 --> 49:38.300
a voice response back too.

49:38.820 --> 49:40.620
So this is actually quite simple.

49:41.580 --> 49:48.740
All we need to do is add an if node to determine whether we should send audio or text back.

49:52.020 --> 49:55.410
So between the agent node and WhatsApp.

49:56.530 --> 50:01.210
Um, let's add if node.

50:05.890 --> 50:06.570
All right.

50:09.250 --> 50:15.530
And in this if node I want to detect if we got audio from the WhatsApp trigger.

50:17.890 --> 50:19.330
So let's expand this node.

50:20.570 --> 50:22.010
So WhatsApp trigger node.

50:23.450 --> 50:25.370
Let's grab the audio object.

50:28.250 --> 50:29.410
And drop it right here.

50:33.010 --> 50:36.010
So if we did get audio we will send audio back.

50:36.010 --> 50:39.490
If not we'll just send text like normal.

50:40.290 --> 50:45.810
So let me configure the condition to check our WhatsApp trigger node for an audio object.

50:46.890 --> 50:50.810
So let's switch to object and exists.

50:53.990 --> 50:55.990
True means we send audio.

50:55.990 --> 50:57.750
Photos means we send text.

50:58.830 --> 51:03.830
So I actually need to disconnect this existing link.

51:07.030 --> 51:08.950
Because when the condition is false.

51:09.830 --> 51:11.310
So no audio object.

51:13.590 --> 51:17.910
We want to go with our standard text response.

51:22.870 --> 51:24.870
And now let's rename this node to.

51:30.270 --> 51:30.990
Send text.

51:44.310 --> 51:47.110
Now how do we generate the audio response.

51:47.630 --> 51:53.900
First step is to take the output from our agent and turn it into speech.

51:54.100 --> 51:56.220
First let me execute this if node.

51:59.940 --> 52:00.860
Alright, good.

52:01.380 --> 52:06.500
Is taking that true branch since we sent a voice message.

52:07.700 --> 52:09.860
We've got one item, as you can see here.

52:12.820 --> 52:15.620
From here let me add an OpenAI node.

52:15.620 --> 52:17.660
So click on this plus button.

52:18.660 --> 52:19.740
Search for OpenAI.

52:24.340 --> 52:27.140
And we're looking for generate audio.

52:30.820 --> 52:34.060
So I will pull the response from our agent.

52:34.500 --> 52:37.220
First let's expand the AI agent node.

52:38.940 --> 52:40.380
And we've got an output here.

52:44.700 --> 52:47.540
Let's drop it in the into the text input.

52:50.370 --> 52:51.930
Now let me test this step.

52:53.330 --> 52:57.850
So execute step and we get an audio file.

52:59.290 --> 53:02.090
You can view it download and listen to it.

53:02.610 --> 53:05.370
And here you can pick different voices if you want.

53:06.730 --> 53:07.770
I will go with Nova.

53:08.290 --> 53:14.210
So yeah if you want to experiment with different voices you can change that option and run the step

53:14.210 --> 53:16.090
again and hear how it sounds.

53:17.890 --> 53:22.810
So let me rename this node to Generate voice.

53:28.890 --> 53:29.450
Great.

53:33.690 --> 53:37.810
Now I need to send this audio through WhatsApp.

53:39.530 --> 53:42.370
So let me add another WhatsApp business cloud node.

53:48.240 --> 53:49.360
Search for WhatsApp.

53:52.120 --> 53:53.760
To send message.

53:56.040 --> 53:59.240
Now, as the sender phone number, I will pick my number.

53:59.240 --> 54:07.200
But you can also select the test number and you also need to enter the recipient number.

54:07.680 --> 54:14.080
So switch over to schema view from the binary to schema and from the WhatsApp trigger node.

54:16.720 --> 54:17.760
And the messages.

54:20.480 --> 54:24.160
Pick from number and drop it right here.

54:30.600 --> 54:31.040
Great.

54:32.640 --> 54:35.520
Now this is critical step for the message type.

54:38.840 --> 54:41.560
I need to switch this from text to audio.

54:44.120 --> 54:49.260
Then I will set Take audio from 2010.

54:53.460 --> 54:56.140
So it uses the audio file from our previous step.

54:58.620 --> 55:02.340
And now when I test this step.

55:04.380 --> 55:05.420
It's a good step.

55:08.580 --> 55:09.500
There is a problem.

55:11.580 --> 55:16.380
Because we got an error about the Mime type being wrong.

55:16.940 --> 55:23.420
So we are sending audio to MP3, but WhatsApp won't accept that format.

55:24.900 --> 55:29.780
So we need to fix the Mime type to something WhatsApp likes.

55:30.220 --> 55:34.340
So let me add a code node between these two steps.

55:36.900 --> 55:46.490
So to clarify this node is going to grab this binary file and the WhatsApp is not going to accept this

55:46.490 --> 55:47.010
format.

55:48.770 --> 55:54.930
So we need to add the code node right here between those two nodes.

55:57.370 --> 55:58.570
So search for code.

56:05.850 --> 56:09.930
So I will put JavaScript code in the description.

56:12.050 --> 56:18.530
And it will check for for a binary file and changes the Mime type from audio mp3.

56:20.010 --> 56:25.450
So as you can see our Mime type is in audio mp3.

56:26.330 --> 56:29.210
And we need to change it to audio amp.

56:31.250 --> 56:34.770
So I'm going to paste the code snippet right here.

56:36.690 --> 56:38.170
Just remove all of this.

56:41.770 --> 56:44.200
And now as you can see we also have a comment.

56:44.200 --> 56:50.960
So this line loop over input items and change the Mime type of binary data.

56:51.520 --> 56:54.320
Then it checks if the item has a binary data.

56:55.200 --> 57:03.160
Then this line finds the binary property name and if the Mime type is audio mp3.

57:03.800 --> 57:11.240
So the format we just got in our audio file, it changes to audio MPEG.

57:14.080 --> 57:16.280
So that's what this code does.

57:17.880 --> 57:18.200
Okay.

57:18.240 --> 57:21.360
So now let me let me test this test this step.

57:22.560 --> 57:29.640
So on the left you see the original file with audio mp3 Mime type.

57:29.960 --> 57:35.920
And on the right it's we change it to audio MPEG.

57:36.840 --> 57:37.480
So now.

57:39.680 --> 57:42.910
When I run the WhatsApp step again.

57:54.670 --> 57:56.110
It works perfectly.

57:57.070 --> 57:59.830
And we got our voice response in WhatsApp.

58:03.310 --> 58:04.150
Okay, great.

58:05.470 --> 58:06.750
Hi, I'm doing well.

58:06.750 --> 58:07.750
Thank you for asking.

58:07.750 --> 58:08.510
How are you?

58:09.150 --> 58:11.830
If there's anything you need help with, feel free to let me know.

58:13.270 --> 58:17.790
Well, I think I've just noticed that accidentally renamed.

58:17.950 --> 58:21.310
If not instead of this WhatsApp output node.

58:22.350 --> 58:23.470
So let's change it.

58:25.070 --> 58:26.590
This is our if condition.

58:31.030 --> 58:31.870
Verify logic.

58:35.470 --> 58:36.950
Let's rename this node to.

58:39.790 --> 58:40.950
Respond with audio.

58:53.650 --> 58:54.450
And this one.

58:58.570 --> 58:59.770
Respond with text.

59:18.530 --> 59:19.130
Perfect.

59:27.530 --> 59:29.930
Next we are going to tackle image processing.

59:30.290 --> 59:34.090
So first thing I need to do is unpin this data.

59:34.890 --> 59:37.050
So on the WhatsApp trigger node.

59:40.400 --> 59:41.160
Click on pin.

59:46.040 --> 59:48.200
And now I will send an image from WhatsApp.

59:52.280 --> 59:53.840
First click on Execute workflow.

59:58.400 --> 59:59.400
I'm going to.

01:00:02.800 --> 01:00:04.080
Send this image.

01:00:15.280 --> 01:00:15.640
All right.

01:00:15.640 --> 01:00:17.120
Workflow executed successfully.

01:00:19.880 --> 01:00:22.840
So actually I forgot to ask some question.

01:00:22.840 --> 01:00:23.880
So let's do it again.

01:00:29.920 --> 01:00:31.200
Let's send the same image.

01:00:38.590 --> 01:00:41.430
And ask, what do you see?

01:00:46.190 --> 01:00:47.150
In this image?

01:00:49.790 --> 01:00:50.590
And send it.

01:00:56.630 --> 01:00:57.110
All right.

01:00:57.110 --> 01:01:00.230
So back in this image workflow is now triggered.

01:01:00.750 --> 01:01:04.230
So I'm just going to move all the audio nodes up here.

01:01:11.150 --> 01:01:12.510
Image here okay.

01:01:12.790 --> 01:01:16.550
So I'm just going to add another node.

01:01:18.830 --> 01:01:21.350
So I will search for WhatsApp Business Cloud again.

01:01:22.390 --> 01:01:23.550
So type WhatsApp.

01:01:25.350 --> 01:01:26.350
Select this node.

01:01:28.630 --> 01:01:30.830
And now we want to download media.

01:01:30.830 --> 01:01:32.590
So we want to download this image.

01:01:37.500 --> 01:01:39.460
Now in our WhatsApp note.

01:01:40.780 --> 01:01:41.820
So scroll down.

01:01:43.420 --> 01:01:44.580
Expand this node.

01:01:48.140 --> 01:01:48.860
All right.

01:01:50.980 --> 01:01:52.460
Actually from switch node.

01:01:55.500 --> 01:01:57.140
Yeah from switch node.

01:02:06.260 --> 01:02:08.180
Let's grab the image ID.

01:02:14.300 --> 01:02:15.260
Which is right here.

01:02:16.900 --> 01:02:17.860
And drop it here.

01:02:23.380 --> 01:02:23.980
Or not.

01:02:24.540 --> 01:02:27.500
We successfully connected our credentials area.

01:02:29.420 --> 01:02:29.700
All right.

01:02:29.740 --> 01:02:30.100
Perfect.

01:02:30.140 --> 01:02:32.340
Now let's rename this node to.

01:02:35.140 --> 01:02:36.760
Get That image link.

01:02:41.520 --> 01:02:43.000
Now let's run this step.

01:02:44.760 --> 01:02:45.760
So execute step.

01:02:49.280 --> 01:02:52.360
And just like with audio we get a URL back.

01:02:53.840 --> 01:02:55.880
So I'm sure you can guess what's next.

01:02:56.800 --> 01:03:04.520
We need to add an HTTP request node the same like here in audio processing.

01:03:09.280 --> 01:03:11.080
So I'm going to move it here.

01:03:13.920 --> 01:03:18.360
Search for http request node http.

01:03:26.560 --> 01:03:29.240
So we will be able to actually download the image.

01:03:31.840 --> 01:03:34.990
So I will add the URL to the other field.

01:03:39.110 --> 01:03:40.470
Relief methods get.

01:03:44.830 --> 01:03:46.590
Now under authentication.

01:03:46.630 --> 01:03:49.710
I will select generic generic credential type.

01:03:53.670 --> 01:04:03.830
Then the type we need header off and use the same header credentials we created for the audio section.

01:04:06.750 --> 01:04:09.030
It should be set up automatically.

01:04:10.430 --> 01:04:16.590
But remember every few hours you might need to refresh your WhatsApp credentials unless you verify your

01:04:16.590 --> 01:04:17.150
business.

01:04:19.990 --> 01:04:20.630
All right.

01:04:24.110 --> 01:04:27.150
So now let's execute this and we get our image.

01:04:28.030 --> 01:04:29.870
We should get our image back.

01:04:30.630 --> 01:04:30.910
Yes.

01:04:30.910 --> 01:04:31.350
Perfect.

01:04:31.350 --> 01:04:32.390
We can view it.

01:04:37.780 --> 01:04:38.340
Awesome.

01:04:38.900 --> 01:04:41.380
Now I'll rename this node to the root image.

01:04:52.340 --> 01:04:53.140
And hit save.

01:04:56.220 --> 01:04:59.180
Now let's use AI to examine this image.

01:04:59.980 --> 01:05:03.020
So I will search for OpenAI.

01:05:08.820 --> 01:05:09.940
And then the action.

01:05:12.060 --> 01:05:13.620
And under image actions.

01:05:15.860 --> 01:05:17.660
Let's select analyze image.

01:05:22.700 --> 01:05:27.580
Let me rename this node to analyze image.

01:05:39.770 --> 01:05:40.290
All right.

01:05:41.810 --> 01:05:45.730
Make sure your OpenAI account is connected for the model.

01:05:45.730 --> 01:05:46.690
Let's select.

01:05:51.770 --> 01:05:56.650
The ChatGPT for latest and for the text input.

01:06:02.650 --> 01:06:06.810
I will say something like please.

01:06:14.090 --> 01:06:14.970
Describe.

01:06:17.970 --> 01:06:18.850
This image.

01:06:29.010 --> 01:06:29.730
All right.

01:06:30.670 --> 01:06:34.750
Now we need to change the input type to binary file.

01:06:37.870 --> 01:06:40.470
So it grabs the image from our previous step.

01:06:42.590 --> 01:06:44.510
Now let's test this step.

01:06:44.510 --> 01:06:51.070
And we get we should get a comprehensive analysis of the image.

01:06:51.390 --> 01:06:52.270
Let's check it.

01:06:53.350 --> 01:06:55.710
Let's switch over to the table view.

01:06:56.630 --> 01:07:03.630
This is a vibrant and joyful other image of two German Shepherd dogs, one adult and one puppy running

01:07:03.670 --> 01:07:04.310
across.

01:07:04.950 --> 01:07:08.630
All right, so as you can see, this is very detailed description of this image.

01:07:09.390 --> 01:07:10.030
Perfect.

01:07:14.150 --> 01:07:19.230
Now we need to create a prompt that combines this with any text the user sent.

01:07:23.990 --> 01:07:27.430
So let's add a set node.

01:07:30.500 --> 01:07:31.980
So the search for set mode.

01:07:37.940 --> 01:07:43.260
And in the set mode I'm going to add a text property.

01:07:46.660 --> 01:07:48.500
And switch over to expression mode.

01:07:49.260 --> 01:07:55.180
Let's expand this value field and add something more detailed.

01:07:55.740 --> 01:07:58.860
So I will say the user.

01:07:59.100 --> 01:08:03.460
So remember this is the prompt to our agent.

01:08:03.700 --> 01:08:09.180
So the user shares the following image.

01:08:13.940 --> 01:08:15.020
And message.

01:08:19.740 --> 01:08:20.260
Great.

01:08:28.930 --> 01:08:30.050
Now under.

01:08:36.810 --> 01:08:38.890
I didn't switch to expression, that's why.

01:08:38.890 --> 01:08:42.770
Okay, so switch over to expression first and expand it.

01:08:44.970 --> 01:08:46.210
Let's change it to.

01:08:48.930 --> 01:08:50.490
Text to make it clear.

01:08:52.890 --> 01:08:53.450
Okay.

01:08:55.370 --> 01:08:56.370
So now the.

01:08:59.530 --> 01:09:01.730
Now let's say image analysis.

01:09:05.610 --> 01:09:07.250
And let's grab the content.

01:09:09.810 --> 01:09:11.050
And drop it right here.

01:09:14.010 --> 01:09:17.810
So this is the description from our analyze image node.

01:09:18.450 --> 01:09:25.810
So for any text the user included I will pull that in as a user request.

01:09:38.520 --> 01:09:41.480
So now this is, um, here is something important.

01:09:41.480 --> 01:09:47.760
If you look at the image object in our WhatsApp trigger node.

01:09:53.640 --> 01:10:03.120
We get the image ID which we use for downloading, but we also get the caption property.

01:10:03.160 --> 01:10:08.640
So this is optional though by users don't have to include text with their images.

01:10:09.520 --> 01:10:13.120
So we set the user message to this caption.

01:10:13.720 --> 01:10:14.920
This caption value.

01:10:15.760 --> 01:10:21.440
But if this property doesn't exist, I want it to fall back to a default.

01:10:21.840 --> 01:10:22.160
Yes.

01:10:22.160 --> 01:10:28.820
So as I said, let's set the user message to this caption value.

01:10:30.780 --> 01:10:36.060
So just simply grab the caption and drop it right here.

01:10:37.700 --> 01:10:40.020
But if this property doesn't exist.

01:10:41.020 --> 01:10:42.300
So for example, if I.

01:10:45.220 --> 01:10:49.220
It won't send this caption along with the image.

01:10:54.140 --> 01:10:56.780
I want it to fall back to a default.

01:10:57.220 --> 01:11:00.460
We can do this by adding double pipes.

01:11:03.660 --> 01:11:09.180
And then within the course let's say something like describe.

01:11:13.260 --> 01:11:14.420
This image in detail.

01:11:19.700 --> 01:11:23.180
And this way if the user doesn't ask a specific question.

01:11:24.730 --> 01:11:30.890
While uploading the image into the WhatsApp, our agent will just describe what it sees.

01:11:32.530 --> 01:11:34.170
Now let's rename this node.

01:11:37.530 --> 01:11:40.490
To image prompt.

01:11:46.170 --> 01:11:46.570
All right.

01:11:46.570 --> 01:11:47.090
Great.

01:11:48.650 --> 01:11:52.690
And finally let's connect this to our agent as well.

01:11:54.450 --> 01:11:55.250
Like that.

01:12:00.210 --> 01:12:01.730
Now let's clean it a bit.

01:12:01.730 --> 01:12:06.890
So I'm going to move this image part to the left.

01:12:07.130 --> 01:12:08.130
Okay great.

01:12:09.450 --> 01:12:11.010
So let's test this out.

01:12:11.890 --> 01:12:17.730
I'm going to click on Execute Workflow and send an image from WhatsApp.

01:12:25.400 --> 01:12:29.280
First I want to include any text, so it should use our fallback prompt.

01:12:37.800 --> 01:12:38.600
I hit send.

01:12:46.720 --> 01:12:48.640
Okay I need to refresh my credentials.

01:12:49.120 --> 01:12:51.880
So as always go to your dashboard.

01:12:57.360 --> 01:12:58.640
Copy Accesstoken.

01:13:03.640 --> 01:13:05.320
And refresh your credentials.

01:13:14.600 --> 01:13:16.960
I'm writing to generate the access token.

01:13:31.190 --> 01:13:32.670
And paste it right here.

01:13:32.710 --> 01:13:33.470
It's safe.

01:13:34.670 --> 01:13:35.430
Perfect.

01:13:38.990 --> 01:13:42.710
Now let's pin data so I don't need to upload the image again.

01:13:50.550 --> 01:13:51.710
And execute workflow.

01:13:55.510 --> 01:13:57.150
The same for this node.

01:14:00.230 --> 01:14:01.710
Need to refresh credentials.

01:14:08.190 --> 01:14:09.510
It's going to copy it.

01:14:12.910 --> 01:14:13.950
Expression.

01:14:18.870 --> 01:14:19.510
But a.

01:14:25.930 --> 01:14:26.610
Safe.

01:14:31.050 --> 01:14:32.010
Execute again.

01:14:43.330 --> 01:14:45.370
Now you can see it's analyzing the image.

01:14:47.690 --> 01:14:49.650
So now our agent is processing it okay.

01:14:49.690 --> 01:14:51.570
And responding with text.

01:14:52.570 --> 01:14:53.050
Yep.

01:14:55.610 --> 01:14:57.730
So in WhatsApp let's open WhatsApp.

01:15:00.890 --> 01:15:02.610
I forgot to unpin the data.

01:15:04.530 --> 01:15:05.850
So let's open it.

01:15:08.770 --> 01:15:09.170
All right.

01:15:09.210 --> 01:15:09.650
Great.

01:15:09.690 --> 01:15:14.330
Now let's go back to our WhatsApp.

01:15:17.650 --> 01:15:19.480
Let's send the same image.

01:15:24.880 --> 01:15:25.280
Okay.

01:15:25.280 --> 01:15:26.240
How old?

01:15:29.480 --> 01:15:30.560
Do you think?

01:15:32.760 --> 01:15:33.880
The puppy is.

01:15:36.520 --> 01:15:37.080
Of course.

01:15:37.080 --> 01:15:40.040
We need to test the water first.

01:15:44.640 --> 01:15:45.480
And send it.

01:15:52.240 --> 01:15:52.440
Okay.

01:15:52.440 --> 01:15:52.840
The water.

01:15:52.920 --> 01:15:53.680
Analyzing the image.

01:15:53.680 --> 01:15:54.040
Now.

01:15:58.280 --> 01:16:00.760
Now our agent is preparing the response.

01:16:02.080 --> 01:16:02.840
Let's check.

01:16:05.440 --> 01:16:12.400
From the description, it sounds like the German Shepherd puppy is likely around 8 to 12 weeks old.

01:16:12.440 --> 01:16:20.190
At this age, puppies typically display a mix of Characteristics such as soft, fluffy coat, playful

01:16:20.190 --> 01:16:28.230
energy and one ear that may not yet be fully erect, which aligns with what you have described.

01:16:28.830 --> 01:16:29.030
Okay.

01:16:29.070 --> 01:16:29.990
That's perfect.

01:16:31.910 --> 01:16:33.110
Now back in ten.

01:16:33.870 --> 01:16:41.150
So yes, the image gets analyzed and our agent responded to our specific question instead of just describing

01:16:41.150 --> 01:16:41.830
everything.

01:16:43.110 --> 01:16:50.990
So what we can do now is activate this workflow so we don't have to click test execute workflow every

01:16:51.030 --> 01:16:51.390
time.

01:16:52.470 --> 01:16:56.990
So now make it active.

01:16:59.870 --> 01:17:00.590
Confirm.

01:17:04.550 --> 01:17:07.870
And now that it's active we can just chat normally.

01:17:09.110 --> 01:17:10.430
So let me send.

01:17:10.630 --> 01:17:11.150
Hello.

01:17:19.020 --> 01:17:20.300
And we get a response.

01:17:22.420 --> 01:17:22.740
Hello.

01:17:23.020 --> 01:17:24.340
How can I assist you today?

01:17:24.380 --> 01:17:26.460
Okay, it's working fine.

01:17:26.940 --> 01:17:29.500
Now let's test our agent's memory.

01:17:30.300 --> 01:17:31.540
So I'm going to.

01:17:34.300 --> 01:17:37.860
Say something like, uh.

01:17:39.300 --> 01:17:40.220
My name is.

01:17:42.500 --> 01:17:45.780
Damien, I like dogs.

01:17:51.980 --> 01:17:52.180
Hi.

01:17:52.180 --> 01:17:53.660
Damien is great to meet you.

01:17:54.580 --> 01:17:56.340
Dogs are wonderful companions.

01:17:56.780 --> 01:18:01.740
Do you have a dog or is there a particular breed you like the most?

01:18:03.980 --> 01:18:08.140
All right, now let's ask what's my name?

01:18:19.360 --> 01:18:20.880
It's nice to chat with you.

01:18:22.280 --> 01:18:22.680
All right.

01:18:22.680 --> 01:18:23.320
Perfect.

01:18:27.920 --> 01:18:30.880
Now, let's quickly test voice messages.

01:18:31.800 --> 01:18:39.320
So the audio processing path I'm going to ask our agent.

01:18:44.720 --> 01:18:45.800
Do you like dogs?

01:18:52.240 --> 01:18:53.920
I think dogs are wonderful.

01:18:54.200 --> 01:19:00.240
They bring so much joy and companionship to people's lives with their loving nature and playful spirits.

01:19:00.800 --> 01:19:06.040
Each dog has its own personality, and it's heartwarming to see the bond they create with their humans.

01:19:06.800 --> 01:19:08.720
What do you enjoy most about dogs?

01:19:09.440 --> 01:19:10.520
That's absolutely true.

01:19:11.160 --> 01:19:20.430
Right now, I'm not going to dive into adding more tools in this lesson, but quickly you can click

01:19:20.470 --> 01:19:21.310
Add Tools.

01:19:23.590 --> 01:19:28.510
And access hundreds of tools and offers.

01:19:29.750 --> 01:19:39.110
However, in the next lesson, I'm going to teach you how to build an MVP server and add tools to read

01:19:39.110 --> 01:19:46.470
and send emails and manage your to do list, and also how to generate posts on social media channels

01:19:47.750 --> 01:19:54.990
and how to connect the WhatsApp agent we just created to our MVP server.

01:19:58.150 --> 01:20:02.350
So it will be able to do all these tasks for you.

01:20:05.270 --> 01:20:07.510
All right, that's it for this tutorial.

01:20:07.510 --> 01:20:09.190
Thank you for spending time with me.

01:20:09.350 --> 01:20:12.470
I hope you learned something new and see you in the next lesson.
