automate 70% of your marketing with this Ai system

In this tutorial, Rory Ridgers demonstrates a fully automated marketing workflow built in n8n that scrapes competitor LinkedIn and Instagram posts using Apify, aggregates the data, and feeds it to AI agents that generate a weekly performance report. The report powers three downstream content generators: (1) a LinkedIn post generator that creates three post ideas, descriptions, hashtags, and image prompts; (2) an Instagram post generator that does the same with a more casual tone; and (3) an article planner and writer that produces a detailed outline and a full‑length article. Each content piece is rendered into images via OpenAI's image model, uploaded to Google Drive, and logged in a Google Sheet alongside the post metadata. The workflow is scheduled to run weekly, and viewers are directed to a community where they can download the n8n template and a full course on using the system. The video walks through each node, showing how to configure Apify scrapers, handle dataset IDs, stringify arrays, enforce structured JSON output, split items for looping, and manage variable filenames for Google Drive uploads. The end result is a hands‑off system that can generate 3 LinkedIn posts, 3 Instagram posts, and one article every week, dramatically reducing manual marketing effort.
Chapters
What's up guys? In this video, I'm gonna be walking you through a system that I built that will automate a massive chunk of your marketing. So if you stick around till the end of the video, you'll learn how to build a system that can save you countless hours a week on the manual tasks that should be automated with AI. By the way, if you don't know who I am, my name's Rory Ridgers and I run an agency called Autonomously AI, where in 14 days we find and eliminate operational bottlenecks for business owners to keep them working on the business rather than in the business. So let's not waste any more time. Let's jump into it and I can show you how the system works. And by the way, if you stick around, I'll show you how you can get the template for this as well. Okay, so we're inside of NAN and this is how the system looks. And as always, I'm going to give you a brief overview of the system and what's going on, and then we'll run it through and we'll have a look at the execution together. And I'll show you inside with the prompts and the configuration and everything like that. So to begin with, what we start with is a competitor analysis. So we use Apify to basically just— we have a list of competitors. For this video, we're going to be using a clothing brand. So we're going to be pretending that we run a clothing brand. And our competitors are the sort of the big clothing brands. So we do a competitor analysis where we look at the LinkedIn and the Instagram of all of our competitors and get all of their most recent posts, including things like the description, the images, the videos, the comments, everything like that. And that gets passed to an AI agent here that just generates a full report on essentially what's working, what isn't working for these people based on the likes and the engagement on all of their posts, and sort of some of the trending topics that are going on. And then that report gets passed 3 different ways: to the LinkedIn post generator, the Instagram post and then the article post generator. So the LinkedIn post generator does exactly what it says it does. It will generate LinkedIn posts. It will start by taking that report and coming up with 3 separate ideas for 3 different LinkedIn posts. And then it goes through here, it loops through, and it will generate each LinkedIn post here. It's going to generate the idea behind the LinkedIn post. We know why the agent chose to do this specific LinkedIn post. It's going to generate everything like the description, the hashtags, the images, everything that goes along with the social media post, and then it just adds all of that to a Google Sheet. And then it does the exact same thing for Instagram. So LinkedIn and Instagram, very, very similar. It's going to come up with 3 ideas and it's going to go through, generate the titles, the idea behind it, the description, the hashtag, the images. And then we also have an article agent down here, or 2 article agents down here. And the first one is just going to plan out 1 article. So let's say we run this through once a week. Every week you're going to get 3 LinkedIn posts, 3 Instagram posts, and then 1 article. You can change that if you like, but I just felt those were pretty good numbers. So first of all, it's going to create a plan for an article, and it's going to do sort of step by step what's going to happen at each point in the article and sort of the idea behind the article, why we're choosing to write about that. And then we have an AI agent here that actually goes ahead, takes that plan, and writes out a full article that you can just copy and paste and chuck onto your website. So right now this is on a scheduled trigger, so it can run— at the moment it's on every 3 days. I think it's better to do it every week. So I'm just going to change it to week and go to 1. So every Sunday, this is going to run through, give us 3 Instagram posts, 3 LinkedIn posts, and then 1 article. So what we're going to do is we're going to run this through, and then we're going to have a look at the execution together. By the way, guys, if you want to grab the template and start using this straight away, all you have to do is come over to my community here. And along with an entire course on exactly how to use NAN and go from a beginner to an absolute master, and how to actually sell it to businesses there'll be a template section in here. And in this template, you can see there is dozens and dozens and dozens of different templates that you can download. You have full access to all of them. And this one from this video will be inside there. So if you want to go ahead and grab it, all you have to do, put the link in the description to my community, and you can get this template as well as loads and loads more, and also a full course on N8N. Okay, so it's just finished running through. And what I want to do is I want to show you through each step so you know exactly what's going on. So for the first one where we're scraping our competitors, posts on LinkedIn and Instagram. We start with LinkedIn. If we come in here, this is an Apify node. If you don't know what Apify is, it is essentially just an online marketplace for scraping APIs. So you can use it to scrape essentially anything, and it's all community-made. So essentially people go on there, they create these scraper APIs that you can pay to use. So this one specifically, I'm going to show you it, it is a LinkedIn post scraper. So it's the LinkedIn Company Post Batch Scraper. You have to be really careful, uh, when you're scraping LinkedIn, or whether you're doing personal accounts or company accounts, because you scrape them in different kind of ways. So this one is going to be a company post Batch Scraper. So we've connected that up, as you can see, the LinkedIn Company Post Batch Scraper. And this here is the input. If you're not sure how to input stuff, all you do is you come back over to Apify here, and you can see we have manual and JSON input. So manual, this is going to be if you're running it through Apify, which of course we're not. But what I usually like to do is I like to put my inputs in here because these inputs are going to stay the same majority of the time. Of course, like, you might add more competitors, remove competitors that don't really align, that kind of thing. The majority of the time it's going to stay the same. So what I did in here, I was I just put in some competitors for our clothing brand. So things like Nike, Adidas, Under Armour, Puma, Lululemon, that kind of thing. Put that into there, and then I went to advanced options, results limit per company. So it's just going to be 10 posts per company. So we've got 10 in there, so we should get about 100 results. And then all you do is you switch that from manual to JSON, and they already have all of your inputs in there. So all you can do is you can just copy that, come back over to 8N, and paste that in as I've done here. And then what happens is this runs through until it's actually finished scraping, but we don't get the results back, we just get a status that says succeeded. So what we actually do is we put down another node which is get dataset items, and then we put in the dataset ID from the step before. So if we come up here, these are the outputs from that step before, we can just type in dataset and you can see we get this variable here, the dataset ID, and we just drag that in there. And this is just a unique key that is tied to that data that we just generated. So when we hit Apify again, with this key, we now get the data back. So we got 50 items just because I limited it to 50. And this is the kind of information we get, that we get like the post URL, when it was posted, the text of the post, um, the author, the stats, so like the reactions, the likes, the support, the love, the insight, celebrate, entertainment, comments, repost, and then the images. So obviously this one was a carousel because there were a lot of different images as you can see. And then that is essentially all we get. And then the company input, which was Nike. So we get 50 items that all look like that. And then what we do is we aggregate that. So 50 items, we just put all of that into one list. So as you can see, data like this, we get data 0, data 1, data 2, all the way up to 50. This just gives it to us in one list, which just makes it much, much easier when we want to report or generate a report on it a little bit later. And then same kind of deal, but this time we're scraping Instagram. So if we come in here, uh, you should already know what I mean by these inputs and the outputs and getting the dataset ID, because of course I just showed you But to show you the actual scraper that we're using, if we open this up here, we're using this one, which is just made by Apify. It's the Instagram Post Scraper. It costs $2.30 per 1,000 posts, and we're scraping again 100 posts, so it's going to cost us about 23 cents. So in here, I've just put in the URLs of some of our competitors, and it's the exact same as before, uh, with the LinkedIn one, but of course this time it's URLs instead of just the name of the company. So we've got like Nike, Adidas, Puma, Lululemon, Gymshark, North Face, that kind of thing. Um, so we put the inputs into there. Again, the maximum posts per profile is 10. This time we can also do a date range in here, but I haven't done that. So all we do is we switch it to JSON, we get this input, copy that, come back over to an— and then we just paste that in. And then again, we get an output looks like this. It just says the status is succeeded, perfect. So then we get the dataset items, put in the dataset ID, which was this ID here, and then this is the output we get. So the type, which is a video, the caption, why risk it because you can, hashtag just do it. So obviously this is Nike, um, and then the hashtags here, some of the mentions. So this looks like it was maybe like a community post or something to do with their athletes. The URL of the post, the amount of comments, the first comment, and then all of the latest comments. And then we get the display URL, the images that are in this post, the likes count, the video view count, the timestamp, and some of the child posts. And then a couple other things like the tag users the owner's full name, the owner ID, that kind of thing. So we get quite a lot of good quality data from here. And then again, we just aggregate that. So now we just have two long lists. We have all of their Instagram posts, and then we have all of the LinkedIn posts in two lists that look like this. And then what we do is we go over to a reporting agent. So if we have a look inside here, what we've done is we've just given it that list of Instagram and then the list of LinkedIn. And this is why I say it's easier to aggregate it, because then all we have to do is just drag in these two aggregate node outputs, which is just data and data. So we literally just drag that in. Make sure to add stringify in here just because you're adding two arrays, which if you didn't have that, this here would just pop up as object, object, object. Um, and it's a little bit scary when that happens because it doesn't really tell you what you're meant to do. And a lot of the time before, I used to get tripped out by that. I didn't know what to do. So if that ever happens to you where you have two arrays in an input, all you have to do is just add JSON.stringify at the beginning and it will just turn it back into an array, as you can see. So that is our user prompt where we're giving it the list of LinkedIn posts and the list of Instagram posts. And then we have this pretty simple prompt in here that just says, you'll receive 2 large outputs containing Instagram and LinkedIn posts from my competitors. Your job is to analyze all of the posts and then generate a full report on what all of my competitors are posting about and which type of content/topic is occurring the most and performing the best. And I've just given it a little bit of context, like you are part of a system that runs every single week, so you'll be generating reports like this weekly. The reason I say this, because I don't want you to output generic examples and topics of what they're posting about. It needs to be the exact kind of content that these guys have been posting in the past week so we can replicate the top performing post. Because I found when I first testing it, it was just outputting as if it was only doing it one time. So it was just saying, oh, they're posting about sports, they're posting about their clothing brand. And because we're running this weekly, we want it to be like specifically what are they posting about in that week, like any trends that they're jumping on, any new product launches, that kind of thing is what we want to know in our report. And then it goes down the LinkedIn post. And what I'm going to do here is I'm going to show you just the LinkedIn post because the Instagram post is the exact same. We'll briefly run through the Instagram post, but I want to dig deep more into the LinkedIn post system because, as I said, these two are the exact same, just with very slightly, um, different prompts. So in here, what we have is the first agent that's just going to generate us ideas. So what we do is we give it the report that that report generator outputs, which looks something like this. This is a detailed analysis and report of your competitors' Instagram and LinkedIn activities over the past few weeks. And then it says things like, um, competitors covered, so all of the competitors that it covered. And then Nike, their theme was elite athlete endorsements and events. Highlighting performance of elite athletes, and then some examples, and then events with employee participation. As you can see, I'm not going to read out this whole thing because it is huge, but it just gives us a full analysis and breakdown of everything that they're posting about. So we pass this to our LinkedIn Post Agent, and we essentially just say to it, you're going to receive a report on what our competitors are doing that I just showed you. Um, your job is to generate 3 LinkedIn post ideas. So look at their top performing content, understand what type of content in general does better, on LinkedIn, which is more professional and more corporate, as opposed to something like Instagram, which is a bit more fun and lighthearted. And then plan 3 post ideas and output them. And then for all the agents, I've just given it a bit of context that says, you're part of a system, scrape my competitors to help me generate social media content. My company is a clothing company called Clothing Inc. and we specialize in sportswear and loungewear. And then it gives us an output that looks like this with idea 1, idea 2, and idea 3. And the way we get it to output like this, where it's 3 separate variables— as you can see, usually when you use an AI agent, it's just going to give you output and then like a list or like a block of text, but we've actually got it to do it as 3 separate variables. The way you do that is you flick on this button, which is require specific output format, and it opens up this another prong here, and then you add a structured output parser. If you come inside here, this just gives an example of how exactly we want it to output in JSON. So just idea 1, idea 2, idea 3, and then just examples of placeholder variables in there, and then it will actually output like that. So as 3 separate variables like this, so we can use these 3 separate variables take them all individually. And then we just have some simple JavaScript here that's going to take this output, because right now it's 3 separate variables but it's one item, and we want that as 3 items so that we can loop over each of them. So we put down this simple JavaScript here that just breaks it up. It will take the first one, then it will take the second one, and then it'll take the third one and output it as 3 items. As you can see, if we look at table view, 3 items. So it just breaks them from one item as 3 variables to just 3 separate items. And then we loop over each of them, so we add a loop over items node And then what we do is the loop over items node is gonna grab the first one first. We pass that to our LinkedIn post agent. So we just give it JSON idea, which is that first idea here. We can see here it runs through all of them. That was the first one, that was the third one. So we give it each of the ideas and then we basically just say to it, you'll receive an idea for a LinkedIn post. Your job is to generate an idea behind the post as well as a description, hashtags, and a prompt for an image. So very, very basic prompt. You can come in here. And you can refine it a little bit and make it your own and, you know, adjust it to how your company or your personal profile you usually post on LinkedIn. But I just left it pretty bland just so you can sort of see how it works. And then again, I've just given it the exact same context as that other agent. And then again, as the other agent, we flicked on the require specific output format. And if we have a look here, what we've done is we've just done it as idea, description, hashtags, and image prompt. And then it outputs like this with the idea, the description, the hashtags, and then the image prompts. Perfect. And then what we do is we add a generate an image node. So this is just OpenAI generate an image. We're using GPT image 1, and all we do is we simply drag in the prompt. This is why we get it to output as separate variables using that require specific output format, because now we have these variables that we can use independently. So I just drag in the image prompt here, and then what I get back is this binary data. So we can view this. Actually, you can see pretty good image. I think that looks pretty good. We get this binary data. But of course, now we actually need a link because right now it's binary, we can't just view it and it allows us to just hit view. But if we were to put this into a spreadsheet or something, it'd just be a bunch of ones and zeros. So all we do simply to fix this is we just add a Google Drive upload a file node. And then for the file name, what we want to do is we want to have something variable in here. So if we were to just name it like, you know, LinkedIn post image, because we're doing 3 items, we're running over 3 times, it'd have the same name 3 times, and it would kind of break So you just have to have some kind of variable item in here. And the, the best way I decided to do that— you can do whatever you want— but I just put— if we go to LinkedIn post, I just put the idea in there. So now the image in my Google Drive is just going to have the name of the idea. So yeah, you see what I mean? It needs to be a variable, otherwise it's going to be named the exact same thing 3 times and it'll just break your system because it won't allow you to do that. And then doing it that way, we get this web view link. And then what we do is we simply add all of that into a Google Sheet. So I want to show you the Google Sheet. Actually, this is how our Google Sheet looks. You can see we have LinkedIn post Instagram posts, and then articles. So we've got platform, idea, description, hashtags, and image as a header. I just realized I spelled hashtags wrong. Can you believe it? There we go. Hashtags, description, and image. Awesome. We come back over to 1AN. You can see we've already filled out the platform as, uh, LinkedIn because everything that comes down this route is gonna be a LinkedIn post. So we might as well just fill it in as LinkedIn. And then we simply just drag in the idea, the description, the hashtags. And then if we come to this Google Drive node, we drag in the web view link as the image. So then in our spreadsheet, it looks like this. Where we have a link so we can actually view it. So if we view this one, you can see this is what we get. Perfect. And then like I said, these two systems are pretty much the exact same. The only slight difference in here is just in here, rather than saying, um, like LinkedIn's corporate and stuff, we've just said, of course, you're gonna be doing it for Instagram, which is more fun and lighthearted content. That is literally the only difference. And we've just mentioned, um, Instagram rather than LinkedIn in here. So I'm not gonna bore you and walk you through this as well because it is just the exact same as this up here and it outputs the exact same thing. Um, but of course tailored for Instagram more. And in here this says Instagram rather than LinkedIn. And then the other component of this, which is the article, uh, planning and writing down here. So if you have a look inside here, we basically just give it the report from that step before. So all of these at the beginning are just grabbing the report. So we give it that report and we just say very simply, you will receive a report on what our competitors are currently doing on social media. Your job is to generate a plan for an article based on the top performing performing piece of content from the report. Please identify what the best type of content to do an article on would be and then output a full in-depth plan. And then I've just given it that exact same piece of context. That gives us an output that looks something like this. So most effective topic for an in-depth article for Clothing Inc. would be how champion athletes shape the future of sportswear innovation— real stories, real performance. And then it's given us this full plan here on an article to write. So you can see it's very, very in-depth. I'm not going to bore you and sit here and read out the entire thing. But you can see, um, very in-depth. So article plan, it's given us the title again. Article type: feature, thought leadership focus with embedded customer/ambassador stories. And then the intro, which is 150-200 words. It's given us the hook and it's given us, uh, you know, the second part, which is 300-400 words. So very, very in-depth plan here that gets passed to our article writer. So we give it that entire plan, and then this prompt is a little bit longer. Than the other ones. As you can see, we just say, you are an advanced long-form content writer. Your sole task is to take an article plan or outline and turn it into a fully written, polished, publication-ready article. And then we've just given it some sort of core directives and some things to follow here. So things like, follow the plan exactly, expand on each point into detailed, coherent content, write a complete article, no meta commentary, don't summarize the plan, don't add instructions or disclaimers. And then just sort of some tone and style guides here. So I've fluff, filler, or generic writing. Write with clarity and authority. And then some restrictions like do not invent new sections, uh, do not delete or simplify any parts, do not break character or add additional instructions, that kind of thing. And then it gives us an output that looks like this with this massive article here. So again, I'm not going to sit here and read out the whole thing and bore you, but you can pause the video and have a quick read through it and get an idea of the kind of thing that it generates here. But you can see there's a lot of content that generates here, so it's definitely not lacking on the volume And then we simply just add all of that information into the Google Sheet again. So the platform this time is going to be article. And then because there's no idea, hashtags, or image with it, we just put in the description the output of the article writer. So using this system, you're able to automate all of your competitor analysis, then also automate all of your content generation for all of your social medias as well as your website.
More from Rory

Dynamic Workflows are crazy. This is how to actually use them (beginner's guide)










