{"id":20417310,"url":"https://github.com/spidy20/telegram_chatgpt_bot","last_synced_at":"2025-10-30T09:35:55.226Z","repository":{"id":177783891,"uuid":"646159454","full_name":"Spidy20/Telegram_Chatgpt_Bot","owner":"Spidy20","description":"- Implementation of Telegram ChatGPT Bot using Python, Flask, Ngrok. ","archived":false,"fork":false,"pushed_at":"2023-05-27T13:33:45.000Z","size":1057,"stargazers_count":6,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-15T06:29:53.344Z","etag":null,"topics":["chatgpt-bot","flask","telegram-api","telegram-bot","telegram-bot-api"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Spidy20.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-27T13:29:49.000Z","updated_at":"2024-03-03T13:39:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"f7447d1e-9932-4dce-8b70-3af83d849262","html_url":"https://github.com/Spidy20/Telegram_Chatgpt_Bot","commit_stats":null,"previous_names":["spidy20/telegram_chatgpt_bot"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Spidy20%2FTelegram_Chatgpt_Bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Spidy20%2FTelegram_Chatgpt_Bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Spidy20%2FTelegram_Chatgpt_Bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Spidy20%2FTelegram_Chatgpt_Bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Spidy20","download_url":"https://codeload.github.com/Spidy20/Telegram_Chatgpt_Bot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234045723,"owners_count":18770994,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chatgpt-bot","flask","telegram-api","telegram-bot","telegram-bot-api"],"created_at":"2024-11-15T06:25:51.701Z","updated_at":"2025-09-24T05:32:08.613Z","avatar_url":"https://github.com/Spidy20.png","language":"Python","funding_links":["https://www.buymeacoffee.com/spidy20","https://www.paypal.me/spidy1820"],"categories":[],"sub_categories":[],"readme":"# Create Telegram Chatbot💬 using ChatGPT, Flask, and EC2\n\n[![forthebadge made-with-python](http://ForTheBadge.com/images/badges/made-with-python.svg)](https://www.python.org/)\n[![Python 3.8](https://img.shields.io/badge/python-3.8-blue.svg)](https://www.python.org/downloads/release/python-360/)\n\n## [Watch the Tutorial for this Project](https://youtu.be/Fej2wb4YHes)\n\n![YouTube Thumbnail](https://github.com/Spidy20/Telegram_Chatgpt_Bot/blob/master/yt_thumb.jpg)\n\n## Overview\n\nThis project demonstrates how to create a Telegram chatbot using ChatGPT, Flask, and EC2. The following technologies and services are used:\n\n- Ngrok and Flask as a server.\n- Telegram BOT Token obtained from \"BotFather\".\n- ChatGPT API for generating responses.\n- Flask App as an API for the Request/Response model.\n- AWS EC2 for deployment (24/7 running).\n\n## Steps\n\n1. Create free accounts on [OpenAI](https://platform.openai.com/account/api-keys), [AWS](https://console.aws.amazon.com/), and [Ngrok](https://dashboard.ngrok.com/).\n2. Create a Flask App.\n3. Create an EC2 instance on AWS.\n4. Git clone this repository on the EC2 instance.\n5. Create a Telegram bot using \"BotFather\" and obtain the API Token.\n6. Use the `TELEGRAM_BOT_TOKEN` and `OPENAI_API_KEY` in your code (avoid using static values, use global variables).\n7. Run the script on the EC2 instance.\n8. Open a second terminal and use Ngrok to create a tunnel on port `5000`.\n9. Set up a webhook for Telegram verification.\n\n## Usage\n\nTo use this project:\n\n1. Clone the repository.\n2. Open a terminal in the working directory.\n3. Run the following command to install the required dependencies:\n\n    ```\n    pip install -r requirements.txt\n    ```\n\n4. `telegram_bot.py` is the Flask API that handles the request/response of the chatbot.\n5. Run the script with the following command:\n\n    ```\n    python3 telegram_bot.py\n    ```\n\n6. To set up the webhook, use the following format:\n\n    ```\n    https://api.telegram.org/bot\u003cYour Bot Token\u003e/setWebhook?url=\u003cURL of App\u003e\n    ```\n\nFor a more detailed explanation of this project, refer to the tutorial on the Machine Learning Hub YouTube channel.\n\n## Screenshots\n\n\u003cimg src=\"https://github.com/Spidy20/Telegram_Chatgpt_Bot/blob/master/bot_sc.jpg\" width=\"270\" height=\"500\"\u003e\n\n## Support\n\nIf you find this project helpful, consider supporting me:\n\n- [Buy me a Coffee☕](https://www.buymeacoffee.com/spidy20)\n- [Donate via PayPal](https://www.paypal.me/spidy1820) (It will inspire me to work on more projects)\n\nFeel free to follow me and star⭐ this repository!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspidy20%2Ftelegram_chatgpt_bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspidy20%2Ftelegram_chatgpt_bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspidy20%2Ftelegram_chatgpt_bot/lists"}