If you want to create your own bot to integrate ChatGPT with Telegram using your OpenAI API key, follow the tutorial below.

Requirements to integrate ChatGPT with Telegram

There are a few ways to integrate ChatGPT with Telegram. For this tutorial, we’ll be using a repository from GitHub to integrate ChatGPT with Telegram.

Here are a few things that you’ll need to have on your computer:

Python (and a few Python packages, which need not be installed separately)

MongoDB

ChatGPT bot in Telegram - Integrate ChatGPT with Telegram

Docker

Using ChatGPT in Telegram - integrate ChatGPT with Telegram

And the following to create a Telegram bot and connect ChatGPT to Telegram:

The ChatGPT Telegram bot GitHub repository

OpenAI API key

Telegram bot token

Steps to integrate ChatGPT with Telegram

Getting started

  • Go to the ChatGPT Telegram bot GitHub repository and download the repository. Click here to clone it. Then unzip the file.
  • Get the OpenAI API key.
  • If you don’t have the secret key saved, you can create a new one by clicking the “+ Create new secret key” button. Keep the key safe and confidential; the key will not be displayed again.

Setting up the ChatGPT and Telegram integration

  • config.example.yml
  • You can also specify the users to whom to make the bot available. Then save and close the file.
  • config.example.ymlconfig.ymlconfig.example.envconfig.env

chat_gpt_telegram_bot-main

docker-compose --env-file config/config.env up --build

  • On running the above command, the required packages will be installed and a Docker container image will be created that hosts the ChatGPT Telegram bot.
  • If all goes right, you’ll be to use ChatGPT from Telegram. Simply message the bot using the bot username you’ve given and chat with it. It will respond as ChatGPT does but in Telegram.
    • You can configure and modify existing chat modes or add different chat modes with your own prompt by editing the chat_modes.yml file in the config folder.
OpenAI API key

If for some reason, you are not able to successfully integrate ChatGPT with Telegram (as there are several ways things may fail to work), you can also try this ChatGPT Telegram bot.

一些推荐文章
Config file - Integrate ChatGPT with Telegram

You can also specify the users to whom to make the bot available. Then save and close the file.

config.example.ymlconfig.ymlconfig.example.envconfig.env
chat_gpt_telegram_bot-main
docker-compose --env-file config/config.env up --build

On running the above command, the required packages will be installed and a Docker container image will be created that hosts the ChatGPT Telegram bot.

If all goes right, you’ll be to use ChatGPT from Telegram. Simply message the bot using the bot username you’ve given and chat with it. It will respond as ChatGPT does but in Telegram.

You can configure and modify existing chat modes or add different chat modes with your own prompt by editing the chat_modes.yml file in the config folder.

If for some reason, you are not able to successfully integrate ChatGPT with Telegram (as there are several ways things may fail to work), you can also try this ChatGPT Telegram bot.

Some recommended articles