Home Applications ChatGPT Telegram Bot

ChatGPT Telegram Bot

This application is not supported by InterSystems Corporation. Please be notified that you use it at your own risk.
0
0 reviews
0
Awards
297
Views
13
IPM installs
2
1
Details
Releases
Reviews
Issues
Pull requests
Articles
Talk to Chat GPT via Telegram!

What's new in this version

Telegram Send Message transformation fix

Gitter
Quality Gate Status
Reliability Rating

telegram-gpt

This is an IRIS Interoperability Production that enables Telegram Bot to talk to ChatGPT

Prerequisits

Create a bot using @BotFather account and get the Bot Token. Then add bot into a telegram chat or channel and give it admin rights.
Learn more at https://core.telegram.org/bots/api

Open (create if you don’t have it) an account on https://platform.openai.com/ and get your Open AI API Key and Organization id.

Make sure you have IPM installed in your InterSystems IRIS. if not here is one liner to install:

USER>    s r=##class(%Net.HttpRequest).%New(),r.Server="pm.community.intersystems.com",r.SSLConfiguration="ISC.FeatureTracker.SSL.Config" d r.Get("/packages/zpm/latest/installer"),$system.OBJ.LoadStream(r.HttpResponse.Data,"c")

Installation

Open IRIS Namespace with Interoperability Enabled.
Open Terminal and call:

USER>zpm "install telegram-gpt -D TgToken=your_telegram_token -D GPTKey=your_ChatGPT_key"

Installation: Docker

Clone/git pull the repo into any local directory

$ git clone https://github.com/evshvarov/openai-telegram-bot

Create .env file in the root directory of the repo with:

TG_BOT_TOKEN=Your_telegrambot_token
OPENAPI_KEY=Your_chatGPT_key

Open the terminal in this directory and run:

$ docker-compose build
  1. Run the IRIS container with your project:
$ docker-compose up -d
  1. Open Terminal and call:
USER>d ##class(shvarov.telegramgpt.Setup).Init($system.Util.GetEnviron("TG_BOT_TOKEN"),$system.Util.GetEnviron("OPENAPI_KEY"))

How to Run the Service

Open the production.

Put your bot’s Telegram Token into Telegram business service and Telegram Business operation both:
Screenshot 2023-06-07 at 4 55 19 PM

Also initialize St.OpenAi.BO.Api.Connect operation with your Chat GPT API key and Organisation id:
Screenshot 2023-06-07 at 4 56 08 PM

Start the production

Ask any question in the telegram chat. You’ll get an answer via Chat GPT.
Enjoy!

Details

This example uses 3.5 version of Chat GPT Open AI. It could be altered in the data-transformation rule for the Model parameter.

Credits

This application uses Telegram-adapter by Nikolay Soloviev and Iris-OpenAI adapter by Kurro Lopez.
Thank you both for making it easy to enable interoperability scenarios for OpenAI and Telegram!

Read more
Made with
Install
zpm install telegram-gpt download archive
Version
1.3.212 Jun, 2023
ObjectScript quality test
Category
Technology Example
Works with
InterSystems IRISInterSystems IRIS for Health
First published
07 Jun, 2023