Okay.
We're next going to take it one step further.
Let's go back to my project to my first folder and make a new workflow.
Create new workflow.
All right.
The first step is going to be again the same thing the Google Drive trigger.
We want to be triggered when a file arrives on changes for a particular folder.
And we're using that credential every minute changes to a specific folder.
We're going to select the amplify one there again.
And again.
It's going to be when a file is created in the watched folder.
Let's do that.
Okay so we've selected Amplify File Drop as the folder that it's looking at.
So this trigger is now set up.
And now the next thing I'm going to add is another Google Drive node.
This time the node operation will be an action.
It's going to be to download a file.
And here it is.
And we now need to set it up.
So the file it downloads is the file we're being notified about.
Okay.
So the file we have to select, we're going to have it be an expression.
And we're going to want it to be by ID.
And so this expression has to give the file ID which needs to be collected.
And now we don't know the format that the data comes in there.
Although we can get a hint because we can look back at what we had before and see what the data looked
like.
So if we save this for a second and X out and come back to my project, back into my first folder to
the previous workflow, and we open up the push notification, we can see over here on the left what
kind of data comes in, and use this as our as our key to find out what kind of thing we want.
And we can see that there is in fact a field called ID here.
And so that gives us a good sense of what it might be.
Uh, let's just check if there's anything else that might be what we're looking for.
It doesn't look like it.
It doesn't look like there's a file ID, so it looks like we can assume that ID is probably what we're
after.
So now with that, do you know what we have to do next?
Well, you guessed it.
We come back here, we come back into my first folder, we come to our new workflow.
Here it is.
We open this up and we're going to select an expression.
And that expression is going to have double curlies like that dollar json.id.
And uh this this is what we want to select the incoming ID, that is the file that we want to download.
And for now we're not going to add another node.
We're going to leave it at this.
We'll save it and we will come back over here.
And we will now duplicate this.
Make a copy of this.
Come back here.
And now execute this.
And then we'll need to see what happens.
It ran successfully.
Let's open this up and check this out.
We've got a file that we've downloaded.
We've got some data okay.
Next we press plus again.
And now we're going to to create a node here called extract from file convert binary data to JSON.
How about that.
It appears to be something that will do exactly what we want at this point.
Uh, and here we have the different kinds of data that this is able to read in as it is.
And at this point, we can we can choose, uh, how we want to, to come into this, and we can have
it so that it will take a PDF file and extract text from that PDF.
And that is what we're going to do at this point.
I'm going to have a PDF file.
And I'm going to add in an extract from PDF.
Uh where will it find it.
We're going to say it's going to be in in data.
Um, and this this will be the binary data that it's going to bring in.
And, uh, this this is what we need to do.
We'll just check the options.
That all sounds fine.
Uh, next up, let's go back here now.
We need to make ourselves a PDF and then drop that in the amplify folder and see what happens.
And so next up I brought up Microsoft word.
But you can use any application really.
Anything you can think of that might allow you to put some text in there.
And I'm going to say this is a very important message.
There we go a very important message.
Now, the way that you convert this to PDF, there are so many ways you go file export, you can print
and then print as PDF.
You can just do save file save, which I'll do right now.
This is a very important message.
And I can now just say in the file format I can pick here and say file format PDF.
And then I can say message dot PDF.
I don't think I need to do the PDF.
I can just do that.
And it's now saving that as a PDF file on my computer.
Okay.
Now we go over to Amplify File Drop right here I've got my finder window open on the on the side.
I've got my message PDF.
I'm going to drag and drop it in here.
It's uploading.
It's their message PDF.
I come back here, I execute the workflow and let's see what happens.
Okay.
It all ran.
Let's double click to see what we've got here.
And it read it all in and we've got text.
This is a very important message pulled from the PDF parsed by N810.
Can you believe how easy this is.
All right let's press on.
I'm really enjoying myself here.
All right.
So the next thing we do is we come back here, we add on another node here.
You'll never guess what node this is going to be.
It is of course going to be a pushover node.
There it is.
We're going to push a message.
Uh, and, uh, it has remembered my my pushover account, but I have to paste back in my user key,
which I will do.
But the other thing I have to do is put in the message, and of course, it's going to be an been expression,
and I hardly need to tell you at this point what it's going to be.
But you look over here on the left, it is a little bit more involved, but we can just simply drag
and drop text and put it in their JSON text.
This is a very important message is what will come in this case.
Uh, and that seems good.
I'm just going to put in my user key there and then save this node.
Okay.
And obviously when I say save the node I just mean press escape.
I also tend to press save anyway.
So it does actually save the whole the whole workflow.
All right.
So with that we go back over to Amplify File Drop I find my message I'm going to I'm going to drag and
drop the same file a second time.
In it goes uh keep both files.
So it's going to, going to have another version of it.
There it is.
Message one back to my workflow.
Execute workflow.
And push message just came through here.
It has this is a very important message.
Ha ha ha I love it, I love it.
And, uh, as it would happen, I was confused for a second because that was not the only push notification
I got.
You probably had the same experience.
I also got file has arrived because the production, the other one is also running.
Uh, and so it also woke up when it saw this.
So, uh, that's cool.
So just to revisit, just to recap, take a look at this and let's quickly walk through what just happened.
And so to recap the workflow, we have a Google Drive trigger that is woken up anytime it pulls every
minute.
And if it finds a new file has gone into our setup, Google Drive.
Thanks to our OAuth two credentials, it will then notify the next node along, which is a download
file node.
This node doesn't actually download the file, it just has an ID in it.
We pluck out that ID with an expression, and then we download that file.
That then goes to the extract from PDF.
And you'll see here in comes a data object.
Out goes a actually JSON that represents that file and it includes the text.
This is a very important message, which is the stuff that we then notify.
And we can do it one more time.
Just, just just for the fun of it, okay.
And one more time we come over here to the file drop.
We come to the I'm going over to my, my my finder I'm dragging message in here.
I'm going to say keep both files.
I'm going to do that back over here.
Execute the workflow checks this and there's the push notification.
And maybe we'll get a second one in.
There's the second one that's Rob production flow as well.
So I've now got two notifications.
Uh the first notification says this is a very important message.
And the second one says file has arrived.
Very cool.
It works.
Uh, I know it's a simple thing, but it's kind of satisfying.
It's kind of fun and the to do for you if you want to try and get creative.
We've been we've used a PDF flow and you'll see that the extract from file here, it can work with with
with PDF extract from PDF.
It can also extract these other kinds of things as well.
But of course you have to choose in advance which one you set.
So what you could have is one of those if instructions you could put in here an if and you can look
at the different type of file and pass it to the right kind of extraction based on what the file kind
is.
So you can you can put something in there that looks at the different type of file coming in, has an
if statement based on that file type.
Uh, it would then based on this Mime type, if it's if it's application PDF then it then it routes
it to PDF extraction.
Otherwise you could extract something else.
That would be a cool extra feature.
And that way you could drag and drop different file types into your amplify file drop.
And it will wake up and parse them and message you whatever they are.
But have fun with this.
This is some great integrations that we have now put in place.