Skip to content

RoozbehSh/telegram-gpt

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Telegram ChatGPT bot

Deploy this function on flows.network, and you will get a Telegram bot that uses ChatGPT to respond to every question in your Telegram DM or channel/group automatically.

image

The example in the above image is to leverage ChatGPT to generate code comments.

Prerequisite

  • You will need an OpenAI API key. If you do not already have one, # here.

  • You also need a Telegram token to access the HTTP API. If you don't already have one, go to Telegram to get a telegram bot token from @bothfather.

Deploy a ChatGPT Telegram bot

To install the ChatGPT Telegram App, we will use flows.network, a serverless platform that makes deploying your own app quick and easy in just three steps.

Prepare the code: fork this repo

Fork this repo and go to flows.network to deploy your function.

Deploy the code on flow.network

  1. # for an account for deploying flows on flows.network. It's free.

  2. Click on the "Create a Flow" button to start deploying the ChatGPT GitHub APP

  3. Authenticate the flows.network to access the telegram-gpt repo you just forked. image

  4. Click the Advanced test to see more settings. Here we need to use Environment Variables to pass the Telegram token and OpenAI API key name.

  • telegram_token: Fill in the token you received from Fatherbot.
  • openai_key_name: Fill in the name you want to name your OpenAI key.

image

  1. At last, click the Deploy button to deploy your function.

Configure SaaS integrations

After that, the flows.network will direct you to configure the SaaS integration required by your flow. Since we have configured Telegram in the above step, OpenAI is the only SaaS we need to configure here.

image

Click the "Connect/+ Add new authentication" button to authenticate your OpenAI account. You'll be redirected to a new page where you can copy and paste your OpenAI API key and then name the key. Note that the name you enter here should be the same as the name in the environment variables.

image

Give it a try.

Click the Check button to see your flow details. As soon as the flow function's status becomes ready and the flow's status becomes running, the Telegram ChatGPT App goes live. Go ahead and chat with ChatGPT by sending a message on your Telegram! You can also invite this bot to your channel/group.

flows.network is still in its early stages. We would love to hear your feedback!

Others

If you want to build locally, make sure you have installed Rust and added wasm32-wasi traget.

cargo build --target wasm32-wasi --release

About

A Telegram ChatGPT bot written in Rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%