Skip to content
/ maya Public

Personal Telegram bot for accessing ChatGPT via messages

License

Notifications You must be signed in to change notification settings

kendhia/maya

Repository files navigation

Maya 🐈

This a personal Telegram bot I created for easy (and cheap) access to ChatGPT. It is using gpt-3.5-turbo-0301, but you can choose whatever modal you want in src/index.ts.

In order to use this project you have to:

  1. Signup to openai.com/.
  2. create a Telegram bot. See official documentation, and simple serverless lambda example.
  3. create an AWS account.

How to run it?

  1. run yarn
  2. run cp .env.example .env
  3. Paste your openai key to OPENAI_API_KEY=. You can find your token here.
  4. Paste your Telegram token you got when you created the bot via BotFather to TELEGRAM_BOT_TOKEN=
  5. Add your AWS Profile to the AWS_PROFILE=<profile-name>, or just login to your aws account via aws sso.
  6. run yarn serverless
  7. After previous command ends successfully, you should be able to see the url for your deployed lambda.

Use the Lambda's URL and Bot token in following command to set up your bot's webhook:

curl --request POST --url https://api.telegram.org/bot<TELEGRAM_BOT_TOKEN>>/setWebhook --header 'content-type: application/json' --data '{"url": "<URL_OF_LAMBDA>"}'

🎉 you have access to ChatGPT via your personal Telegram bot now 🎉

TODOs

  1. add config command for providing an OPENAI_API_TOKEN
  2. add config command for changing the used modal
  3. add config command for changing role of model.

About

Personal Telegram bot for accessing ChatGPT via messages

Resources

License

Stars

Watchers

Forks