ChatGPT is on Telegram! 2 easy ways to build an AI ChatBot in Telegram (GPT-4)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
check this out I can receive email summaries as telegram messages I can also send chai GPT a voice note and is going to give me an answer I can even generate daily images right from telegram so in today's video we're diving into two ways you can create a chat GPT powered telegram bot I'm going to show you two ways to do it the first one is going to use the no code or claw automation tool called boarding again no code required and the second one is going to be very low code you not need to know how to code yourself just follow along I promise it's not rocket science you first let's build a chatbot using birdie you'll need to download the browser extension I'm going to leave a link to it down below and berdin already comes with a lot of pre-built automations this specific one is going to send new emails as summaries that are generated by open AI to telegram so you can click on these three dots and open the Automation in the Builder to see what's inside the first action is a Trigger action it says when an email is received then you're going to generate a summary of that email and send it as a message so let's click on done and click on the automation to try it out I need to provide my Twitter handle when you go to telegram you can click on preferences and see your handle now let's copy to the clipboard I'm going to paste it over here and click on activate one very important thing you need to remember is that the first time when you activate this automation you need to send a message to boardingbot so that they can message you back it's one of the requirements by telegram so just message working bot now let's go ahead and test this automation you can do this by forwarding yourself and email so you will receive an email which will trigger this specific automation here I have one over here from a newsletter which I want to be summarized I'm going to type my email and send it through now let's go back to telegram it looks like I've received two messages actually one is a request to join Select Community and the other one is the email I've just forwarded as a summary what makes pardin really cool is the fact that you can plug in your existing third-party services process them with open Ai and get them sent to Telegram in order for you to build a custom automation you can just click on create an audiobook pick one of the services that you can see here in the left corner you can also add new ones over here for example when there's a new calendar event created you might want to get a notification you can click on when something happens and pick your trigger from over here you can also select an app that will show you all the triggers and here you can pick an action something like when email is stored you trigger it yourself manually by clicking on this start icon let's open up the board game backup and then we're going to add and open AI action one of my favorites is this classification actions it has a number of different variables for example the text to process here we can pick the Trigger action text coming from the trig reaction and pick the body of that email and then for a classification we can say something like important and not important so those are the classes that we've created finally let's provide a little bit of context so here I say that important emails are the ones that are Urgent or where I'm at the bottleneck that's the context for our classification you can also pick a model from chai GPT to process this with I'm going to pick gpt4 and now here's a really cool part you can add a condition saying hey if an email is classified as urgent then send it to Telegram [Music] now I'm going to send a very urgent email like this open it up let's trigger it by storing it okay there it is [Music] to build automations with codeine you'll need only three actions the trigger the chat PPT action and finally they send message to telegram action here are the open AI actions that are available you can summarize text get emails generated do classification sentiment analysis recommendations find action items and text and even generate images with open AI and now comes the second way to build a chi GPT powered telegram bot similar to chair GPT that you're used to you can text back and forth with it but right inside telegram but my favorite feature is sending voice messages so you can interact with voice with your chatbot and you can also prompt chatgpt inside telegram to generate images using open ai's Dali which is really awesome you can text back and forth in different languages and so much more so it's going to be a really cool build one thing that you need to remember is that this is going to be slightly technical but this is not rocket science I'm a very beginner programmer and if you get stuck at any point in this tutorial you can always go to chatgpt and ask it how to solve a problem at hand and most likely you're going to be able to figure it out and get going very very easily here's the quick game plan there are only two steps step number one is for us to copy a pre-built coding template and number two is to deploy that code in the cloud so that would not need to run the code on our computer because when our computer is off you no longer can use your telegram when you're on the go so two steps number one coding template number two deployed in the cloud ready let's Dive Right In so for the first part we need to copy the templated code there are two versions that I tried out both of them work pretty well uh the first one is by this guy over here and this allows us again to send voice messages here is a list of features that you have that this specific version provides and then most importantly you have your installation instructions and then there's this other version that I also tried out which is super neat it has a little bit more functionality you can try it out yourself as well but sending it to the cloud is going to be slightly more challenging and slightly more complicated so I'm going to go with the first version just for this tutorial so if we scroll all the way up we have all of the files over there that we're going to duplicate on our local machine on our computer and then you have the readme file that that has the instruction pretty simple right the first thing that I want to do is I want to Fork this repository forking means that you're going to create a copy of all of the code and all of the information so if you make any updates if you have your other version of this chat bot you can have it saved inside GitHub in the cloud so that other folks can potentially use it as well but we're going to be using it later on to deploy this chatbot in the cloud so let's click on create Fork as you can see here we have all of the files but now they're under my name and I can click on this code button drop down and then click on open with GitHub desktop if you don't have GitHub desktop installed highly recommend you to use it because it is a visual interface opposed to the terminal interface for you to interact with the repositories that you have inside GitHub so in this step we're asked where do we want to copy the files that were previously in the cloud why would we want to copy them locally on our computer I have this coding folder right there you can choose a different one if you want to and I'm going clone all of the files so I have a copy on my device I'm going to pick for my own purposes click continue and from there you can just make sure that you are in the right repository click on this drop down make sure that you have this repository selected this is the exact copy of the template and then from here I can click on repository and open it in Visual Studio code this is my code editor it's going to open up the workspace with all of the files that we can view here very nicely now let me give you a little house tour over all of the files that we've just copied so we have requirements first those are the requirements for us to run the code every program every app out there might use different language different libraries and it has different prerequisites we'll need to install those I'm going to show you how to do that in a second it just takes a couple lines of code that we're going to copy paste then there's the translations file that gives you all of the support messages but in different languages we have the standard license file over here the docker file which you not need to know anything about and most importantly here in this folder called bot here you have the main file main.pi so it's a Python language file and this is where your chat bot is located this is the program that we are going to run then there is your environment file dot EnV which will store all of your password the telegram bot tokens Etc we'll come back to that file in a second let's go back to this readme file and follow the instructions the first thing that we want to do is want to create a new virtual environment this will have all of the prerequisites installed for our program to run this is a python command meaning that you need to have python installed if you've never opened a code editor a terminal most likely you do not have python installed yet so make sure to go down to the description of this video to download python so I'm going to copy this line of code and then I need to run it somewhere I need to run it from this workspace from this folder the easiest way to do it is to to create a new terminal right from this spot over here so you need to have a separate window open here we have terminal I can just paste it over here so we're going to create a new virtual environment here I have this folder that was created which is super neat then we need to activate this environment so I'm on Mac I'm going to run this command over here and just like this now we have this virtual environment running copy paste copy paste pretty simple then we need to install all of the requirements for the scope to run let's run this action over here Bingo that's it simple right and finally we need to run this last line of code this is going to open up this bot folder and it's going to run everything that's inside main.python file this has everything that we need for the chatbot to run but before I do that I realize that I haven't configured my environment I haven't added my open AI API token I have a linked a bot so before running this action let's go and do exactly the environment setup so let me open up the file over here and there are four items that we need to get set up first we'll need to set up the openai API key it's like the password to your openai account and open AI is not exactly free but it is extremely cheap but you still need to somehow link the two together in order for us to do this let's open up our browser go to platform.openai.com over here and here in the upper right corner we're going to click on view API Keys then we can create a new secret key and call it telegram chatbot and that's how easy it is to create an API key make sure to keep it private because it's an equivalent of your password I'm going to paste it over here and now we have the openai API key so how expensive is openai and this chatbot going to be for us well honestly it's extremely cheap I'm going to click on usage over here to show you my usage I've used jgpt extensively in their recent days there is a really cool video that I recorded about how to use Chad GPT inside Google Sheets and click right here to check it out extremely useful but there I ran GI GPT a few thousand times and for a few thousand requests I got billed 13 cents for that specific day another really handy practice if you're worried about budgets or anything of that nature you can click on billing and then click on usage limits and then create hard and soft limits we're back in our environment file and next up we need to get a telegram bot token in order for us to get it we need to go to telegram over here and then you will need to message Bob father so message at bot father and then if you click on the menu over here you can pick new bot and a new bot will be created the first thing is to give it a name I'll call it Renato awesome GPT and then it has to end with bot at the end okay and just like this there we have the access token this is the information that we're looking for I'm going to copy it and paste it over here after the equal sign there are a couple more variables over here such as the admin users you can make yourself an admin if you want to it doesn't really matter but I think admin is very valuable if you want to add this chatbot to pre-existing telegram groups so you can interact with your chatbot in different places for me I'm just going to leave it blank or according to the instructions have this Dash over there and then the users that are allowed to interact with the chatbot I'll say anybody can interact with my chatbot again I'm going to just follow the instructions and have this star sign after the equal sign okay just like this uh there we have it here's a quick and a very important thing that you need to know in order to actually run this code is the fact that this is the dot env.example file and then if you click on get ignore git ignore means that this file is not going to be sent into the cloud because you do not want other people to see your private passwords obviously so in git ignore you have this dot EnV file it's right there so instead of having dot EnV example we're going to rename the file and have it as dot EnV just like this so now this file is linked up to the code properly drumroll here comes the last part running the code it's time so all we need to do is copy this line of code again it's going to launch everything that's in that main.pi file then we're going to paste it in our terminal and hit return boom application started so what do you do from here well go to Telegram and then you message your chatbot here is my chatbot not awesome chatbot I'm going to click on start and I'm Chad GPT bot talk to me just like this sup [Music] hello how can I assist you the favorite part is using this microphone hey what's up Chad GPT what can you help me with today what are your capabilities this was a voice note this voice note is going to get transcribed and we're going to get a nicely formulated response check this out this is exactly what I said and here it says hey I'm an AI model so that's it this is this is how it works you can generate images let's click on menu and do image I guess we'll need to do image and then say pink cat in Nikes and that's the image generated by open ai's Dali what else can you do well let's click on menu and see the options that we have available click on stats and see all of the requests that we had one image was generated 350 tokens used total amount of 2 cents our chai GPT power telegram bot is up and running but it's only going to run as long as you have your computer turned on I'm going to demonstrate this by just closing our terminal session over here and say hey there like this and okay it's not working so we need to deploy this code into the cloud so it runs in the cloud let me show you how to do exactly this so now let's go ahead and deploy this code into the cloud so that our chatbot runs all the time in order to make all of this possible we're going to be using railway.app it's entire free and it's super easy to install just make an account click on new project over here and because you Fork the library you can click on deploy from GitHub right here and select your chatgpt telegram bot this is a very important part here we need to add variables the stuff that you edited previously is not going to be visible to this app because number one this file was ignored the environment file with all of your passwords and number two we didn't send any files from your local machine into the cloud anyways so we'll need to copy paste some of the variables manually so here in the variables part we can copy paste the information I guess from our Visual Studio code right here let's open it back up let's open up our environment file and this is the information that we ideally want to copy over here to the variables instead of doing one by one you can just do raw editor and let's just select everything that we have here these guys are commented out meaning that they do not really matter so I'm actually going to copy this first four variables and paste them here in environment click on update environment and just like this you have all of the files from the original template that I showed you there is absolutely nothing that was changed but there's files that we configured previously with the environment all of the variables all of your passwords are over here so now they're running really nicely so if you click on deployments you have this session initializing let's click on this guy over here initializing and then you have build logs this is going to be very similar to the terminal so that you can see what's actually happening in the background uh very similar to what we did locally on our computers all of the prerequisites such as python all of the libraries open AI telegram Bots python libraries getting installed but in the cloud this time so it's going to be running in the cloud and when we scroll down we'll see everything that's happening and just like this you have your deployment logs here it says application started similar to what you saw in the terminal before there's some sort of an error message I'm not exactly sure what this means but let me go ahead and open up our telegram bot and there it is you remember I sent this hey there message and nothing happened well now this request was cut I'm going to say something else you alive okay and now it's working in the cloud to demonstrate this I can exit out of the code editor I can close GitHub like it does anything really but here you have all of the requests but this time this is running in the cloud so all of my messages when I send something is going to be visible over here inside Railway app let's do a voice message what date is today obviously it doesn't have real-time data good for us but the request is visible over here just like this the app is running in the cloud everything is done and we are good to go with our second method of creating a chat GPT powered telegram path if you want to take your game a step further I do recommend you to check out this other repository over here with the code that allows you to do a couple more things and there are a few really cool upgrades in this version there is a gpt4 support code highlights there are specialist modes where you can say hey you're my code assistant and there is a pre-built prompt that was sent to chatgpt so it has all of the contacts so you can text with say Elon Musk or psychologist an artist that can generate images for you or in this case a code assistant which is super handy you can give it a try as well but remember that this installation is going to be slightly more technical especially when you're trying to roll it out in the cloud you can find all of the links and resources that I showed you in this video down in the description you can install per diem you can try out the pre-built automations with chatgpt you can find these two repositories that are open source for you to try out the railway app and other super useful things generative AI is a massive Game Changer but my favorite part for productivity is using chat GPT inside Google Sheets I've recently created a video about exactly that use case it blew my mind and I'm a massive user so make sure to check it out right there to save a lot of time and to unlock new possible like
Info
Channel: Bardeen
Views: 18,154
Rating: undefined out of 5
Keywords: telegram chatgpt, chatgpt telegram bot, telegram bot, chatgpt telegram, chatgpt, how to create telegram bot, chat gpt telegram bot, telegram bot chatgpt, how to create telegram bot for business, chatgpt tutorial, telegram bot tutorial, how to build telegram bot, telegram bot with python, no code, bardeen, how to create telegram bot using python, Bardeen, no code telegram, openai, gpt-4, gpt 4 telegram
Id: vnKFUIB4WJw
Channel Id: undefined
Length: 21min 24sec (1284 seconds)
Published: Tue Jul 11 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.