A Telegram chat with OpenAI

I am a huge fan of ChatGPT by OpenAI, that being said, I thought how cool it would be if I could simply use Telegram to have a chat with it.

The main reasons for me have been
  • Using an App I use anyway and not needing to login or open a browser
  • Being able to use the voice input of my phone to simply ask the question

I decided to use node-red for the whole flow

  • Telegram receiver and Telegram Sender
  • simple-chatGPT (Japanese version only)

The functions in the middle are simple Javascript which I tend to use to move the JSON objects around.

Simple-chatGPT will only need an API key to be configured, and 2 different inputs

  • msg.payload = The question you want to ask
  • msg.topic = the kind of the ChatGPT usage (I use “completion”)

On reply you simply feed the msg.payload returned by chatGPT into the msg.payload.content of the outgoing Telegram sender