In the previous lessons, we extracted data from Apollo. We enriched it and we also discovered how to create personalized code messages that you can send to people. We created reports.
We created email follow-ups. But what if we can also take the contents from these websites and actually create social media content for our company? Content that would resonate with the people that we are reaching out to.
Because if these are our target audience, chances are that they would be interested in this stuff that we are putting out there as well simply because their websites speak about the same thing. And this is exactly what I'm going to show you in this video. Essentially, we're going to run with the same list of details that we had before.
And what we're going to do is build the following workflow. So, we're going to go to our Google sheet. We're going to only keep the records that have a website.
From those records, we're going to read the first top 10 items or the first 10 items. We're going to combine everything together. Then we're going to have a open an open AI module or note here where we will feed it the contents of those top websites and we'll have it output content ideas for us which would look something like this.
So based on those eight websites that we ended up with, we have these five potential pieces of content where we have a focus for example automation and everyday life behind the scenes of essential industries. We have information on who this appeals to. We have content ideas and we have the key messaging points.
So then we can come in here, we review these five different potential pieces of content and we hit create content. What then what will that what that will then do is to go to our automation and it will go down this route where essentially we're getting the information from our table and we're creating three different pieces of content. One for LinkedIn, Facebook and Instagram.
And once that is complete, we'll have this right here. So we'll have three different pieces of content tagged correctly to the platform from this one single line. So if I wanted to from just these running this automation once you would get 15 pieces of content five or yeah um three pieces of content for each social media platform.
So here we have the Facebook version and here we have the Instagram version and this is what we're going to be building in this final lesson of this module. Again, the whole point is that we started with this information and we're really extracting everything out of it. We're if the person, for example, didn't have an email, we found a way to grab that email through the LinkedIn or to the website.
We're grabbing the information from the website. We're scraping that. We're building content from it.
We're really kind of squeezing the that lemon and getting the most juice out of it. Anyway, so let's just start building this together. Let me just move this around.
And what we're going to do first is add a trigger right here. So let's trigger this manually. And what I want to do is get the information from that Google sheet.
So here, let's go to sheets. Let's choose get rows in sheets. And I'm just going to shoot choose my sheet right here.
The list is that or the sheet is that. And this will allow us to get all the 500 items from the sheet. What I want to do next is just ensure that I only proceed with those records that have an actual website.
Right? So I'm going to use a filter here. And what I'm going to say is only keep those records where the primary domain essentially exists.
So string and this is not empty. And if I hit test step, I kept 444 items here and I discarded 56. So in this case, let me double check.
Uh so primary domain exists. Primary domain exist. Yep, that looks good.
So now since we're building this automation, let's just limit this to 10 items. Technically, if you're building on top of this, you could leave them all. However, that would have to scrape a lot of different websites.
And as you can see, this process will take some time even with 10 websites. What I'm going to do here is have an HTTP request where I'm just going to first of all, let's execute the previous nodes. And here I'm just going to scrape the organization primary domain right here.
So if I just drag that in there, what I want to do before testing this is on error continue using error output. So now we get these two uh parts and this will allow it to keep going even if some of the websites cannot be scraped. What I'm going to do is hit test workflow and okay for some reason I got 10 errors immediately which yes so here I have a problem.
So essentially the way the data came in through epify was that this didn't have any HTTPS any protocols. So I just added that right there. And let's now test it one more time.
And now this is loading which in this case this is a good sign that this is actually going through and scraping that information. When I ran this in the past as I was building up the workflow for this video this does take some time. So it's even if this is not if it wasn't a demo video for this course I would still probably have a limiter right here.
What I could then do if this was a kind of production sort of situation is I would have a flag right here that would say I don't know used for social media and once I complete these 10 websites I would take them as yes. So then in the future I wouldn't scrape them once more and the new data that I get would be about new stuff rather than stuff or websites that I would have already been I would have already scraped essentially. So these denims are being scraped and generally we'll have some distribution between the success and the error route error if this isn't able to scrape the site for some reason or for one reason or another and then under the success we'll get a bunch of code.
What we will do next is combine all the code together and then we'll have a code node to remove the code that we don't need because before feeding this into an artificial intelligence node, we want to remove anything that doesn't make sense. One because it will make it faster and two because it will drive the call down as well. We don't want to put any or all the code we get back from this HTTP node.
So let's just leave that. Let that finish and then we'll come back to this. So I will keep recording or I will continue recording once this finishes.
Okay. So this just finished and as you can see we got seven items successful and three items resulting in an error. If we look at the outputs here the error branch we got some service unavailable sort of thing.
Uh connection time out. So these didn't break the workflow, which is good. They just went down there.
But under the success path, we have the information right here, which is as you can see quite a lot. And we also get a bunch of code that we don't necessarily want, which is why here I'm going to add a code node. And essentially, actually before I do, what I want to do is just aggregate the information from the success route.
So I want to use this data to go from seven items right here to just one item because what I want is just to put one item and its output into the code node. So now all the information rather than being in different parts or in different pieces. Uh let me see if I can show you what I mean.
Anyway, this is there are seven items here, right? And over here, once we aggregated the information, we got one item. So, all of that was combined and put together, which means that now if we run this code node, we can just pass along the data right here.
And what I'm going to do is just copy the code that I created before into this code node. And what this does is it takes the JSON data from this right here and extracts the text from the HTML. So this will be part of the blueprint underneath this lesson.
I'm going to hit test step and over here we have extracted text which is what we want to proceed with. If I keep scrolling down, first of all, here we can notice that this is purely the different text from the website, right? And this is if you look at this scroll bar right here, this is very very small compared to the rest of this document right here, which is exactly what we want.
We want to or want to remove all the extra code that we don't need. Here we also get the original HTML. And this is the way I built this or the way I think Claude built this chat uh or this code piece is that it kept the original HTML right here.
You could also have it that it just disregards the original HTML and leaves you with the extracted text. However, I just prefer to keep it in there to be able to see the difference as well. So here once I get the clean text what I want to do is have an open AAI module that will be fed the cleaned text and then we'll ask it to output content ideas.
So here I'm going to go to go to open AI. I'm going to message a model going to choose GPT 4. 1.
Once this loads, let's go with 4. 1. And I'm going to paste the prompt that I have right here.
I'm going to choose user uh system. I go to expression and here this is what I want. So essentially I'm saying I provided scrape content from several websites.
Um can remove that from several websites. I need to transform this information into engaging social media content ideas. Your task based on the scraped websit's content provided below.
Generate five different angles for social media content creation. Obviously, you can change five to anything you want. Each angle should be distinct and target a specific aspect of the information that will be engaging for social media audiences.
For each angle, provide a clear thematic focus. Explain why this angle would resonate with social media audiences. Suggest two to three specific content ideas for this angle.
Identify the best social media platform. I mean this can also be removed I guess. So let me just remove that.
Um even the explanation maybe I'll remove that. It's up to you whether you want to leave that in or not. Number three.
And finally here we have outline key messaging points that should be incorporated. There are some additional instructions here. And then I'm saying the output format should be in JSON.
So present the five content ideas or content angles in JSON format as follows. And I'm presenting the output format that I want here. I'm then saying again provide all five angles in the a single JSON structure.
So I'm very clear with how I want it to be presented. If I were to hit test tab, this will now do its thing. What I need to do Yeah.
And what is very important, let me just stop this, is to obviously pass along the scraped information, the extracted information from here. So here I'm just going to say the scrape content is below and I'm just going to pass along the extracted text from here. So now this has the information from those different sites all in one message.
I'm going to hit test step going to also hit save. And let's see what this gives us. Once this finishes, what we're going to do is kind of open up that JSON array.
So, we'll have different or a split out sort of message rather than one big chunk. And then we'll save it to air table. So, here let's see what we have.
We have content, we have angles, we have the focus, we have uh content ideas. So, we get all that right here. And as we asked it to do, we should have five different content pieces or content angles which I'm trying to find right here.
Anyway, let me just test this to see whether this works. So here we ask this to give us five different angles, right? Which also means that if this worked correctly, yeah, the problem is this here, we also need to output as JSON.
So this will not output as one piece of text or one B like a bunch of text put together, but it will output the content in separate pieces that we can extract into different items. So, let me run this once more with the output content as JSON enabled and we'll see the difference as well. So, it's great that I forgot to flip that switch on.
And NA really makes this easy in terms of whether you want text or JSON. So, now we get all that information split up in one piece. But as you can see this content or this angles um content angles content idea.
Yeah. So over here under angles we get the different angles as expected. So we get the first one right here.
We got the second the third the fourth and the fifth. So this is super easy to now split up. If we look at the table view, we can also see that there's index zero right here, which is the first message.
There should be or rather index zero, which is all the message, right? Then we get the angles. So angles is what we're after when it comes to splitting this up.
So get angle zero, angle one, angle two, three, four, and five. So let's just split that up. So I'm going to use this split out.
And we know that we're after the angles array. So I'm just going to drag that right here under fields to split out and hit test step. And now we get five items right here.
So we get those right there. And over here also we go from one item to five different ones. Which also means that if we now use an air table node and we create a record, it will be super easy to just drag and drop that into different line items.
So here I'm going to choose the table which is module 7 lesson 5. And here I already have the database that I showed you earlier. We have this possible angles table which has a record ID, automatic focus, audience appeal, content ideas, key messaging point and create content.
And actually let me just create another database. So I will show you how to build this from scratch as well. So what I'm going to do is duplicate this base.
Let's call this build together. And what I'm going to do is build this from scratch. So I will have a table that I will call possible angles and this table will have some key information.
First of all, I always like to have a record ID here because I like having a unique identifier for each item that I add. Then I'm going to add a long text which I will call tmatic focus. I will have another one which I will call audience appeal.
Another one which I'll call content ideas. So I I'll just duplicate that content ideas. I'll have another called key messaging points.
And finally I'll add a button. So this will be the button that will allow us to create content. we will be able to review the content or the ideas, the angles that are generated and then this will allow us to create that content over here.
I'll just leave this as empty for now. What I'm also going to do is just add a parameter because I know that I'll be or I'll want to pass along the record ID associated with the specific record. So over here I'll just add the web hook URL which I'll generate in a second and I'm going to pass the record ID and then append the actual value from here as part of the data that I send to my web hook.
So create field and now this is ready to be tested. So I'll copy the name here. If I go to NA10, I'm going to choose my new database, which is right here.
The list is called possible angles. And here I have the fields that are ready to be mapped. So we have the automatic focus.
We have the audience appeal, content ideas, and key messaging points. Now, probably if I run this because this is an array, I'll run into some issues. So, let me just test that.
Yep. And as you can see, we ran into an issue because this is an array. So, what this is saying is that it doesn't like that I'm trying to pass this whole array as text right here.
So, what I want to do is just change this array into a string. So here I'm just going to use the JSON stringifi put in the brackets and this will change it into a string that I can then send. As you can also see here there are the square brackets which I don't really like when sending over to our table.
So, what I'm going to do is just use a replace uh replace all and I'm going to replace the square bracket with something empty. And I'm also add going to add another replace all to replace the closing square bracket with nothing. So now if I look at the expected output here, we get this long string.
So this is looking good. Over here I have to do the same thing because if not this will still give me an error. So if I test the step this should now give me an error based on the key messaging points.
So as you can see it is saying there's a problem in the custom solutions which is this part right here. So let's just copy this JSON. stringify and paste it in here.
And I'm also going to copy the last part with the replace all as well. And now if I hit test tap and I delete the records here, we should get these five records added to our table. So as you can see that added the information right there in our database, which is great.
So now essentially what we have is five possible social media content angles that are based on the sites that we scraped. Sites that we know our target audience run. Which also means that the next thing would be for us to come in here maybe every day, maybe every week and decide whether this is the type of content we want to create for social media.
So we can read we can read this we can review it. What we could do is also have a button here which is I don't know disregard content or I don't like this. And what could happen is if we press that button this gets removed from view gets added to a separate record.
So we could also then train the AI with what we don't like. So it would produce more of the stuff that we do like. So let's go back to NA10 because this is the end of the first part of the workflow right here.
So let me just tidy this up. What I'm going to do now is add another entry point which would be the web hook. So this is what will happen once the user presses the create content button.
So this is the scraping plus content ideas. And now we'll have the actual content creation. So let's call that content creation.
Give it a different color. And the way this will will start will be with a web hook. So here I'm just going to add a web hook.
I'm going to grab that test URL and I'm going to go to my air table right here. I'm going to go there and I'm just going to replace the XX with my web hook. Hit save.
And if I just turn off the trigger right here and just hit test workflow, this is now waiting for you to call the test URL. So if I go to my air table and hit create content, this should call the information here with the record ID of my air table, which is this right here. which also means that now I can add an air table get a record and use that record ID to get all the information from that specific record.
So here my list is module 7 lesson 5 build together. The table is called possible angles and let me just hit test and now I have all the information right here. What I want to do now is split this into three different routes.
So I'll have the Facebook, the LinkedIn and the Instagram route. So let's first do an OpenAI call and I'm going to message a model. Again I'm going to use 4.
1. I'm going to have a system prompt and over here let's just say that this is the LinkedIn post generator. Here I'm going to paste in this prompt which if we look at it in the expanded view contains the following.
So we have the context, we have the task, we have the LinkedIn post requirements, we have a few examples, seven examples to be exact. And then we have the output format which is provide the complete publish LinkedIn post text with no additional explanations or commentary. And for reference here, I'm using the LinkedIn, the Facebook, and the [Music] Instagram agents that are found in the classroom right here.
So, if you go to the classroom section under Jaxi Automations and you scroll all the way to the bottom, you have these assets right here. So, here I'm using the LinkedIn, Instagram, and Facebook posts from the community. So those are the LinkedIn, Facebook and Instagram um documents.
All you need to do is come here if you want to just have a look at this. Hit the Instagram agent for example and this will open up that right there. What I did is just I just took that and added some context in terms of the format that I wanted.
So I added the content to or the context right here. Added the task. Then I copied that LinkedIn post requirement and then I have the output format right here.
And this will be the way I do it for Instagram and Facebook as well. So this will essentially generate a LinkedIn post for me based on the content that I have in our table. Right?
So if I click that button, this will generate a LinkedIn post based on theatic focus, audience appeal and content ideas. And again what I didn't do is actually provide that information as the user message. So this will have nothing to do with the information from our table.
So what I want to do here is just say theatic focus and I'm going to drag and drop this right here. I want to include the audience appeal which again drag and drop. And I want to include the content ideas.
I can also include the key messaging points here as well. So now if I hit test step here we are speaking about behind the scenes innovation and automation. The content ideas are main documentary series um photo car set before and after shots of retrofitted or modernized automation system highlighting upgrades and technological leaps key messaging points custom solutions drive industry efficiency and reliability and here as output for LinkedIn we've got ever wondered what goes into creating the automation technology powering today's industries when we design and build custom packaging machines or automated door systems it's far from a plugandplay process behind every project is a team of engineers is tackling new challenges, inventing solutions, and pushing the boundaries of what's possible.
So, it's taking the information from here, passing it along to the OpenAI node, and then creating that LinkedIn output. What I then want to do is save the information to air table. So, here I'm going to have air table.
I'm going to create a new record. And what I want to do is add a new table, which let's go here. Let's add a new table.
Start from scratch. And here I call this created content. And this is a very simple table because we'll have just three columns.
So we'll have a record ID which again will be a formula. You can just type in record ID. We'll have the actual content which will be a long text and then we'll have the single select which will be the social network or social platform or social channel I guess whatever you want to call it.
We'll have LinkedIn, we'll have Twitter, um, no, Facebook, and we'll have Instagram. Obviously, you can go wild, go crazy, choose as many social networks as you want or add as many ones as you want. The process will be the same thing.
So, here in my table, the list will be module 7, lesson five build together. The list or the table will now be the created content. And all I need to do is just grab the content from here and drag drag it drag and drop it there.
And in this case, I'm just going to choose LinkedIn right here. So this should now add a record in my table here. So if I refresh this, we now get that right there.
So, I get the content and I get that tagged as LinkedIn, which means I can then either connect directly to LinkedIn and have a button here that posts automatically when I press it. I could have this on a schedule, on a timer. It just depends how you want to build on top of this automation.
So now all that remains is to do something similar for the different social networks. So in our case, I'm going to make this a bit bigger. And let's just have one for Facebook.
So let's call it Facebook post generator. And let's connect this like so. And what I'm going to do is just copy the prompt that I have for Facebook.
It is very similar to what I have what I had before. Just the part which is this Facebook post requirement is specific to Facebook and again I got this from the file that is available here in the community classroom. So this is the Facebook agent right here.
So you are a social media content specialist with a decade of experience in creating compelling da on Facebook which you can see right here. Okay, I can leave the user prompts the same because they are going to be getting the information from here. And I can I can connect this to another Air Table creator record.
The only thing I need to change is that the social network will now be Facebook. Again, I can do the same. And now, let me actually just copy this.
Copy paste. Put that there. And now this will be for Instagram.
So Instagram post generator. Attach that like so. And this will be Instagram.
The final thing is I need to update the prompt in the open AI node right here. So paste that in. And again, this is from the classroom from the Instagram agent right here.
And now I think this is pretty much ready to test. So if I go here and hit test workflow, this is now waiting for you to call the test URL. So let me just go to my air table.
Let's just delete this. And let's now press on a different create content. Let's go with something like this.
Automation for sustainability and accessibility. Okay, fine. Uh, hit create content.
And this is now doing its thing right here. So, it's creating a LinkedIn post over here, which it has already done. It's creating a Facebook post, which it now saved as Facebook, and it's doing the same thing for Instagram.
So, this is all done. So, what if your facility could be both echofriendly and sustainable? And this is Facebook.
for LinkedIn when it comes to shaping the future of built of our built environments two priorities continually rise to the top sustainability and accessibility. So it's a bit longer considering it's for LinkedIn and finally we have the Instagram one as well. So automation leads the way greener buildings smarter energy uses etc etc.
So like this we have at the click of a button the ability to generate social media content on demand based on what we know our target audience is interested in because we have scraped those websites and use their content in order to um be the inspiration for this social media stuff. Anyway, that is the end of this lesson. Hope you found it useful.
Let me know what you think in the community and I'll catch you in the next video. Cheers.