Transcript for:
Automating Article Creation with Airtable

in this video I'll show you an automation where you add topics to an air table base it will automatically research all of those topics and create an outline for you you can then review the outline and it will then go through this Automation and build out the article section by section and publish it directly to Wordpress it will include imagery a proper key takeaway section if you want YouTube videos throughout the article well formatted text and bullet points and images throughout the article as well we're also adding source to the Articles and special prompting to humanize the output when it's published The Articles to Wordpress it automatically drafts the text for social media you then review this text and when you're ready move it to push to socials and then it will publish those to as many social networks as you want I'm going to be going through this entire automation but if you want to import this blueprint at the click of a button then check out the link in the description to our community we'll get access to all of our automations including this one I'm using air table for this but you could also use a bunch of other systems including Google Sheets to start from the start I'm going to add in a topic and I'm going to change the status to ready for outline now once I run this it will automatically go through this process and call perplexity to research the article topic now perplexity is like chat GPT but it is access to the live internet so it's particularly good at being able to research a specific topic and then provide a lot of interesting information data points and sources for those topics it's quite easy to get started with perplexity you set up an account and once you get set up you can go to API and copy out your API key it's very cheap to run a query through perplexity I think it's less than a scent per call to the API once you've added perplexity to your scenario then you need to select a model I've selected this one and make sure to select one that ends in online because those are the ones that have access to to the live web when I created the scenario it was Lama 3 son or large but now Lama 3.1 I can see is available here so that's definitely one to try out so for the prompts I've added a system prompt I believe that in perplexity the system prompt which is what's used to give the overall context for what you want the language model to do I believe that that's only used during the text generation phase and not during the searching phase so if you want to give certain instructions for how you want perplexity to search the web then do it within the user section and not the system section and the role here I've said you will create a summary of facts figures and information to include for a blog post do not respond with introductory text do not number the headings I've then added a user role which is what we wanted to do in this instance the topic is the following create a summary of facts figures and information to include for a blog post this title is then the title from Air table be detailed each section should have the following then I've provided a specific format of output that I wanted to provide which is key points data information facts figure statistics and it will then provide sources so when I ran that the result of that was this which is detailed information and insights on this particular topic it's sourced lots of different applications and it's broken it up into different sections such as challenges of remote work top companies remote work statistics and key points now the next section is to use an outline writer you could get perplexity to create the outline itself but I found it it's better to move that into a different stage and once you have the information to get the language model to create an outline in a specific format so this uses gp4 you need an open aai connection for that if you don't then go to open.com set up an account and then get an API key then once you've added open AI then you can set up an API connection from there I've added a chat completion gp4 o which is the current top model and the system role to give it context is you will create an article outline for a topic based on the following topic and Analysis you must retain all the information from the analysis and include it within the outline just do not number your headings do not include generic headings like key points overview Etc and create an article outline for the topic taking the analysis below reorder sections of the analysis combine them where necessary and structure the outline to be engaging in order to follow the inverted pyramid structure which is a specific structure of writing that they use in journalism and you've probably seen all over the Internet there should be a maximum of six sections combine parts of the analysis above if necessary to reduce the number of sections to a maximum of six and I've added some other stuff here we also have a specific instruction section which I've not included here but if you have very specific instructions that you want when it's creating the outline you can provide those here and I've used an if statement within make so that if the instructions have been populated then we'll add this to the prompt which is also use the following instructions I've noted that the outline should be in the following format which is the same format as previously retain the information data insides from the analysis when including it and we then have included the output of perplexity make sure to put Max tokens as zero which uses the max limit of the model and then press okay now the result of that when we ran it was a much cleaner output so it's taken the information from perplexity and creating a cleaner outline that we can then update if we want as you see here once it's done that it will then populate the article outline here and then you can edit and update that as you want so you could add your own statistics add your own opinions delete sections if you think that they're redundant or not relevant to the topic and then when you're ready you move this to ready for article generation which is the second step and by the way we can run this scenario automatically you can use instant triggers instead of us pressing the Run once button check out the link above and the link in the description to another video where I explain how to do that in detail when the cycle is run it checks to see what the status of the article is so previously was ready for outline it went through this section of the workflow next because it's down as ready for article generation as you see here I could zoom in a bit ready for article generation it will go through this part of the process now I've press run once and it will then go through this process so what it's doing here I'll go through all this in a bit more detail but at a very very high level I'll explain what it's all doing we're creating adjacent outline and this is an outline in a specific format breaking the article up into sections we had this original outline here but we want to process the article and to write the article section by section in order to do this we're going to break it up into adjacent structure like so the result will break this up into different objects and then we convert that par it into Json and now the article is divided up into four different sections as you see here and we have section heading and the content so the section heading I will zoom in a bit more there so you can see it we have the section heading and the content of that section in the article brief as it's doing that it will then go through each of those one by one it will then write that article section formatted correctly for the website and I've set up a router here where there's a 50/50 chance whether it will go and try to grab a YouTube url relevant for that section or to generate an image using the new flux one image generation model this will add a bit of variety to the article instead of just having the exact same type of media in every single section it then pieces all of those sections together and then creates an article introduction based on what's in the article ready grabbs a YouTube video for that article it then creates a featured image for that article using flux one as well gets the file uploads that to Wordpress and then creates the post in WordPress after it's created the post it creates a summary of the article and then uses that to construct an Instagram pom prompt Facebook Twitter and Linkedin and then Updates this a table record so once we go back to air table we see it's now been updated the article status is generated and we can look at the article link so this is now saved in draft mode on a test site that I'm working on this is an AI generated image using flux one the image model we have an introduction paragraph We have key takeaways I see it's bolded all of those in this case it often does not do that um it has added a YouTube video and broken it up into different sections we have statistics we have the sources that provided them we have images generated using flux one as well we have Bolding of important words as you see here which kind of stand out a bit more and again you see another image included in the article there now the benefit of this is that you could have these articles as long as you want you could have 10 different sections of them and have very specific instructions and specific points that you want in the article and this system will be able to handle it unlike single shot prompts which usually very much limit the output and you generally will not be able to add all of this kind of rich media to the article it's then created this featured image and added it to air table and it's created a text for a Facebook post an Instagram post and other social networks and we can change the promp in however way we want for this and update the text however way we want when you're ready to publish into to socials you select push the socials and when this runs again it goes through this process if you want to look at that process in more detail we have a social media video which has a very similar workflow to this and you can look at that in more detail so how does this entire section work okay first off we have this create Json outline this is using GPT 40 similar to previously and we're getting it to convert a text outline into a Json list of sections we have this user role convert this article outline into Json divide up the contents into section based on the headings within the outline and output in the following format I'm getting it to exclude the introduction sections because we're going to be building the introduction section ourselves later on and we'll be extracting sources separately do not include Nest adjacent objects Within These so I've added a very specific format of output that we want very important go to Advanced and select Json object as your output it's really important that you prompt it in this specific format because from my experience GPT 40 does not respond with a list of objects it responds with one Json object and we can then ask it to respond with an array of sections within that so I've asked it to convert text outline into ad Json list of sections and article will be the main object within that next up we pass that into adjacent object GPT 40 will respond with a long string which is like so we need to parse that into a structure that make will be able to iterate through once we've passed that we have a list of four different sections for the article as you see here I then have another prompt which extracts the sources from the article so respond with the company or organization names and article or blog post titles of the sources contained with a provided article do not include URLs if no sources are present then return blank I've asked it to respond in this particular format and I'm then providing the article outline unfortunately when perplexity is crawling the web and searching for sources and information when it returns that information via the API it does not provide the URLs where it got the sources so the URLs are often hallucinated and just garbage I'm getting it to remove any of those kind of hallucinated URLs here but perplexity are rolling out that feature within their API it's currently a closed beta feature from what I can see if you have access to that then make sure to include within the Automation and then you'll be able to pass that into this and you'll get the full list of URLs so that there'll be clickable links so once we have the output for that we'll be able to just add that to the very end of the article next up we have a YouTube list so this is a variable we're setting and the reason for this is that when it's going through and searching for YouTube videos we want to make sure that it does not add the same YouTube videos over and over and over again and this is something I noticed it doing a lot with in testing so in another example here we have some YouTube videos and we want to make sure it's not coming up with the same YouTube videos and so we get a good mix of them when it's creating the Articles we're setting a variable here and then when we find a YouTube video later on in the process we're going to keep track of those and then make sure that we're not duplicating the same URLs which I'll show you a little bit later on for each of these sections as you see here we're going to have to use an iterator to iterate this entire array and the first time it runs it's going to go through this section and content and create the article text for that section so in this case again we're using GPT 40 and the system prompt for this is you'll be provided an article section title outline for that section and topic for an article start the section with a h2 tag there will be only one H2 heading in your response you can break further headings down into H3 tags there should be a maximum of now this is an interesting one I'm using an if statement and a random number generator to try to add a bit of variance to the number of subheadings within the section so it's if random is less than this so This random will result in a floating Point number between zero and one and then this will be like a 50/50 chance um so include list items were necessary to demonstrate your points but write a line of text to introduce the bullet points when doing so and I've added a bunch of other section here and uh just more prompting just to kind of improve the writing a bit and if ton of voice right in a tone of voice so if you want to to provide a very specific tone of voice you can add that here and within this it's only going to add that into the prompt if you've actually populated that within air table and then I've added more prompting to try to kind of humanize the text a little bit more and get rid of some really kind of dead away words in gb4 such as meticulously and uh you know navigating and so on again I've added an output a maximum of something words so it's not going to follow this directly but at least it might add a little bit of extra variance into the response so it's going to either randomly come out with 150 or 250 words now in terms of the user role I've just provided the topic the section title and the outline I've consistently added these characters here to try to delimit them to help gbd4 be able to distinguish between the different points so we've added the overall topic so that's the topic for the article the section heading so the section heading then will be the current section heading and the content for that section as we will see or as we did see from here say section heading and content and Max tokens of zero so for the first article section it came back with this the rising benefits of remote work work and it's formatted quite nicely however we want it to be in this type of format which is a heading Bolding nice bullet points and so on and how we do that is we go to format HTML and so this is a separate call to GPT 40 which will then get it to take the previous text and to format that as proper HTML so the content for that is you will respond in correct HTML syntax paragraphs must be in P tags heading should be in H2 and then I have a bunch of other prompting here to ask it to use strong tags unordered lists and so on and replace any occurrences of markdown with HTML equivalents and so you can pause the video and copy that out if you want but the result of that will be something that looks a lot more like this try and zoom in which has P tags H2 lists strong tags and so on and then once we publish that to Wordpress it will look a lot more like this which will look much better on a blog post next up we want to add either an image or a YouTube video to that particular section and how we do that is we keep track of it via a variable so we add in a new variable here and we call it section media from there we're setting up a router the first flow the first workflow from that router is is to go and find the media once it's decided what type of media to add to the section then we'll go back into this main flow of the iterator and it will continue on with this part of of the workflow we'll then get the variable here section media that was added up here and we'll then aggregate all those sections once we're finished with the overall process I'll explain that again in a second but let's continue on with this router stage to find the media first up we have get YouTube surfs what we're doing here is we're using the data for SEO API which is a very cheap and Powerful API where we can crawl Google and be able to get lots of interesting data for our workflows I've covered how to set this up in our article updating system so check out the link in the description for that but at a high level we add in this particular URL endpoint and we need to go down to Advan settings and add in your password data for SEO is ridiculously cheap you have to pay like a minimum deposit initially but it's a fraction of a scent to run one of these queries what we're doing here is we're getting the section heading the title and add in youtube.com to the end of it this will then programmatically do a Google search like so and then it comes back with a bunch of YouTube videos if they are available to set this up you need to have a pulse method body type of RW and content type of Json and then copy and paste in this particular adjacent format you need to select parse response and then go into advanced settings and add in your username and password that you'll see in the API access section on data for SEO once you have an account this then crawls Google and then comes back with a full list of results looking back over a previous run of this it has queried this data for SEO API and then resulted in lots of different search results so we see lots of different YouTube items here once this data for SEO API has returned with some data it then goes through this process we're choosing a video URL and the overall the end result of this process will simply be one URL so we're we're taking this you know this entire large array and returning one URL to do that we are using the join and map functions to extract the data from the array I've gone through how this works within the article update system video as Linked In the description but it's using a combination of a join and map function and it's passing in the items from the Google search results and then taking the URLs from those items so the result of this will be the entire list of URLs from Google search results however we're passing this into chat GPT and the message content the system role for this will be you are an assistant that will return the first YouTube video URL that you find in the following text so we have that prompt it will then return the first URL it sees within this list we also want to make sure that it removes duplicates so first time around these are not going to be included with these if statements however we're going to set this variable which is the YouTube url list once it's picked a URL it's going to update this YouTube list variable with the result so this is uh a look to the history of another execution of this where it's found the video and it's added that to this list the next time it went through this workflow for that particular article it added that to the running list of YouTube videos it's previously added so it's taking the previous YouTube url list and then add in the current YouTube url to the end so we're saying if the YouTube url list has anything in it so if it's not blank then we want to exclude those URLs from the output so URLs to exclude is so so we're using an if statement if YouTube url list and then that if there's nothing there it returns with this here which is nothing so that might have been a bit confusing but that's how we're removing duplicates make sure that we don't just have the same YouTube videos coming up for every single section because that coincidentally could happen sometimes another question is how are we doing the randomization for this and what we're doing is we're we have a condition here which is a condition of random we go to the math section here uh where's the math section there it is the variables of random and we want to check if it is less than 0.5 similar to how we did it previously in the scenario uh this will result in a random floating Point number between zero and one and one if it's not less than 0.5 then this fallback route is the alternative here we're making a HTTP request to get an image and I'm using the file. service for this I've gone through this in another recent video because this is a really interesting new flux image model and you need to add in the authoriz ation and your key and the API key you need to select Json and then you have a very specific prompt which is prompt an image about and the section heading and the topic is this title so we're just passing section heading and the title to flux one this is an extremely basic prompt but we're not being too prescriptive in the promp in here because um there could be lots of lots of variance in the topics we could kind of make this a bit more complex but this is working well enough for what we need here once we've done that and both of these cases we're set in the variable we're section that we're setting that section media variable in this case it's going to return that image and in this case of the video it's going to return the YouTube video result now the result of this will actually be a file. media URL so you might be thinking how do we upload this to Wordpress I'll show you how to do that later once it's gone back into this main iteration stage we we then get the variable that we added up here then once it's gone through this entire iteration multiple times at the very end it will aggregate all of this into a text aggregator which is actually quite simple and the source module for that aggregator is the iterator and what we're doing is we're aggregating the format HTML for each of these and the section media so the result of that is this it's just the combined long article and so it's all section piece together the text aggregator is the one to use there instead of using any other type of aggregator because this one will get it into a single text string that will then be able to provide the WordPress afterwards after that we're going to create the article introduction we're going to get a YouTube video based on the article title that's the exact same type of process that we used previously and we're going to get the YouTube list and choose a video URL again this is the exact same prompt that we used previously where they're going to pass it all of the previous sections of text and then write the intro at the end generally people who are writing articles are encouraged to write their introductions last because they've decided what to write upon and all the information and the introductions can be like a summary of the overall article so that's what we're doing here we we are asking it to create an introduction and key takeaway section for the article based on the provided article text again if there's a tone of voice added into air table it's going to add that to the prompt now we've got quite a lot going on in the prompt here but it's right a concise two sentence introduction section in NLP friendly format given a high level perspective on the topic it should contain some highle and relevant information based on the article rather than generic information about the topic it should specifically address the following topic so then add a key takeway section and again you can pause the video and copy and paste these in if you want limiting the number of bullet points to include in the key takeaways don't include hyperlinks don't start with a heading and then I'm passing it in the text from this text aggregator so that's the overall combined text for the article so far then Max tokens is zero I then have a separate prompt to humanize the content this is quite a long prompt you will take the provided text and edit while preserving the placement of headings earlier on within this article writing section when we're building this out piece by piece we had a similar kind of prompt in here but I'm breaking this out into a separate prompt here just to try and make sure that we're nailing the introductions and you can edit this however way you want you can pause this and copy and paste it out or again you can check out the link in the description to our community where you can get access to this automation so you'll take the provided text and edit it while preserving the placement of headings and so on and I will move down and pause there for a sec and again we have words that we're trying to Blacklist to make sure we do not include them then we're passing the result of this section here so the initial right introduction was the trend towards remote work is Revolution revolutionizing traditional business operations whereas uh this section here is the shift to remote work is transforming traditional business operations it's improved a little bit um you can change that prompt in however way you want you can also alternatively start playing around using llms like anthropic claw and here as well if you want from then on we're formatting the HTML intro again very similar to one of the previous prompts for that as you can see this is nicely formatted as HTML and when that is added to our article at the start then that will be nicely formatted it has headings and bullet points and Bolding again all of that can be customized then we have an image prompt helper which is that you will classify the main topic of the provided text and only respond with the topic no additional explanatory information the point of this is that we might have like a particularly wordy topic and you know a long long article title we want a much simpler prompt that we can pass to the image model and then let it do the work so in this case the overall topic was what is the main topic of the following is remote work good for business and the result is remote work and business productivity we're going to pass this particular prompt into flux one for image generation and in this case it responded with this image now we're getting to the stage where we want to upload all of this to Wordpress the featured image here the response from flux one has been a URL we then need to get that URL which is just you go down to 38 to make a request images and find the url that will then request that URL and then we'll get the data back so we have a buffer of the data we then can upload that image directly to Wordpress if you want to see how to set up a WordPress connection then check out the link in the description uh to another video where we explain how to do that you need to set up a WordPress plugin which is the make connector and once you've done that then you can add in your API key here we then want to upload that image to word press so we're we've gotten that file as you see here the data buffer and we're passing that in directly in here which is 40 40 we're passing the data in and then we are just adding a file name to this when we're doing that we've just added the result from the the image prompt helper it's the prompt that we added into this and we're adding in created which is the date I've mentioned this before but it's a kind of a quirk of the make connector for WordPress that it can overwrite existing images so you need to add something unique to the end of your file name to make sure it does not overwrite previous images so I've just added that so the result of that is remote work for business and the we've just added the created data at the end once that's done it's going to come back with an ID and so that's the media image ID on WordPress and then when we're uploading the post to Wordpress we basically attach that image to the post and we just select the media Item ID from this particular module which is pretty handy in WordPress we want to go to create a post the title would have been the title from Air table and then we're adding in a bunch of things here so the result the result is the 63 so the result is the introduction so the HTML formatted introduction we then have this 21 result we're then separating the introduction with a paragraph tag those new lines are probably not needed um but I leave them there anyways um and the 21 result is as you see up here the choose video URL so it's the video in the introduction so we have the overall image which is added as a featured image ID we have the introduction and then we have this YouTube video and the YouTube video is this then after that we have 66 text and that's the overall text aggregator above the aggregate sections and that's the total combined data of all of the sections in HTML format and so this will be all of these sections as we see here including the images now you may be wondering where are we uploading the other images we're only uploading the featured image of the article here which when we look at the article would be this image whereas we also have other images within the article so what we're doing here is we're using a trick which is to use this auto upload images plugin for WordPress the image URL that we're passing to Wordpress is actually the image hosted on file. however once it's uploaded to Wordpress this plugin takes over and then downloads that image and places it on your server that means it's then hosted on your own website for example if I look at this in a new tab I can see that the web address at the top is this particular website and not the file. media URL this will not be suitable for all use cases but it's definitely something to consider if you want a simpler workflow without having to upload every single image then at the very end it's going to add the sources that we added all the way back here which is extract Source once that's done it's going to save the post I've I've set this to save or sorry which is up here I've set this to save the post as draft so it's not automatically publishing the post after that we're getting the post again which is the post ID that we had previously here and then I'm going to pass this back to open AI again to create an article summary so you will summarize the article and provide us most important points and then I'm just adding in the overall the introduction and the previous and all the sections from the article I'm then going through step by step to construct proms for Instagram Facebook and Twitter I didn't have four proms which is the Instagram one is you are an independent journalist reporting on us in your industry and we have a bunch of other points in our prompt there I've gone through each of these in our previous social media system so again check out the link above and Link in the description to check that in more detail but once that's done it's going to respond with you know Simple Text for social media then it will update the air table record so the each of these fields will be updated so I'll change the status to article generated for that air table item add in the article link for the WordPress article the flux file URL for the featured image earlier on and that will show up here and then we'll be able to pass that to social media when we publish them later and then we'll just select the relevant openai modules and then populate those here and then those will show up here Facebook Instagram Twitter and so on so that's the overall flow for the article generation and the text for social media generation this is admittedly quite an extensive automation but you're going to get much better results from something like this than just simple one shot prompts with GPT finally then you can just go back edit this as you want then change the status to push socials and then when this system is run it goes down to publish socials and then publishes those to each of the social networks and again I've explained how that's done in more detail in the social media video that we've done so check out the link in the description for that as well so the main area to improve on this is if you have that newer feature in the perplexity API to provide additional sources and the URLs for them then it's definitely worth adding that to this automation just to make sure you have all the hyperlinks to the sources as for overall costs the flux API and we're using file and that's quite cheap it's a few cents per image on the flux pro version and it's far cheaper if you're going to go for the kind of lower models and if that suits your use case the perplexity API is very cheap you know even if you're not a pro member anymore you can get API credits for me I think it was less than 1 cent per call to the API using the model that I used the data for SEO API is ridiculously cheap it's a fraction of a cent per call to the API um but there is a minimum deposit for gbt 40 it depends on how long your article is it's going to be a few cents per article or a bit more if you have much if you have a much larger section count overall this uses a reasonable number of operations in make especially if you have larger articles but the overall cost of that is also quite low as well if you want to get access to all of our automations including this one then check out the link in the description to our community where you'll be able to import this blueprint at the click of a button if you have any questions about this automation then drop them in the comment section below thanks for watching