i just created an AI agent clone of myself and in this video I'm going to be sharing with you how you can do the same thing for yourself let's dive into this the first thing I want to do is actually just demonstrate this because I think it's really really cool and then we can break down the process together hey Jonno how are you doing today what's going on and so I sent off an audio message it's going to process that audio message and then create a response back and send it back to me let's take a listen to what it sounds like hello Count Jonno i'm doing well thank you for asking as for what's going on I'm here and ready to assist you with any questions or topics you want to discuss whether it's about technology advice or anything else feel free to let me know what can I help you with today okay that's like slightly creepy that it sounds so similar to me and yes I also programmed this thing to say count Jonno not just Jonno because why not i think that's absolutely hilarious and today we're going to be building this out now as always with every single one of my blueprints on my YouTube channel they're all free so if you guys want to download it it's in the description down below all you have to do is download the file and then come over to these three dots in the corner and then import that file and you're good to go now the technology we're going to be using today to build this out is going to be a combination of NAND and 11 Labs nad is going to be powering the automation and the AI agent and then 11 Labs is going to be generating the voice clone now just before we dive into it if you guys haven't taken a look at my community yet I just launched this about a month ago we have over 300 members in it and this is a place where you can get access to tons of additional blueprints not found on my YouTube channel as well as tons of additional content courses and weekly group calls that you can jump on and get help immediately whether it's a techreated problem business problem or whatever the case is with that being said let's dive into this right now okay so let's get started the first thing that I want to do here is create a trigger and essentially what this trigger is is that when we receive a message from Telegram well we're going to want to start this and so for the purpose of today's video I am using Telegram you can use tons of other um triggers as well you could use WhatsApp you could use Twilio you could use um even Siri i mean you can even get this to do fire off Siri but there's a lot of different options is what I'm trying to say and what we're going to be using is this on message and essentially what this is saying is when we receive a message then we're going to start this workflow and so the first thing that we have to do here is just we need to create a connection between Telegram and our particular AI agent here and what we need specifically is this access token and how we get that is through these docs here so let's go ahead let's open this up and follow the exact process that's laid out before us by NADN and essentially what they're saying here is we need to access or start a conversation with Botfather this makes me laugh every single time I see it it just cracks me up so we'll go ahead and click this link and it's going to open this uh message in Telegram for us and so essentially what we can do here is just come back close this tab and follow the exact process outlined here we're going to first of all copy this which is /newbot and I'm just going to paste that in here and the second thing that we're going to do is we need to name this and so we can name it essentially anything we want for the purpose of this I'm just going to do voice AI clone Jonno and essentially that looks good to me and we're going to then go ahead and create a username and this username has to have Tetris bot or like bot at the end or uh in some capacity for it to work and now this has to be different than any other particular username out there if somebody else has the same one it's not going to work and so I've gone ahead I've created it we're all good to go the only thing is is we need to copy this particular access token here and then we're solid okay perfect so I'm going to close this paste the access token in here and this is good to go we'll save it credentials have been added everything's set and now what we can do is just test this step and send a message over to us just to make sure that this connection is you know actually good here and uh let's go ahead and try this out so I'm going to click this link here oops this link right here and then it's going to open up a new chat and we're going to start this together and now we should have received a message which we have and we can see you know everything coming in here awesome so the next thing that we want to do here is create a switch statement and what this switch does is it routes down different paths so you can think about what we're trying to build here as this uh AI agent we have two routes one is for audio and one is for text and the reason why we have it this way by the way is because one is going to be essentially more or less for um audio again the other is for text but the way we process these are going to be different and because they're different we need to route them down different paths first to be able to handle for example transcribing audio um and so for that reason we just need to process them differently so we'll go ahead and do that the first path we're going to choose here is going to be audio followed by text i just want to test this workflow first just to get some test data in here so it's going to be test and we've received it okay perfect and awesome so we'll open up this switch statement here and we got tons of different data on the side here specifically what I want to do is find a variable that's going to be different between an audio message and a text message and what that to me is is this text field down here because if it's an audio message it will not contain text in it so what we can do is we can say for the audio path the string does not exist and then we're going to add another route and in this instance and we'll just want to make sure that this is an expression here in this instance it's going to be um a string that exists okay so in one instance we have an audio message another instance we have a text message okay perfect and what we can do for the text message is we're just going to simply add an edit field down here and we're going to create a new field called string or text okay and this is going to have the value of the text that we're passing in here and I'm going to explain in a later point in time as we kind of progress with developing this why this is the case so I'm just going to type in another message here and test the workflow make sure it's going down the text path here which it is and all we need to do is just make sure that this text key here has a value and that value is the message that we typed into Telegram okay perfect so that's option number one done here the next thing that we want to do is go ahead and test to see if we can get some audio in here so let's try this out and for the purpose of this I'm just going to say botfather because I think it's hilarious every time I have to create these bots it cracks me up bot father okay so that's our test message we'll go ahead we'll give it a shot and it looks like it worked and it went down the audio message i'm just going to open this module up and I'm going to pin the data up top here because I want to make sure that I don't have to essentially restart this every single time I want to test it instead what I want to do is I just want to be able to run it and run it based on that saved or mock data that we just received okay perfect so now that we've created our audio message and we've routed it down the audio path the first thing that I want to do is actually download that message so we need to go back into Telegram and we need to choose this get a file option here because right now um we just have like some binary text or code or whatever and we need to convert that into text and so all this needs is a file ID and we can get that file ID based on the voice um object here we can see that it has a file ID so we're just going to pass that in so we'll drag and drop this in we'll test it out and great we've now officially downloaded the data off of that audio message and this is an audio message of me saying botfather okay cool lastly we're just going to transcribe this so I want to use OpenAI to do this and we're going to choose transcribe a recording and what this does is it turns it from um speech into text and more or less that's it i mean we don't really have to do anything other than that cuz out of the box it works we just need to create a credential if you guys haven't done so already and we'll need to get an API key from chat GPT if you guys already know how to do this because you've seen me do this like 60 times in the last videos then you can skip slightly a bit forward but in order to get an API key we need to go over to platform.openai.com openai.com and sign in and then we'll go over to the gear icon here and then we're going to hover over to the API keys now in the API key we can just create a secret key and then we're good to go so I'll just call this like um botfather API key and then we'll create that and we'll copy this in and uh we'll paste it right here okay sweet we can save this and now we're good to go the only other thing worth mentioning here is that you will need to add $5 uh onto this account if you don't add $5 onto OpenAI you're not going to be able to access it and I say five because that's just the minimum that they will accept I believe so um we're good to go here we've connected our account everything's working we can test the step now and see if it works and we got the message back even with a period man it it captured my vocal tonality so well um that's awesome so we're good here um we can see that now the response has the key text and the response down here also has the key text as well in either instance they have the same key and that's really important and circling back to what I was saying earlier we're going to use a merge step here and what this merge step does is it will essentially take the value in either instance and merge it into one into one so whether we're going down the um audio path or whether we're going down the text path we're going to merge back in and we're going to merge based on the key here and what this key is is text and so whatever we get um what whatever value we get from the transcribed message here or the the text field or the text um that we're actually putting into Telegram down here it's still going to have the same key we can merge it back in together at this particular spot here which is really important because we're going to use this to essentially um add that text into the AI agent which is coincidentally the next step here so we'll create the AI agent and everything pretty much works out of the box here the only thing I want to bring up is that this particular JSON chat input is going to be wrong it's going to draw an error if we test this step out we'll see that it doesn't work and I think my face is unfortunately blocking it but uh we have this problem in node AI agent and there's a couple things here uh firstly we have the wrong prompt and that's because by default whenever you're building an AI agent it's expecting that the message you're receiving is from their default native chat widget here but we're not using this we're using Telegram and because we're using oops because we're using Telegram we need to map in the chat ID here to the AI agent over here and so what I'm going to do is I'm going to choose to define a different trigger here instead of the chat chat node and um essentially we're grabbing the message now instead of grabbing it actually from the telegram trigger because we have two paths that they're going down and we don't know necessarily um over here which path is actually taking we're going to pull it in from the merge step because in either instance they're both going to have the same key which is called text and so in a nutshell coming back in here we're going to grab text and paste it in here and this is going to be the text that we're receiving from um from the telegram okay awesome so this is good now we just need to add a couple things in here first thing is the brain of the operation you can think about this like chat GPT essentially in a nutshell it's like the reasoning and logic behind this AI agent you have a lot of different options here but for me what I'm going to choose is I'm just going to pick um OpenAI down here and I think my face is probably blocking that but this is just what I'm going to choose for this and out of the box this works perfectly for me and the next thing is we're going to add memory now what the memory is is it's just how many messages does this AI agent remember and so that way you can send multiple messages and it can be like oh yeah you also said this in the previous chat window or whatever and so I'm going to remember that and apply it to whatever you say next similarly to how chat GPT works the only thing here is that again we're passing in the wrong session ID and we need to connect this into Telegram as opposed to what it thinks is the default chat trigger here so we're going to define something else we're going to pass in this key and so how we can pass in this key is just by selecting over here we're going to choose the Telegram trigger and what I want to add in here is I want to add in the chat ID over here and this is going to be unique ID that we can reference every single time to grab this chat so this is good now we have memory attached to will remember past messages and you can add in as many tools as you want here these tools could be things like hey check my calendar for me or hey take a look at my um my Google Sheets or add something to Google Sheets add something to Air Table uh whatever the case may be there's a million one things you can do here but essentially this is kind of outside the scope of this particular video because really this is just about how we can make an AI clone of ourselves and talk back and forth to each other but if you guys are interested in learning this kind of stuff I have tons of videos on this in my YouTube channel they're all free they have there's blueprints for all of them you can just download all of them and use them immediately and so for that reason I'm just not going to go too far into detail in this call so we're almost done with this video we just have two more steps here because we need to take this AI agent response and then we need to actually send it back over to Telegram so that we can receive it over here and so what we need to do is first of all convert the response from this AI agent into audio and then once it's in audio then send it over to Telegram and so how we do this is we're going to use something called 11 Labs and um essentially usually what you do is you'd add in a module here and you type in like 11 labs but they don't actually have an integration which is kind of for unfortunate right but the fortunate thing is is that we can still create it ourselves now just before I talk about creating it I want to talk about the NAND integrations i'm going to go over to the their integrations they have a,031 integrations in a nutshell an HTTP request is like literally the exact same thing as Google Sheets or sending an email or Gmail or Air Table or Google Drive these are all HTTP requests the only difference between these okay and an HTTP request is that these the NAN team has gone in and they've actually done all the heavy lifting for us they've created the integrations they've made sure it works so that we don't have to do it but um with HTTP requests we have to actually do the heavy lifting and connect it in and one day you know 11 Labs will just have a native integration into NAN just like Google Sheets or Telegram or whatever but for today it doesn't so more or less that's it we're going to have to create this ourselves and how we create this is by using an HTTP module and we're going to have to build this integration from the ground up now the first thing that I want to talk about here before even building this out is how can we create that sweet cool AI clone of our voice and how we do that is by heading into 11 Labs if you guys haven't done so already um you can go ahead and sign up for a an account um and so you can try for free but I think with the AI clone of your voice you're probably going to have to sign up for their uh starter plan right here which is $5 a month and so just keep that in mind once we go over to uh our account we can create a voice here and if you are able to clone your own voice it might just time out with these API calls because usually they don't give API calls in the free plans anyways but um yeah so we'll go ahead and create the voice we'll hit this plus button and in order to clone our voice we'll use choose this option here which is instant voice clone and um yeah you can just essentially audio record yourself i would recommend doing this as many times as possible because um every time you do this it's going to substantially improve the quality of the voice that it generates for you however you can also upload files too and so this is what I did i just uploaded multiple files and then that was easier for me because it was longer um and the longer the messages or the longer the audio files you upload the better your voice is and so I'm not going to redo this again but in a nutshell oh I'm going to try and go back here but it's like it's like preventing me from going back i think I'm stuck here um anyways I might end up le I might end up just ending the uh video here because it's just not letting me go back i'm just kidding uh okay here we go and here's my voice over here let's just test it out trains carry our hopes on pathways of progress wow that was just so inspiring 11 Labs i uh I can't even get over it i'm just kidding it wasn't inspiring at all okay so this is good we can um we can view our our voice here and just keep in mind we have this ID here this is going to come in handy later on so circling back we need to integrate N into 11 Labs well how do we do this we're going to go to 11 Labs um API documentation and we're going to go to the first option here okay so essentially we're going to look at these endpoints here these are like API endpoints in a nutshell this is just like technical jargon for saying that inside N8 or inside any application but in regards to 11 Labs there's a lot of different functions or tasks you can do one of the tasks is in 11 Labs turning text to speech another one is to create sound effects another thing is to turn text a voice or create a voice and so these are just all different tasks that you can perform and with these endpoints essentially what it allows us to do is to integrate into 11 Labs externally so instead of doing it from within their own application here we can do it from NAD here and so circling back we are interested in this create speech so we're going to create speech using 11 Labs from NAD and we're going to do this uh in this module here and this essentially gives us all the ingredients we need to be able to um yeah work with 11 Labs and NAN so let's go through it together and the first thing is is that we see an example here of like kind of what it looks like so we can just literally copy this we're going to use a post request here what a post request is is it's again like software jargon for saying we're going to create something so you can think about it like a postman that delivers a parcel to your front door you're you're literally just you know creating something somewhere else you can think about it like creating a voice in uh 11 Labs you can think about it like creating a client in your CRM those are just two examples and then we need to add in the URL here and so we can get this URL straight from here again all we have to do is just copy this but I'm just going to copy it from over here because this is like the full URL here and I'm going to paste in here okay perfect and there's just two things I want to point out the first thing is is that this colon voice ID is a unique variable so we actually we can't just paste in voice ID we actually have to you know put something in there and so this is where this ID comes in handy from 11 laps so we'll just copy this because this is the unique ID for that voice we paste here so now we're referencing that particular voice and you can see also when we copied it in there was just a little space there and that space is enough to break everything and cause complete destruction so we just want to go ahead and remove that okay sweet so next uh we have these slashh's orh's this is just basic boilerplate stuff that you have to do anytime you create um HTTP methods you'll notice it was a - H that stands for header there's nothing in particular we have to do here we just have to essentially copy in everything we see the only uh caveat to that is this uh API key here which we're going to have to change because we actually need to add in our own API key so we'll go ahead copy everything else in here and we'll get this application/json and then we're good for the headers and then this uh slash or dash d I think stands for the body down here so we're going to choose body and I want to choose JSON and I want to choose JSON just because I'm literally going to copy and paste everything they have in here into our JSON module here we can see that it's drawing an error and that's because we haven't formatted our JSON correctly we have this uh quotation there by mistake and even one character out of place is going to cause this whole thing to break so just be careful with that and then more or less this is it we're going to have to change two things first the API key and second we're going to have to change this text down here i'm going to leave this text for now just because uh we don't have any past data to pull in here so we need something to test it out with so we'll go ahead and grab that uh that API key which is the last thing so we'll go into settings down below here and go to API keys and I'm just going to create an API key i could either call it Titanic Jaguar hm that's not a bad name titanic could you imagine a Titanic Jaguar or I could just change this to botfather which I think is more more applicable because why not we're on the the botfather theme here okay circling back we're going to paste this API key in here and we're good i'm going to save this and we're going to test this workflow out up until now okay so it's just generating the response here and now it is creating the the the voice and we can see the data has come back here so this is good everything's good to go the only thing is is that I want to change this text here to uh the output but I just don't want to do it yet because this is like a lot of text i don't want to create something this large and also you can see there's a lot of special characters like the pound sign or like the dash n or like the quote here or the quote here and this is actually going to break the JSON if you have like these um quotations and you add in here it's just not going to work and so uh instead of making that mistake I'm just going to skip over that for now and the last thing we need to do is just send that back to Telegram so we'll select Telegram and we are going to send off an audio file and with this audio file um more or less in a nutshell there's three things we got to do the chat ID here we need to switch this to binary and we need to add a title to this so the chat ID we can get from the first module and so we need to go back on the input here to the Telegram trigger and we're going to choose the chat ID which is right here perfect and we have the binary file and the last thing is we just need to create a title here so like a file name and I'm just going to call this data or whatever and that's pretty much good to go i'm going to save this and we're going to test this workflow again to see if this worked and then the last thing we need to do is just change this file message here but I'm going to do that after I unpin the data here okay let's take a look and see if uh if this worked okay perfect we have our message the first move is what sets everything in motion wow Jonno you just sound so wise i'm just kidding oh my gosh okay that's pretty cool uh we got the bot to work here um it's it's always like weird hearing your voice on the other end it's like am I talking to myself right Oh I guess technically I am but it's like clone of myself anyways it's kind of weird but it's uh it's cool i'm going to unpin this and I'm going to change the message here to um the message over here and then we're good to go so I'm going to delete everything here i'm going to drag this output in between these two quotation marks just make sure it's in between the two quotation marks exactly what I did not do here so just don't do exactly what I did there and uh yeah I just keep these quotation marks just as they are there and then we're good to go we can click save and now I can start freely messaging with my AI clone of myself my agent clone AI agent clone of myself hey Jonno how are you doing today what's what's on your mind okay let's see how it responds we'll test this out and see what's on the AI clone version of my mind okay perfect hello again Count Jonno i'm doing well thank you as for what's on my mind I'm here to help you with anything you need whether it's answering questions discussing ideas or just chatting what about you is there something specific you'd like to talk about today man I could just talk to myself all day like this this is awesome the uh last thing that I want to do here is I just want to add in the AI agent here and the reason I want to add this in is because I kind of want to just add like a system prompt here and I want to say your helpful assistant named Jonno and your um tasked with answering user questions the user's name is also Count Jonno and I just like this because I think this is freaking hilarious imagine like talking to yourself and it replies to you as count i mean that's just I don't know that's like so silly it's ridiculous um okay so this looks good to me um and then essentially we can just add in any other system messages in here that we want to so if we were to like add in tools here to check our calendar for the day we could um add rules in here to say hey you know this is how certain things are so anytime we're dealing with tons of tools on here and these tools can be doing so many different things we just want to give instructions on how to use those tools effectively and I again I have tons of videos talking about this and so I highly recommend taking a look at that so we'll just try this one more time and uh let me let me think here what is the coolest thing that you can think of when it comes to a fact Jonno okay let's see the coolest thing I can think of i'm very interested here okay it looks like there is a problem actually so we have an error here essentially saying that the JSON data needs to be valid JSON and the reason you get an error like this is because well this JSON down here isn't formatted properly and so anything that you add that's like not exactly how it should be formatted is going to draw an error so for example a comma out here would draw an error this would draw an error whatever all all this kind of stuff can draw an error and essentially what's going on here is that this text it looks like it's text but you can see these like slash ends these are line breaks in code and you can see it's slightly different slightly darker than the other purple and so stuff like this is probably um not actually acting as quote unquote text but it's acting as like some other code or data type which is drawing the error here because it's expecting text but it's actually getting something else and so what we need to do here is we need to type a uh function which is called JSON.stringify and then we're going to wrap this in brackets here okay oops the bracket doesn't go there the bracket goes here now what this is doing JSON.stringify stringify is it's taking JSON data which is like this here this is all JSON data and it's turning it into text okay and so now when we run it um it's going to it's going to turn all of the these line breaks and special characters into text and so I've gone ahead I've pinned the data here and I'm going to test this workflow out we'll give this a shot okay so we're still encountering an error here let me just pull this up and it's saying it's still related to the valid validity of the JSON and what I think is going on here is that we're double quoting it so if I just pull this out yeah so we can see here that we have double quotes now which is also not good so we need to delete this and then we also need to delete this and now we can test this out again and it should work okay fingers crossed here we go i'm holding my breath okay it worked awesome sweet so we're going to get this response back to Telegram by the way all of this code is going to be down below for free for you guys to download so you don't have to worry about this if you don't want to set this up let's take a listen to what it said here a remarkable fact pertains to the honeybee honeybees have an extraordinary method of communication known as the waggle dance na when a worker bee finds a good source of nectar it returns to the hive and performs this dance to inform other bees about the direction and distance to the food source the waggle dance consists of a series of movements that convey information about the angle relative to the sun and the distance to the flower the duration of the dance signals how far away the food is allowing other bees to efficiently locate the nectar in addition to their impressive communication skills honeybees play a crucial role in pollination contributing to the growth of many okay I'm just going to pause it there because this is quite a long message but Jonno I got a voice AI jonno I got to say I'm quite impressed with your knowledge on honeybees i don't know how you know that much but uh you know certainly a lot more than I do so that's pretty much it in a nutshell guys thanks so much for watching this is you know how you can create a voice AI agent clone of yourself and then you can just talk back and forth now if you guys need any additional help you can take a look at my school community over here where we have over 300 members and so this launched about a month ago if you need any help with like um courses or learning more about NAN or 11 Labs or if you want blueprints or if you want to just jump on weekly calls because you get stuck on technical problems like that JSON stringify I have a calendar here where there's five calls every single week and you can just jump on and ask questions screen share will debug everything together because obviously this kind of stuff is great when it goes well but when it doesn't go well and then you start encountering issues like we did over here it can take hours and that's where I want to come in and kind of help you guys bypass that time because obviously time is money and it's the most valuable currency and obviously the faster you get this up and running the the better off you're going to be so thanks guys so much for watching really appreciate your time if you haven't subscribed to this channel already and you're still watching I highly recommend hitting that subscribe button because there's going to be tons of more content just like this video released all the freaking time so if you like this I'm sure you're going to like the other content thank you so much and I look forward to seeing you guys in the next one bye-bye