In this video, I'm going to show you a fully automated content system that generates revenue for your business. We'll build this AI agent powered content system step by step in N8n with Slack so you can manage the entire process naturally, and we'll automatically store all of the content for repurposing in Airtable. By the end of this video, you'll have a fully functional content system that allows you to store new content ideas and manage content through Slack and take your voice notes that you can add right into Slack and turn those into content automatically stored in Airtable. Through Slack, you can also generate new content using everything that is stored in your Airtable database. Here I have all of the transcripts from all of my YouTube videos and the AI agent will be able to search that knowledge base through a platform called Pinecone.
I'll talk more about this and how to install it later. And then that will generate new content. content from the old content and it will actually add it into your Airtable database. We can also use any text in our database to convert into an AI video.
We'll use HeyGen, you can send a text and then it will use one of your avatars that you can upload to actually generate a complete video without having to record it yourself. And again, we can use the Slack chat to initiate that process simply by saying convert C274, C274 into a HeyGen video. And right from Slack, we can even publish content.
Here we're saying publish content C268. So the system will automatically grab this piece of content and publish it directly to social media. In our example today, we'll go ahead and publish this content directly to Twitter, which we can see right here. By using Slack, we can make the process of communicating with the agent easy and natural. And by having every single piece of content stored in Airtable, we can use the AI agent to scan and rewrite content using our own voice and style.
into new formats and structures that we can post to social media. By the end of this video, you will have a fully automated and practical system that allows you to create, repurpose, and distribute content at scale to grow your business. Now, here's the plan to make this really easy for you.
First, I'm gonna give you a quick demo of how this works. I'm gonna go through Slack and show you Airtable and HeyGen and generate all of this content in this system. Then I'm going to build out everything step-by-step from a completely blank workflow. We'll start from scratch. We'll add the first triggers and build out this entire automation integrated into Slack, Pinecone and HeyGen, the platform that allows us to create videos from text.
And I'll take some time to explain how the AI agent works. How do you set everything up and build out all the tools? I'll show you how to program it, how to tell it what to do and how to use all of those various tools.
I'm going to show you everything step by step. So again, we'll start with the demo. I'll explain the AI agents and then we'll build everything out.
N8n, Slack, Airtable, HeyGen. the knowledge database in pinecone and i'll show you how to use that knowledge base to generate new content new videos and actually publish content i'll help you put all of this together fast so you can skip the hours and hours it took me to learn how to build this on my own all right so as promised now let's go through a little demonstration and explain how these automations work primarily the workflow in the system starts with slack but you can also manage the system in air table This is an Airtable database that I've been building out for our new product, which is called KEDB Solo. It's going to be geared towards helping solopreneurs streamline their content creation, repurposing and publication process. And I'm going to jump back to N8N and I'm just going to go ahead and test this workflow and jump over to Slack.
And we'll start with our most basic command, which is to add a content idea. So let's add content, new idea for YouTube demo. So we're just going to add a content idea. I'll jump back to N8n.
You can see the agent is looking up the command and doing the proper response. So we'll jump back to Slack and it says, hey, great, I've added your new content to the database. Here's a summary of what was stored. It went ahead and came up with a title for the idea and then dropped in the idea and then gave it a new CID. If we were to jump over to Airtable, we'll see C276 and we've got the title and the text that came from Slack.
So what we did there is we took advantage of this tool that is connected to the AI agent called add to database. The agent was able to determine what we were doing based off of the message that came in from Slack and also the instructions that we have provided the agent, which we'll go over in a bit. So now let's go ahead and test an additional workflow. I'm going to jump back to Slack and this one's just going to be a query to get existing content.
So get content and we're going to go ahead and just fetch the one we just added C276. Jump back over to N8N. It's processing that request. Now it's getting the content.
Now it's preparing the response. Went back to Slack and now we can see here it went ahead and retrieved the content and it gave us the text from the database. Here we see new idea for YouTube demo right here, which was the text that we added in the previous command. So now let's go ahead and test a workflow.
I'm going to come back to Slack and this time we're going to go ahead and update content. So let's type update content C2. 7, 6, and... and update the text or content to this is updated content from slack we'll go ahead and send that command jump back to n8n we can see it's translating our request it's getting the content it's preparing the update it just did the update and it responded back to us in slack so here we have the update was successful so now if we come back to the database we're going to see here that we have the updated text this is updated content from slack So now we've already gone over three specific tools. We can get content, we can add content, and we can update content.
Now let's go ahead and try these other tools here. Let's go ahead and actually generate a video from our content right here. So let's go ahead and test the workflow.
Let's jump back over to Slack and I will type convert C276 into a HeyGen video. We'll hit enter, jump back to N8n. Now that request is running, we're getting the content, building the information we need to send it to HeyGen. Just sent it to HeyGen. Doesn't look like we have any errors.
So I just jump back to HeyGen right now and it's now processing that video. When it is done, it will call this webhook in Airtable and it will automatically add the video to this section right here. Looks like it's done now if I open up this media and play it.
This is updated content from Slack. And you can see that it is using the text that we updated from Slack. Now let's go ahead and test our ability to publish content from Slack.
I'm going to go ahead and test the workflow again. Come back to Slack, publish C276 to Twitter. Hit enter. Come back to watch our agent process that information. It's going to grab the content, process everything and publish the content.
It looks like it started the workflow. So if I jump up. to Twitter and refresh. And so now you can see we have that content that was in our Airtable database published to Twitter from Slack.
And we have our success message from our assistant. So that covers these five main tools, which we're going to build live in this video. But now I also want to show you the knowledge base. So in my Airtable database here, I have imported all the transcripts from all my YouTube videos. If I had been using this system, Since the very beginning, then I would already have these in here as I use the Slack system to generate scripts and transcribe videos.
But from this example, I just imported them into the system. So now let's jump back to N8n. I'm going to go ahead and test the workflow. I'm going to jump back to Slack and I'm going to say generate new content about the wow statement. And now the wow statement is something that I used to talk about a lot when generating videos and scripts and creating content.
It was a system for helping you generate. more valuable content. And so now what this is going to do is it's going to search for that relevant content related to the wow statement in our database. And then after retrieving that content, it's going to use Claude over here, the brain of the AI agent to actually produce a new post and then add it to our database. So I'll test the workflow again, generate new content about the wow statement for creating great videos, hit enter, jump back to N8N.
It's now processing our request. Now it's going to the knowledge base to gather all of the relevant content for generating this new piece of content and now it's adding that to the database and then it's going to give a message back to Slack. We'll jump over there to see. So now it generated the new piece of content and gave us the content here, a little summary.
It gave it a new CID so now I can jump back to Airtable, go to the top and now we have C277 and we have the content that was written. from my content. So I used to talk about the $5 rule a lot. So I brought back examples of that and a bunch of other things that I talked about on a regular basis, like creating aha moments.
So you can see this is really powerful because from our Airtable database and from Slack, we can completely generate new pieces of content and get them organized into our system so that we can then edit or publish to social media. So that covers the tools that are being controlled by our AI agent. But I do have one other automation that will take in audio notes that we post into Slack and it will automatically transcribe those and bring those into Airtable for content. So let's say I was out and about and I opened up Slack.
I could come down here and just record a message while I drive. And off the top of my head, I can come up with some content idea and talk about the different things that I want to talk about in that post. And what's great about this is that you can also just talk. off the top of your head.
You don't have to make it perfect because once we add this into the database, we can rewrite it and create content directly from that. So we don't have to make this perfect. It's great for just taking notes and getting that into your content system. So from here, all you have to do is hit send.
Let me make sure I'm testing. in the workflow come back to slack we'll send this binary audio file then the system takes a slightly different fork it gets the file transcribes it and adds it to the database if we come up here we can see that new piece of content it just popped up here we can see the new transcription here come back to slack we've added the new audio transcription to the database as c278 c278 and if we wanted to we could just publish it from here come back to n8n just to test the workflow and we'll say publish C278 to Twitter. Come back to N8N. It's processing our request.
It's going to grab the content. It published the content. Let's take a look. It looks like the workflow was executed.
So if we jump back to Twitter now and refresh the page, we see the new post that we added from the audio notes that was stored in Airtable automatically posted to Twitter. And then if we come back to Slack, it lets us know that everything was successfully. published. So you can see how powerful it is to interact with our AI agent through Slack. It makes it very natural.
We can add new ideas and we can even add in audio notes to generate content from. We can generate new content from old content. We can convert text content into videos automatically.
We can update content. And again, everything is backed up into our Airtable database. Now let's go through the process of helping you build out this exact system step-by-step. And by the way, if you like content like this, make sure to like and subscribe to the channel. Tells me what type of content you want more of.
All right, so now let's build everything here from scratch. And don't get intimidated. All of this is actually quite easy. There's quite a few different things here, but they're actually quite easy to set up.
And you'll see how easy this process can really be. So I'm going to jump over to a brand new workflow. Might as well add a name, AI Agent YouTube Demo.
Looks like it added this arrow here. Delete that. Didn't know what that was.
And now let's go ahead and add our first step. And now I'm going to start with the AI agent. If you just type agent into the search, you can have this agent here. And it automatically goes into the settings of that agent.
I'm going to come back out and just talk a little bit about how this works in N8n and why it's so cool and how to configure it. So you can see in my demo here, we were using Slack to send messages into the AI agent. And then we would send a message after it was done with all of its work.
But when you're setting up a brand new workflow, N8n does have this built-in chat, which will allow you to chat with your agent before you've actually set it up to some external service like we did with Slack. So here, if I came down and I were just to chat, hello, it will actually try to chat with the AI agent. But there's an error right now because we haven't actually configured everything. There are some requirements in order to get this AI agent to work. And one of them is a chat model.
So if you think about an AI agent as a complete person, just like you or me, we have to have a brain and that's what this chat module is. So when you think about an AI agent, it's just like a person, it needs a brain, it needs memory, and it needs tools to work from. It needs to be able to do things, just like we have arms and legs and hands and feet, which are our tools to actually make an impact on the outside world, the AI agent needs the same.
So I'm going to go ahead and add a chat module. I'm going to go ahead and use cloud. I already have a cloud account connected. If you do not, you will need to create new credentials. Go ahead and add those.
And then once you've done that, select the model. I'm using cloud 3.5 Sonnet, and that should be good. Let's clear out this error and it's showing an error here.
Let's go ahead and just send a message. So it looks like we were able to fix that. And now the chat bot can actually talk with us. So we sent the message test and then it responded with, hello, I'm here to help. What would you like assistance with?
Feel free to ask questions or let me know what types of tasks you need help with. So this agent isn't going to be super helpful yet. It doesn't really have any tools to actually do anything. It only has the claw to brain and it also doesn't have memory.
So it's not going to be able to remember any of our conversations. So if I say my name is Steven and hit enter, it will be able to respond. It says, hi, Steven. Nice to meet you.
but if i were to say what is my name then because it has no memory hey i apologize i don't have any information about your name so let's go ahead and add in memory i'm going to come up here and add in some memory and we can go ahead and just use window buffer memory this is the easiest by default it's going to have some sessions here pre-filled for you we're going to need to change those later this is a key here that we use to keep track of different conversations and then for context window this is how many previous chats it's going to remember on any given request i'm going to go ahead and just bump this up to something like 10 and then just thinking ahead a bit to when we actually do integrate this with slack you can notice here that slack has the ability to create different threads we're asking questions in this main inline channel here KEDB solo but when it responds it's responding in a thread and anything in this thread is going to be a conversation that we maintain here in N8n so let's go ahead and move out here now and let's go ahead and save it and now that we have memory here we should be able to say hi my name is Steven and now we should be able to say what is my name your name is Steven and it's able to do that now because it has memory So now let's talk a little bit about how we actually program the agent and tell it how to interact with the user and also how to use the tools that we actually add to the system. So now let's go ahead and go into our agent and we can go ahead and leave everything here for now. But what I do want to show you here is that there are different options that we can add.
And one of those options is a system message. And this is where we can really tell the agent who it is, how to behave, what are the different things that it can do. how does it access the different tools that it has and how does it actually respond back to the user so now this is where a lot of the magic actually is so let's jump up to this document here where i have the current prompt that i'm using in my prototype for the kedb solo n8n automation so here you can see we're defining hey this is the system prompt for the content management agent and then i give an overview.
You assist in creating, storing, and managing and publishing content. You have access to several tools to facilitate these tasks. And then I go ahead and I start to define these tools.
And so what you're going to notice here is that each of these tools usually maps to something that is here connected to the tools. So here I am in the demo that I showed you earlier, and we have a get content, an add to database, an update database, a hey gen video, and publish content. And so if we come through this document here.
We're going to see we have a section here for tools and their functions. And so then we can define how the get content tool actually functions. And we give it a purpose. And we tell the agent that the purpose is to retrieve stored content from the Airtable database.
And then we explain how to use it. When a user requests to see a piece of content, look up the record using the CID in the format CXX, where X is any number of digits excluding leading zeros. So that tells the system what the format of the CID is. and then it says to return only the text column from the retrieved record. And so now if I jump back to my demo and we look inside the git content, you can see here it's just a search operation for an Airtable database where we provide the operation and what base we're working from. In this case I was using this base here, KEDB solo prototype, and what table we're working with, the table content.
If you see here we have the table content. and we're filtering by the CID. And here's where the magic is, is that inside of this search formula, we have this special tag here, which is saying, hey, while you have this conversation with the user and you identify a specific CID, again, based off the conversations that we have in Slack, once we know what that CID is and we've defined that and the agent helps you sort that out with Claude, then when it actually executes this tool, it will send that CID and it will replace that here when it actually runs.
And so if we go back to this example here and we test the workflow, get content C276, jump back to our example here, it's getting the content, it's processing it, and then it's going to respond back to Slack. But if we look at this get content here, you can see that the agent sent that ID and then it was replaced here automatically to actually get the data that we were looking for. So really what the AI agent does is it's just using your system prompt, which explains how to actually use and come up with the different variables that you need.
In this case, a CID. And then the agent automatically helps you extract that information and then passes it into your automation so that you can actually use it and then return a value. And so then you can see we listed out the other tools as well. Add to database, the purpose, add new content to the Airtable database. And we explain how to use it.
When a user provides a new idea, post, or rant to be stored, trigger the tool anytime the user says something like store an idea or here's a new piece of content. So it's using this information here to evaluate the request from Slack to determine whether we are trying to add to the database or whether we are trying to get content or whether we are trying to update the database. So all you're trying to do here in these different sections is really just trying to explain to the agent what the purpose of this tool is and how it's used and what to look for.
And then you can see down here, and we'll cover this in more detail, but we also provide required fields. And these required fields will map to the tools in 8.8.n. So if we're looking at this tool here, add to database, then the required fields here are title and text. And we're telling the agent to generate a short title based on the content.
And then we're taking the content that the user gave us in Slack and we're adding that. to the database. So again, if I were just to test that workflow very quickly, add content idea, another demo, and then we can come back here. We can watch the brain. It's going to get the information that it needs.
And then if we jump into this run here, you can see it generated the title for us and then passed in our text, another demo, which came from Slack, another demo. And that's why it's showing up here in Airtable. as another piece of content. So I'll go through all of these in more detail as we go, but you can see that this is just a description on how the tool works and you're giving it information on how to find the information it needs and how to think about it just so that when it's trying to execute this without you being there that it can do it successfully all on its own.
If you do find that you're having errors in your automation, it's generally because these instructions are not quite clear enough or they're overlapping or there isn't enough clarity, something related to these instructions. is probably where the issue is. Now, if you want access to this entire template, including the Eric Table database where you can download this as a template, make sure to jump into the NoCode Architects community.
It's an active group. You can get tech support directly from me. We've got calls almost every single day and you can access all of my automation templates just like the one you're seeing today.
All right, so now let's go ahead and continue. I think the next best thing to do is to replace this manual chat with Slack so that we can start to build out our app. So now there's a few steps that we have to do in order to...
make this work and just make sure to follow what I'm doing just to make this easy. So the first thing I'm going to do is I'm going to jump over to Slack. And the first thing I'm going to do is jump over to a new workspace where I've never created a app before.
Here's a previous channel that I created in another example. I'm going to go ahead and create a new channel. I'm going to add the channel and I'm going to call this KEDB Solo. And I'll go ahead and leave it public.
I'm This is just going to be a private channel for me right now. And then you're going to want to go and create a new tab. And you're going to want to go to api.slack.com slash apps. You might need to log in. Here you can see other apps that I have.
This is on a different workspace, the no code architects. And I'm going to go ahead and create a new app from scratch. Let's go ahead and call this KEDB solo.
And then I'm going to pick the workspace. And I'm going to go with the content engine. Now, one thing I have noticed in the past is that when I have multiple apps in the same workspace, I have some unexpected behavior. I have gotten it to work. So in this demo, I'm installing this app in a workspace that doesn't have another app.
So I would recommend that you do the same. Let's go ahead and create the app. Looks like I call that KEDB Solo R. So I'll go ahead and just fix that real quick. App name KEDB Solo.
After you change that name, make sure to save the changes. Looks like it's asking for a description. AI agent content. system and we'll pick a color here. Go with black.
Save the changes. Next we're going to go to OAuth and permissions. I'm going to come down first. You can leave this alone. You can't do this until we've added something below here.
So I'm going to come down to scopes. I'm going to add an OAuth scope here. I'm going to add history, channel history. I'm going to add chat, write permissions. I'm going to add files, read.
I'm going to add files, write. Now, some of these you might not use in this specific example, but I add these because I've added other functionality down the line. And it's easier to add some of these now.
I'm going to add group history. And I believe that's all we need for now. And now that we have added those in, we can scroll back up to the top and we can install the app into your workspace. You can go ahead and allow.
Then it's going to give you this access token here. You should be able to copy that, come back. to your demo here.
We can just add a Slack module here. Let's go ahead and come down to actions. Let's come down here to send a message. Then we need to add a new credential. I already have one here, but I'm going to show you how to do this one since it's a little bit more difficult.
Going to come here to credentials to connect with, create new credential. We're going to use an access token because we are connecting with the bot and not our own account. So I'm going to go to access token.
here we're going to take that access token that we copied right from here we're going to copy that right into this access token here and we'll go ahead and save and it should test that successfully if not then you'll need to figure out what's wrong with the access key and then i'm going to go ahead here and just put in a test message test send message to we're going to go to a channel it looks like i didn't add the permission to actually look up the channel so i'm just going to come over here to slack going to come into the settings here by clicking here and then we've got that channel id here i'm going to copy that come back to n8n Going to change this to ID. We'll add that in here. We'll send a simple message.
We've got our text here. Let's test the step. And now we're getting the error Slack channel not found.
And I'm just remembering here that one thing you need to do is come back into these same settings here. If you've lost it, remember, come back to KEDB solo. here, click one time, then come to integrations, and you're going to add an app. And then in your workspace here, you should see the app that you just created, KEDB Solo.
Let's go ahead and add that. And now that that has been added, I believe we should be able to come back to our message here and test the step. Still saying channel not found. Now that I'm thinking about it, I think what I might have done is messed up my credentials here.
I think I copied the key from my other test app here. So I'm going to jump back to... the kadb solo i'm going to grab this key here update the credentials come down here to the access token i noticed that they were a different size i'll go ahead and click save and we'll go ahead and test the step again and there we go so it's just a matter of me copying in the wrong id so if i come back here we can now see we're getting a message from the kedb solo app in the kedb solo channel so i'm going to come back up to n8n i noticed things are getting a little bit messed up here so when i added this slack module here, it automatically added this trigger so that when I test the workflow, it triggers this. So if I do this now, it should send another message.
There we go. So now we'll come back to N8n. I'm going to go ahead and delete this, move this here to the AI agent, and just connect it up just like that. So now once the AI agent actually figures out the response, it'll be able to send that message back to the user.
Now N8n keeps adding this first step here because we don't have a trigger that's going to get information into the AI agent. So let's go ahead and do that now. I'm going to come here and add a new Slack module. In this case, we're going to trigger on any event.
We can use the existing credentials that we've already created for channels to watch. We can go ahead and go by ID and then copy in the ID again. That way we're not processing messages from every channel.
And now the one other thing that we need to do is that we need to open up this webhook URLs here and we need to take this test URL. If you just click on it, it'll allow you to copy it. We're going to take that back into our Slack API.
settings. We're going to come down here to event subscriptions. We're going to enable this and turn it on. And then down here, what we're going to do is before we actually put the URL in there, come back to N8N and test this step.
It's going to wait for a request. What we're doing here is we're proving to Slack that we own this webhook. So we're just going to put this webhook in here just like that. It should send it over to N8N and verify it just like that. We can't actually save the changes yet because we haven't subscribed to any notifications.
So I'm going to open this up here. We're going to add a bot. user event. I'm going to go ahead and type message, message.channels and message.group.
And now we can save the changes. And now if I come back to N8N and I listen to a test event, if this is no longer listening, again, you can come back here. We have our trigger.
Let's connect it again. If we come back in here and we test listening for a new event, we can come back to Slack. And now if we message here, test, that should trigger our workflow.
So now we got that message here. That's great. And so now it's going to pass that message into our AI agent and then respond back to us. So if we can test this particular workflow and it works, then we are good to go with the Slack integration. So I'm going to test this workflow.
I'm going to go to Slack. I'm going to say, please create a tweet about how to use Airtable and why it's cool. Well, before we get there, we got an error here. And that's because previously the way this was set up is that it was looking for the data from the previous node, which was that chat.
If you remember, we had that chat that was right here. And now because we've changed the trigger, we need to update this here. So I'm going to change this from prompt source user message to define below.
And then for the text, I'm going to send in the text that we sent in from Slack. So I can just drag that over just like that. Whenever you're using these types of variables, you do need to make sure that you're on the expression.
Otherwise this won't get converted into. the actual message that's coming back. So that should be good. We haven't updated the system message again. That's fine.
I'm going to go ahead and save this as we are. Make sure you save regularly. Let's test the workflow.
Let's come back to Slack. I'm just going to copy this again. Jump back to N8N.
Oh, we're having another issue mentioning the window buffer memory. So I'm going to come here. And so right here, I had mentioned this before, but this is a key that it uses to determine if it's in the same conversation or if it's a new one.
And remember, I mentioned that Slack has the ability. I was doing it in my other Slack channel to create threads. And I like to use those threads as the conversation. So at the main level here, we have different conversations that are happening.
But if we go into a specific thread, then the window buffer, the memory, is remembering everything that happens in a thread so that we can separate the memory from one conversation to another. So for this value, I'm gonna jump back to my main example. I'm gonna go to the window buffer memory. And I'm just gonna copy this out of my demo.
I'll move it in here to the... new build out i'm going to change the session id from take from previous note automatically to define below and then i'm going to drop in this just like that and again remember when you're using this code here you need to go to expression and you'll want to pause the video just for a second to write that out just as i have it you're going to want to copy this this exactly as I have it with uppercase and lowercase and question marks. Everything that I have here, you have to copy it exactly as I have it.
So I'm going to come back here. Let's go ahead and save. Let's go ahead and test that workflow again.
Jump back to Slack. I think we got it this time. Got to jump back to the proper workspace. Let's just cut and paste this again.
Jump back to our demo. Okay, so we're not getting an error now. So now it looks like it actually responded to us. Let's come back up to Slack.
And now you'll notice here that Slack returned with test, which is what we were getting before. And it's just because I haven't updated the message here. So let's go here. And now the actual message that we want to respond with is the message that comes out of the agent.
So I'm going to take the output here and just drag it here into the message text, save again and test the workflow. Come back to Slack. Let's try that once more. Come back to N8N.
Now it's going to send that message. Now, if we come back, we're going to see we're getting a response. Here's the suggested tweet. Now this tweet itself is just coming from.
cloud itself. It's not using any of our data. So we're going to update that in a bit, but we can see that it's actually sending us back a response. Now, the one thing I can show you is that it's not coming back as a thread.
So let's go ahead and tweak that. So I'm going to come back to my example here. I'm going to come to Slack here and you're going to see here that they have added an additional option and it is to reply to a message. And this is what actually creates the thread. And again, we've got this text here that I'm going to copy and you'll want to copy it just as I have it here.
Copy. And then we're going to come back to our new agent. I'm going to come into Slack, going to come down here to add option.
We are going to reply to a message and then it's asking for the timestamp to reply to. And we're going to click here, reply to thread. I'm going to come down here.
I'm going to move to expression. And then I'm going to copy in from a paste into this box here. And again, you're going to want to copy this in exactly as I have it.
Basically, in order to create a thread, you have to pass the timestamp of the original thread. or the thread id that comes with a response and honestly it looks like there is a typo here this should be ts for timestamp so actually i'm going to come back to my demo and correct that really quick here ts will need the same thing in the window buffer memory the ts here so that's on my demo i'm going to save that then i'm going to come back to the new demo here we're adjusting the reply to thread timestamp then i'm going to come back here to the window buffer memory and update that here as well so quite a few little details here to get set up with slack but just follow them step by step and you should be good to go now i'm going to come back here and save i'm going to go ahead and test the workflow come up to slack let's try it again and see if it responds as a thread we'll go ahead and do that hit enter come back to n8n it's creating that tweet then it responded back so notice now it's replying to that thread and so we can see the response is actually now creating a thread and then inside of our app here the window buffer memory is now keeping track of that conversation as it progresses. So again, just make sure to copy this and correct that little bug I had here.
There's a reason why I didn't notice this bug before. It didn't actually affect the reply to in the original thread, but it would have broken the memory here. So it's good that we corrected that. And just to confirm that again, inside the window buffer memory, you want to make sure you have this exact text just like this, and you're going to use the same text in the option reply to a message.
And you're going to have that here just like that. So once you've gotten to this point, you've successfully added your Slack trigger and the message back to the user in this specific channel. And you've also been able to build out your app inside of apislack.com.
And now we're ready to build out the rest of the automation, start adding tools, the Airtable database, the Pinecone database, and we'll go from there. All right, so let's go ahead and continue on. I'm going to jump over to my original prototype. And I think it's probably best to start to build out these tools and the Airtable database.
You'll find that this starts to move a lot faster than the Slack integration, which is not necessarily super easy to do. But that's why I built everything from scratch so you can see exactly what I'm doing. So if you run into an issue, you can go back in the video and correct it and build this out yourself.
So next up, we probably should build out this Airtable database. So I'm going to go to Airtable. I'm going to create a new base. I'm going to start from scratch. Got to pick a workspace, start from scratch.
Go ahead and close this out. And now I've kept this original database pretty simple we just have a few different fields here i've got a few hidden fields but we really don't need these we really just need what we have here so let's build this out really quick i'm going to call this the kedb solo prototype youtube demo so i don't forget i'm going to come over here i'm going to add a auto incrementing field i'm going to call it id i'll move this over here i'm going to rename this column here and change the field type we're going to call it cid just like we do in this database here. This is how we search. And then I'm going to change the column type to formula.
And I'm simply going to put a quote C ampersand. and then I'm going to add ID. I'll click save. And so what that's doing is it's just putting a C in front of the ID that's automatically generated. Then we need a title and text.
So let's do title. We'll make that a single line text. We'll change this to text. We'll make this a long text field. I'm going to go ahead and delete status.
I'm not using that right now. I do have this little fancy column that we probably don't need, but I'll go ahead and show you how I do it. It's a formula. It's getting the length.
of the text just so i have that i'm going to copy that i'm going to add text length go down to the formula and what we have here is just len parentheses text create field it's saying zero because there's no characters here but if i put in test it's going to be four so now what we need is an image and media attachment field and a last modified so let's create attachment we'll call it image attachment video and I'll scroll down here and we'll do last modified time. I'll just go ahead and create field. That'll name it for me. And there we go.
So I'm going to go ahead and delete these. So we're starting from scratch. And I believe that's really all we need to get started. I'll go ahead and rename this table here as well to content. Then I'll jump back to our build here and let's add our first tool.
So I'm going to come over to Airtable. If you don't already have credentials, you'll need to add a new credential here. This is pretty straightforward. If you click it, they will actually give you instructions on how to do this as well.
I personally use the access token to set this up, but it looks like they have OAuth as well. This one might be a bit more straightforward for you. If you need any help, you can open up the docs right here. So from our example, it probably makes sense to add to the database first instead of get since we just deleted everything. So I'm going to jump back to our demo here and we're going to create a new row.
And then for the base type solo. And now I'm going to grab our new database, the KEDV Solo Prototype YouTube demo. Then I'll grab the table. We'll see content. We can leave this as is.
And now for the title and the text, this is where we need to add that expression to bring in the automatically generated title from the content and the content idea itself from the discussion that we have with the AI agent. So again, the AI agent, along with the system prompt, we're giving it instructions. specifically for this add to database that we need these two required fields so it's going to help us figure this out for us again it's going to generate the title and we're going to pass in the text so i'm going to come back to my example here and i'm just going to copy these and you can copy them just as i'm doing as well we'll come into this tool here i'll put the title again i'm going to move it to expression you'll see it's formatted correctly and then i'll go grab the text come back over here we'll add the text again turn it to an expression and we can leave image and video blank.
You could even remove them if you didn't want them there. Looks like I didn't get this to expression, fix that. And it's also giving you some instructions here on how you pull in variables from the AI.
You wanna pay attention to that because it tells you exactly what to put. And that should be all we need to add this new tool, except that I do like to rename this to the tool itself. So in this case, we're gonna say add to database up here and then the rename node right here. Rename.
Then we'll go ahead and leave this window. Now we have that new tool here. Now the only thing we don't have is we haven't updated the system prompt here in our parameters where we added an additional option. Remember we did that earlier. If I were to delete this, remember we come here to add an option, system message.
Now I'm going to come to Visual Studio and I'm just going to copy my entire system prompt here into this message here. Now in the description below there is a link to this full document so you can cut and paste the contents into the system message box just like this. It makes it a whole lot easier for you. It's got all of the tools and the instructions and everything else. I'm going to go ahead and exit out.
I'm going to save this. I'm going to test the workflow. I'm going to come back to Slack. I'll just say add this content idea. This is my first idea.
Jump back over to N8N. It's processing that request. It's adding it to the database, preparing a message back to Slack. So if we come back to Slack, it's going to say, yep, I was able to do it.
Great. It created the CID. We can come back to our prototype, the one we're building together. We see C4 and we see the message and it came up with a title on its own.
So that is working and confirmed. And now we can continue to build out the additional tools. All right, so let's keep moving along here. Let's go ahead and add the get content.
And this should start to speed up a bit. Get content, Airtable tool, get. Again, we'll go ahead and use our search to find the right base.
Solo demo from the list content record ID. In this case, we have to pull this record ID from the AI again. So we're going to use one of these placeholders. I'm going to copy this in.
Remember, you need to go to expression, copy that in. Now the variable that we're going to pass in is just called ID. And I believe that is all we need for this one. You already have your connection, so that's good. I'm going to come back out, save.
Forgot to rename the tool. Rename. And this is going to be Git content.
And then we've already copied in the system prompt here with everything from my document. So in this case, I'm just going to come here and show you what's there. Here we have Git content. And this is where we retrieve content from our Airtable database.
And we pass in a specific... CID. So let's come back to our demo.
Let's test the workflow. I'm going to move this slack over so it's closer. And now I'm just going to type git c4 and jump over here.
It's trying to figure that out. Looks like we had an error. So let's see what happened.
The resource you are requesting could not be found. And it has the c4 here. But what I'm realizing here is that I use a search, not a git. So I'm going to change that to a search.
The base and the table should stay the same. And now we need to update this filter. So here we're going to use a curly brace, CID, close curly brace equals.
I'm going to turn that back into an expression. I'm going to copy this. placeholder here and then i'm going to adjust this to say cid and i'm going to put that in quotes so the final formula here is open curly brace cid close curly brace equals quote two quotes and then the variable we're going to pull from the api let's go ahead and save and test that again come back to slack notice it actually responded with the error we're going to say git c4 come back now it's getting that content now it retrieved it successfully and now it's responding back with the message so here it says hey i was able to get that for you here is the content and then it gives a little description of course you could clean up exactly what it responds back with if you use the system prompt so we could come in here and say get content and we could specify the output and that would help tailor how it actually responds to us via slack so now let's just go ahead and add in the update database as well. This is an update record.
We'll come over to our new build. We'll add a new tool, Airtable. This time we're going to update, choose from a list, solo, prototype, table, content, IDs to match on. Here we're going to pass in a placeholder.
I'm going to go ahead and grab this here and I'll turn this to an expression. I'll paste this in. We'll change the placeholder name to ID, title, expression as well. rename this to title and for text expression paste we'll put text so that should be everything that we need let's go ahead and exit out here let's go ahead and save and i forgot to rename it so we'll rename it this should be update database and then if we jump back to our system prompt here we're going to see update database this is the purpose is to modify an existing content record in the air table database the usage When a user requests to update an existing CID, first retrieve it using the get content tool.
So this time we're telling a tool to use another tool, then update the text column of the identified record from the get content tool. Because remember, the get content tool is going to return back to us the specific record that we're working with. Optional fields are the title.
Required fields are the ID. This is the ID we need to look up in Airtable. and then this is the text.
Now one thing I am going to do is I'm going to come over to our demo prototype here. I'm going to add another field. I'm not sure that I need it, but I like to have this record ID. It's a formula record ID.
You can start to type record, and then this is going to pop up. You just need to add the closing parentheses. It's going to show you the actual record ID behind the scenes in Airtable. It's right there. You can go ahead and hide that.
So now I'm going to jump back to our demo here. I'm going to save things. I'm going to go ahead and test the workflow. Going to jump into Slack.
And let's say update the text of C4 to did this work. Hit enter. Come back to N8N. It's trying to figure things out. It's getting the content and grab the ID.
Now it's updating. Should be successful. Let's come back to our prototype.
I'm going to change the color because it's close to this one and I'm getting them mistaken. So let's just make it bright red so I know it's different. And then we're looking at the content here and it says text.
Did this work? And that's what we passed into our Slack channel. Did this work? That's what we wanted to update it to. And it responded back that it was able to do so.
So now we have our add to database, get content and update record tools. And now we can continue on with the rest. All right.
So now we're moving along. Let's go ahead and add the next tool, which is going to be the Hey Jen video. To use this, you will need to create a Hey Jen account. You should be able to use the free account. you're going to want to come to avatars and create a new avatar if you use their free account they will limit you to how many videos you can create and they will also put on this little watermark as well so we're back here at the agent i'm going to go ahead and reorganize things a bit here just to make a little room i'll add the other tool this time we're just going to use an http request tool we're going to change this to post I'm going to copy this in just like this.
You can copy it just as I have it here. For authentication, we are going to add a generic credential type and we'll add a header off. I already have one in here. I'll go ahead and create a new one.
Create new credential. For the name, we can go ahead and use xAPI key. Now for the value, you're going to come over to your agent account.
You're going to come up here. You're going to go to space settings. You're going to go to API. You're going to copy that key. You're going to come back and drop that right here.
You can go ahead and update that here. Hey, Jen, demo. Go ahead and click save.
Then we can continue on. You'll want to enable headers for name. Go ahead and type accept. Then go ahead and say use fields below.
Go ahead and put in application slash JSON. Then we'll go ahead and enable send body. You'll update this to use JSON below. And then for the JSON, you'll want to copy and paste this in directly.
as I have it here. Paste this entire bit of code that I have. I will also expand this out so it's easier to see.
You can see it all in one page. So we have the entire contents of the JSON right here. You want to make sure that you write this out exactly as I have it. Any little mistake here will break this.
To get these little indents here you can use a space. That'll work just fine. For the avatar ID you'll want to replace that with the avatar that you generated in HeyGen back in the avatar section here.
You can create that avatar. I'm going to jump into my existing avatar. I'm going to use this camera a.mp4.
You can copy the avatar ID just like that. Come back here. You're going to copy that back into this section here. It's going to be the same because this is the same avatar I was using. And then for the voice, you need a voice ID.
You come back to Hey Jan and you go to AI voice. It creates a voice for each video that you upload as an avatar. You can come up to the three dots. You can get the voice ID.
You can come back. and copy that in here. This will probably change because I think I was using a different voice ID for the video, but it doesn't really matter as long as you have a voice ID.
In this case, now I just made it so that the voice ID that I'm using is the same one here. It was actually using one of these voice IDs, which was from a different avatar. So you can use the voice ID from this avatar over on this video.
And this placeholder here will insert the record ID from Airtable so that when it's done processing the video, it can send us back that ID so we know which video it was from. to update. And then we're also going to add in something here for the callback URL.
So I'm going to hit enter, a couple of spaces. I'll type callback URL, close quote, colon, space, two quotes, and then a comma. And then I'm going to jump over to Airtable. I'm going to jump over to automations.
I am going to add a new trigger when webhook received. I'm going to take this webhook here. I'm going to copy it. And we're going to come back to our call here. And we're just going to put that right here, callback URL.
We're going to add that in. just like that and we are good to go so again just make sure you copy this exactly as i have it you'll notice that i added the spaces here to get us here if you run into an issue where you are running this and you're getting a 400 bad request it's typically related to the formatting of this document it has to be precisely as we have it here i'll even expand it a little bit more so you can see the entire thing i've noticed on pc sometimes that enters can cause an issue so if you're on a pc and you're finding that there's an issue you can always collapse this and remove all of the spaces enter keys and everything and just make it one big long string i'm not going to do that now because i think it'll work for me but if you're on a pc i've seen that happen let's go ahead and move forward and test this out i'm going to go ahead and save things again i'm going to come back to my document here here is the system instructions for the hey gen video you'll want to make sure you copy this into your agent below right here you're going to want to continue to add to this system prompt as we add these different tools. This number here just happens to represent the order in which I added the tools when I originally built this.
You might as well just keep them the same as I have them. Now let's come back to our automation here. Let's test the workflow. And now in Slack here, I'm just going to say convert C4 to HeyGen video. Let's see what we get.
It's processing that request, getting the content, then it's passing it to the tool. Looks like we got no errors from this. Hey Jen, which is great. So now if I jump over to Hey Jen, notice that there is a video processing right here. Jumping back to Airtable and looking at the data here, I do like to use short text here because then it's going to generate the video faster.
Once this video is finished, you should be able to see it here and it should also trigger this webhook right here. Because again, remember in edit end, in our body here, we added in that callback URL here. So let's go back to Hey Jen. All right, it looks like that video is complete. So let's jump over to Airtable.
If everything was processed correctly, you should see a test down here that came through. If we can look at the body and it looks like it was a success. So that's great. We have the data now and we have the URL of that video. And we also have that callback ID.
Now, if you remember back in our JSON here, we put in the ID. And if you look back at our system instructions, we said get that ID from the get content tool in the CID lookup. So what happened there is that in our data here, we found this CID. We grabbed this record ID. And we pass that along to HeyGen with the webhook URL, go back to the automation, so that now we can update this record ID with the video.
So now what we can do is we can come here, we can add a update record, table, content, record ID. We're gonna pass in the field that we passed in to HeyGen that returned it back to us. So here for the record ID, we'll click this.
We'll go into the body, event data, callback ID. Then we'll choose fields and we will update the video. And for the video, we'll pass in the... URL, back into the body, event data.
URL, and now we should be able to test this step. I'm going to go ahead and say run as configured, run test. Looks like it came back with an error. So here I'm getting an unable to render update attachment field could not be parsed.
So what that's telling me is that the URL that we're trying to send to this video attachment is incorrect. And that's because I think it's actually an image. When you run HeyGen API to create a video, it also creates a GIF for you as well.
So what we need to do here is we need to come back to the automation. And I believe the GIF is the one that's triggered first. I'm going to come back to the trigger here. And I'm going to test the trigger to see if there was any other requests that came through.
And now we're seeing here that the video was a success. So what that means is that when we process a video, HeyGen fires off multiple webhooks. The first one that we saw was for the GIF being completed. This one is for the video. So it fires two separate webhooks that we have to process.
So. really all we need to do then is just create a conditional statement. I'll do that right here, but first I'm going to grab this event type here, copy it, conditional logic. If conditions are met, and we're going to look at the body event data, go into the body. We're going to grab event type, come into body.
We'll go to the event type and we'll say contains avatar video success. Now we're going to move this update into that conditional logic. So now we're only doing the update. when it's actually a video and not when it's just a GIF or a GIF, whatever you want to call it.
And now if we run this one, run as configured, run test, we're still getting that error. But I think this error actually is because it's not able to show us a video here. So when I saw this error before, I thought it was related to the fact that we were trying to put a GIF inside of this attachment field, which isn't really true.
It was giving us this error because it can't show the image or video on this record updated screen. it still made me think and figure out that GIF issue. So it's good that we ran into it so that we could add this section here.
But if we jump back to our data here, we're now gonna see that we have a video there. And now we can jump back to our automations and we can turn this on and then we can rename the automation to new HeyGen video. And now that that's on, we're good to go. We can come back to our demo here and save it.
And let's see what we got back from Slack. Great news, the content from C4 has been successfully converted into a HeyGen video with this text there. So now we have our text to video tool up and working.
All right, so let's continue on. The next thing that we're gonna do is we're gonna add in the ability to publish content. For this one, we're just gonna go ahead and show an example where we publish text content to Twitter, nice and simple.
I'm gonna come back over to our workflow over here. I'm going to go ahead and hit shift. That allows me to select multiple modules and then I can go ahead and push them over a bit to make a little bit more room. Now I'm going to go ahead and add another tool.
We're going to add an HTTP request tool. I'll go ahead and come up here to the name and just change this now to publish content. Go ahead and click rename.
And now what we're going to do is we're going to create a small workflow, which will accept this HTTP request that we're about to send. It will accept that request and then make a post to Twitter. Now, the reason why I need to do this is because these tools are a little bit different than these other modules here, and they don't have a tool to send to Twitter. So I need to use the HTTP request tool to a very simple workflow that will post a tweet to Twitter.
So I'm going to come over here and I'm going to add another workflow to my personal. I'm going to go ahead and right click and open in a new tab. This is going to be very, very simple here. We're going to add a new module.
Let's add a trigger. Let's go ahead and search here for a webhook. We'll add that here.
It's going to give us two URLs, a test and a production. We don't need any authentication. We can leave everything as is. Then we're going to add another module.
I'm going to type Twitter, X formally known, and we will create a tweet. You will need to add your own credentials. I've already got mine here.
When you go to create your credentials, you can go ahead and use their docs right here. It'll tell you step by step how to set everything up. I'm going to go ahead and use the credentials that I've already set up.
Resource, tweet, operation, create. And now here, what we want to pass in is the text that we get from the webhook. So I'm going to actually go over to a platform called Postman.
You can actually just go to postman.com. I'm already logged in, so you'll most likely see something that looks more like this. If you don't already have it, go ahead and sign up for free.
You'll see something like this. You may need to create your first workspace. If you come up to workspace, you can create a new workspace.
I'm going to use an existing one that I have. And all I'm doing here is that I need to call this webhook here that we created. So I'm going to come into this webhook and I'm going to grab this test URL.
I'm going to come back over here to Postman. I'm in my SGP Labs workspace. I'm going to go ahead and create a new API call.
I'm going to change this to post and then I'm going to drop in that URL here. Now I need to go back to my webhook and change this to a post as well. because we are going to send it data.
Then I'm going to just jump down here to the body. And from none, I'm going to change it to raw. And then you just need to copy in what I put here. So I'm going to put curly brace, enter, open quote, text, close quote, colon, test.
And now I should be able to come back to my new workflow, listen for a test event. It looks like I've got an outstanding issue that I need to fix. I'm going to come back out here.
It looks like it's just wanting me to put in something here in this text in order to even test the workflow. So I'll put something in there. I'll save it, test the workflow, come back to Postman.
Now I'm going to make a post to this URL. Remember, this is the URL that was in this webhook right here. You can't see it because it's waiting.
It's also right here. You can copy it. And that's what I have right here. And we're just sending it this test payload here.
So let's send it. We got it. And now we have the text here. So now what we can do is we can just come back to our X module here. And now we can map in what we sent it right here.
So I'm going to erase this. I'm going to grab this text. I'm going to drag it in.
That's good. So I can actually test this as well. And it's giving us this message.
You can't create a tweet with duplicate content. So it looks like I've done that test before. So let's come back, open up the webhook, listen for a test event, come back to Postman. We're going to update this to a new tweet that has never been used before. It wasn't listening anymore.
So let's go ahead and send the test. Now we've got a new tweet. Now, if I come back to X and we pass the new test, there we go.
Come back to Twitter, refresh. And there's a new tweet that has never been used before. I'm going to remove this other test here. Looks like people are commenting on my tests. So now we can come back to our workflow here.
We can exit out. And now what we want to do is save it. And now we're going to turn it on. So now it's live and it's going to respond without even having this text workflow.
But the only thing is we need to come into this. webhook here. And now instead of this test URL, we need to grab this production URL. So I'm going to grab that, click here, copy it into my clipboard.
We'll head back to our automation, go to publish content. We're going to change the method here to post. We're going to put in our new URL. We don't need to send a query parameter or headers, but we do need to send a body. For the specific body, we're going to change this to a JSON.
Now for our text here, we need to add a placeholder. Now this placeholder, when you're using HTTP calls, is a little bit different. Notice it's just this placeholder here.
So we're just going to grab that, copy it, put that in here. We're going to rename the placeholder to text. And again, so if we look at our Airtable database, we have the text here.
So we're going to pass in that text. And remember, the system prompt is what helps us set this all up. So here's the publish content system prompt. The purpose is to publish content from our Airtable database.
We're going to activate this by the keyword publish content. And again, here, we must first retrieve the record ID and text columns from the get text tool by looking up the CID. So it's going to grab that text for us and it's going to replace that here for us.
So now what we should be able to do is go ahead and save. I'm going to come to our database. I'm going to update this text now. I'm going to name it something else that just hasn't been done before.
And now I'm going to come back to our agent. We saved it. I'm going to test it.
So now what I'm going to do is I'm going to come to Slack. I'm going to say publish content C4. Run that. jump back to our agent. It's processing that.
It's getting the content. Now it's passing it to the publish content tool. So let's take a look at the publish content.
Looks like it started the workflow. So this workflow called this workflow. And we can come here.
We can look at the executions. Looks like one just came through and we can look at that, open it up. And it looks like we sent another tweet, come back to Twitter, refresh another tweet. So that is successful.
So we're doing good. I'm going to save it again and now we can move on. All right, so if you're here with me, great job. You're doing really well.
Now let's go ahead and move on to the knowledge base. Let's create the automations that we need so that we can look into our database of content, just like we have here. In this case, we only have one row in our database.
Let's build out the system so that we can search that knowledge base and then write new content from it and add it back into the database. Now, before we can search, we do need to add more content to our database. This isn't gonna be a great demonstration if all we have.
to write content from is this one row. So I already have a database myself that has all of the transcripts from all of my YouTube videos. If you don't have this, you'll want to pull something.
You'll want to add a few more rows here with some additional content that you've already created or create some sort of sample or have ChatGPT generate some sample content for you. Whatever you need to test this out, I'm going to go ahead and import titles and text from all my YouTube videos. I'm going to come up here to content. I'm going to import from a CSV. I have a local file here.
If you've never used this import, it's pretty cool. It's going to import all of this. I'm going to come down here to other settings. I'm going to exclude the first row, which is just the headers. So we don't really want to import the headers.
And you can leave that on. That's OK. And then for map fields, you want to make sure the data is matched up so that your title is going to the title and air table.
And here I've got this CSV and it's trying to map in the thumbnail to text. So I'm going to change. the CSV to transcription text. And if I were to look at this CSV real quick, we can see we just have a few different fields along the top.
And it's this transcription text column that I'm using to map into Airtable. So we've got the title into the title and then transcription text from the CSV into the title column. And then once you have that, we can go ahead and import the data. And now we've got all these new rows, titles and text that we can use to populate and create new content from.
Now, in order to actually index all this content and use it correctly, we do need to add a Pinecone database, which is a vector store database. It's really good at indexing text content like this and allowing you to build queries so that you can search this context for relevant content that you need for whatever you want to use it for. So if we wanted to create a video that was about how to make great videos. Well, we wouldn't want to look at all of the content. We would only want to reference the content that was related to creating good videos and how to write good scripts and stuff like that.
And so it turns out that Airtable is not great for doing that. If we were to search this Airtable database and try to find that relevant content, it wouldn't do the greatest job. We could get it to work, but it wouldn't return the quality inputs that we want in order to create really great content.
So you will need to go to pinecone.io. You can sign up. You can use a free account. Once you log in, you want to create an index. We'll go ahead and call this the.
KEDB solo demo. For the configuration, you want to use text embedding three small. Then you can go ahead and scroll down and pretty much take everything else as is.
You can go ahead and create the index. And of course, there won't be any records yet. Now I'm going to come back to the automation.
And so what we're going to do now is we're going to build out this other little workflow that is really independent from this. We're going to build out this other workflow that is going to go into Airtable and download all of these different rows and then actually index it and insert it into Pinecone so that then we can build out this part of the automation, which is our tool to access our knowledge base and grab the content that we need. So we're just going to build this out right here. It's quite easy. Just go ahead and add another module.
You can type Airtable. We're going to go ahead and just search for records. You're going to want to add in your credentials from the base. We'll type Solo. We'll use KEDB Solo Prototype YouTube Demo.
And then we'll go to Table. We'll select Content. For filter, we're going to go ahead and leave this blank and return all. Now down the line, you'll want to set this up so that it only adds content when new rows are added. But for now, just to get going, let's populate our database from all the records here so that we can go ahead and start accessing the data.
So here, if I go ahead and click test setup, it should return 117 rows, which is how many rows we have here in Airtable. Let's go ahead and move this down here and into some other region down here. Just going to... Move this so it's a bit more centered.
Now we're going to go ahead and add in a type vector so we can access the Pinecone vector database. And we're going to add documents to a vector store. Here you'll need to create credentials and a connection to your Pinecone database. The operation mode is insert documents.
For the Pinecone index, go ahead and search from a list. Now we're going to pick the index that we just created earlier, KEDB solo demo. And then we're good to go.
Now we need to configure these parts of the system as well for embeddings. You can go ahead and connect up your OpenAI account. And on that note, I used Claude here for this model for the AI agent. You can also use OpenAI for that as well. So again, for the embeddings, I'll go ahead and add that.
Again, you'll need to create credentials and add that here for your OpenAI account. And for model, you're going to pick text embedding three small, which was the same setting that we used when we created this index database to begin with. Now we need to configure this here for the document. We're going to go ahead and use a default document loader for the mode. I'm going to go ahead and say load specific data.
Here I'm going to update. this to an expression, two open curly braces, dollar sign JSON slash text. And so what we're doing here is we're bringing in the text from this column here into our database.
Then I'm also going to add in metadata ID for value. Again, I'm going to go to expression, two open curly braces, dollar sign JSON slash ID. So we can map in the record ID as metadata. You never know what you might need. We'll add in another property.
In this case, we'll get the title. Title. Value.
Again, we'll go with expression. Two open curly braces. Dollar sign.
JSON. Slash. Title. That should be all you need there. And it'll show an error until you add a text splitter.
So we'll add a character text splitter. For chunk size, I'm going to go with 5000. This is how many characters can be in each chunk. And what we're doing here is that when you have text that is really long.
may or may not be this specific video. But when you have really long text, you can't insert the entire piece into one record. You have to split it up.
And that's what this allows us to do very easily. So we're making the chunk size 5,000 characters. We're also going to have each chunk overlap a bit.
I must say 8 and 8 makes this super easy to do the chunking. It's quite difficult in other platforms. And now again, we're going to run this one time just to fill up our database. Down the line, you can set up a very similar automation to this that will trigger on new records and it will only add new rows instead of adding every single row. You don't really want to add every single row to the database over and over again, but we do need to prime the database.
And so this automation. will one show you how to do it and it will also give you the framework to set up an automation that will allow you to execute something like this except only on new or updated records so now what you do here is you go ahead and run this module it should find 117 records and once you see that then you can go ahead and just come to this module and you can run it and it's going to take those 117 records it's going to load up all the data from our error table database and it's also going to split up the text as needed and it will take a little bit of time so we'll go ahead and run this and you'll see this go and you can see it's at four and it's going to go all the way to 117. So I'll go ahead and let this finish processing. You can actually come over to your Pinecone database and you can see that it's starting to add in new rows.
You can actually take a look at them and you can see we've got these embeddings here that were created by OpenAI embeddings module. And we've got the text. Looks like it's been chunked from another row.
We've got the ID. We've got the title of the original video. So it looks like it's going well. We're at 42 now.
We need to get to 117. I'll just let this run and come back when that's completed. All right, so now we're done loading up our Pinecone database with our information from Airtable. So now we can build out the tool to actually get the knowledge from the database, create new content, and then add it back to Airtable. So I'm going to come up here.
I'm going to add a new tool. I'm going to go ahead and type vector, and then we can grab this tool here. I'm going to go ahead and rename this now to get knowledge.
We'll go ahead and click rename. We'll go ahead and give it a name, content, knowledge, database. After filling out the name, you can put in a description.
And here you can control the number of records that it pulls back when you do a query. So how many of these records should it pull back if it's able to find content that's relevant to the new type of content that you're trying to create? I'll go ahead and just put this at 10. Then I'll just rearrange this a bit. Might have to start rearranging things here a bit more. Move this over to the right.
Now we need to finish the configuration for the vector store. We're going to add our pinecone database. That's what we were building here. You can leave the operation mode as is for the pinecone index. Again, you're going to want to pick your new database.
That should be good to go. This got added way over here. I'm going to pull this back. Now we need to add the embeddings the same way we did over here. I'm going to go ahead and use the OpenAI embeddings module.
Again, you can use your credentials. And for the model, we'll use text embedding three small. And we don't need to worry about any options.
And then the last thing that we need to do here is add a model. We'll go ahead and use OpenAI. You can try ChatGPT 4.0 Mini.
I have better results with ChatGPT 4.0, but there isn't a right answer for every situation. So in general, I like to use 4.0 until I figure out I can use something that's a little bit cheaper. That's all you need for that. And then once you have these, you should be good to go.
So now all we need to do is review the system prompt for how this actually works. So I'm going to scroll up here to the text document. This is the new operation that we're adding here. generate or create content. The purpose here is to retrieve knowledge from the Pinecone vector database and generate content based on the results.
So this is how we use it when a user requests new content to be generated. We always use the get knowledge tool to search for relevant content in Pinecone before generating any new content. So what we're saying is just make sure to use this get knowledge tool before you do anything else. If relevant information is found, incorporate that into the generated content. If no relevant information is found, inform the user.
and ask whether to proceed without it. And then we tell the system to automatically add the new content with the add content tool and return the new CID. So again, I've already preloaded this into my AI agent here. If you haven't, you'll want to add that in now.
We'll go ahead and save everything and we'll go ahead and test the workflow. Let's head back to Slack. We haven't been here in a while.
And now we can say generate content related to the wow statement for creating. videos, and a strong script. We'll go ahead and run that.
Jump back to our agent processing our request. It's going to the knowledge base to pull up the relevant articles. It's going to write that article.
It's writing that article now. It should add it to the database. It added it to the database and now it's going to do a final response back to Slack. Jump back to Slack. It created the new pieces of content and it added it to the database.
So if we come back to Airtable, We'll see C4 because we're not sorting it. So I'm going to sort this by CID in reverse order. So now we have C121. Unlock the secret of captivating videos using the wow statement.
So again, this is all content that was generated from content that I loaded into Airtable and then primed into our... database here. And of course, if I was in Slack, I could say get content C121, come back to our agent processing that request.
It's going to get that content. Now it's processing it and it'll send that data back to me in Slack as well, just as a reminder that we can do that. So that here we can see the exact content that was in the database.
All right. So now we've built out the majority of the system that I showed you. Now, the last piece that we need to add is this special case here.
where we are just allowing ourselves to go into Slack, where we can come back into Slack and we can put in audio notes where we're talking about a potential idea for content. And we can just drop that here into Slack using the microphone directly. And then we'll process that audio, transcribe it, and then add it as a content row here.
All right, so we're in the final stretch. Let's go ahead and add in the automation that allows us to put in audio notes into Slack and automatically transcribe and add those into our Airtable database. The automation is pretty simple.
It looks just like this. Now, first we need to add this little switch so we can control whether the automation should go down this path or this path here. So I'm gonna come here, I'm gonna add some length here, and then I'm gonna add a new module here. Then we're gonna search for a switch. And now what this allows us to do is to go down different paths depending on what the value is here in Slack.
For this first value, the value that we need does not exist yet. So I'm simply going to take one of these values and drag it over here. And I happen to grab the TS. So we have the .ts. And I'm going to change the TS to files.
And more than likely, it's going to turn red because this value has never shown up before in our trigger. And so it's telling us that. But what we need to do here is we need to say, hey, if this files does not exist, and remember, this is an array. So we're going to go to array and we're going to say does not exist.
So when we get a trigger from Slack, it's going to look and say, is that files array? Does it exist or not? If it does not exist, we're going to continue down this path. So now I need to connect it here.
We've got the switch. It's going to continue down this path if there are no files. And when you upload audio through the microphone here, it will add these files to that array here, right?
So now we come back into the switch. We're going to add a routing rule. We'll change this new route to expression and we'll just copy what we had here into this section here.
So this first route is making sure that files does not exist and this second route is making sure that the files do exist. So we're going to come to array, exists. If we test the step it's going to go down the first path, output one. Now on this path when files do exist we need to get the file. So I'm going to come here.
I'm going to add a new module slack. and we're going to go to File Actions, Get File. You're going to add your Slack credentials here.
I'm going to use the credentials that I've been using throughout this demo. And then for the file ID, I'm going to turn it into an expression again, and I'm going to add this text in to OpenCurlyBraces$JSON.Files open bracket, zero, close bracket, dot ID. So what this is doing is it's grabbing the ID of the file that I uploaded.
So this is a good place to stop. I'm going to come here and save. and test.
I'm going to come back to Slack. I'm going to go to the content engine where I built out this new demo. Again, we're here in the solo. And now here to demonstrate this, instead of recording an audio here, I'm simply going to paste in an audio MP3 and send that across. And now you can see that this was triggered.
And now it went down this path because we do have files and it looks like we were successfully able to get that file. So now just to save on space, I'm going to move this down. So now this got the information of the file. Now I need to actually download it.
So I'm going to add another module. We're going to use an HTTP request. This is going to be a Git request.
The URL is going to be the URL private download. Make sure you use that one and not the URL private. You need the URL private download. For authentication, we are going to use generic credential type. Generic auth type, we're going to go ahead and use header auth.
I'm going to go ahead and create new credentials. to this Slack account. I'm going to scroll down and create new credentials.
Now for name, you're going to type authorization. And for value, because you can't see it, I'm going to come into the notes here. You want to type bearer, just like that, with a space.
And then you need to get your API key from Slack. So we're just going to jump back to our Slack. I'm in my KEDB solo. I'm going to jump over to the OAuth. I'm going to grab this key here, copy, just into my notes.
And then what you want to do is copy this whole thing. into this value here. And I did it like that because as soon as I post it, I can't see it.
Now, if you did want to just type bearer and you can't see it, and then you put a space and then put the key, that's fine, but it's a little bit harder to see. So I'm going to do it this way. I'll save it.
Now, if there are issues, it's probably related to that header off. Now I'm going to add headers, go ahead and use fields below. I'll type accept. And then for value, you can go ahead and use application slash octet dash stream.
You want to make sure you copy. this exactly as I have it. I'm actually going to use a lowercase a. I don't think that really matters, but that's what I had before. So I'm just going to stick with it.
And then in the options here, we're going to add a response. And for response format, we're going to go with file. And we're going to name that output as data because it's a file and it's data. So that makes a lot of sense. So we should be able to test it.
And you can see here that we have data, audio.mp3, file extension.mp3. So this worked. just fine.
If you see something else instead of an MP3 and it says dot HTML, then you know you did something wrong. You'll need to correct your authentication or your URL. Something in these settings is not correct.
Next up, now we need to use OpenAI, transcribe a recording. Should already have your credentials, you can go ahead and add those. Resource audio operation, transcribe a recording. And for the input data field name, you just type data because that's what we called it in the previous step, data.
Now you should be able to test this step. So now we have the transcription. Now we just need to add it to Airtable. We'll create a record.
You can use the same credentials that we've been using for base. Again, we'll type solo. For the table, we'll use content.
For mapping column mode, we'll leave this as is. We'll leave the title and we can just take this and drag it into the text. We can go ahead and test that step and jump over to Airtable. We see that new piece of content that came in from the audio notes.
And then finally, I just want to send a message back to Slack that it was successful. Slack. send a message use your slack credentials resource message operation send to channel and then we need that channel id again again we'll come here click into this area copy the channel we'll change the channel to id drop that in here message type simple message message text we'll just say successfully added audio notes to air table as and then we'll change this to expression and then we want to drag in the CID. We'll move it to the schema. Then we can actually access the CID and just drag it right here.
And now we can test it, come back to Slack. So it didn't come back. So that likely means that I'm using the wrong Slack credentials. There we go.
Move it to Slack 3. And before I move on, I actually realized I need to add the reply to options. So I'm going to come to options, add option, reply to message. And for the timestamp, again, I'm going to come over here to the Slack trigger.
I'm going to collapse the files because it's not there. It's right here. So we need to reply to that timestamp, reply to thread.
We'll go ahead and test. Successfully added audio notes to Airtable as C122, which is what we got right here. Now, if you want access to this automation template so that you can simply import it into N8n just like this, along with the Airtable database template and the system prompt for controlling your AI agent, make sure to jump into the NoCode Architects community. You can get access to the templates that you saw today, plus a whole lot more.
There's a full business clarity course for launching your AI automation business and a bunch more. Plus, we have calls almost every single day. I hope to see you there.
Either way, I hope you enjoyed this video and I'll see you on the next one.