ChatGPT Telegram Bot

OpenAI just released its API for ChatGPT.

So naturally, I fired up n8n and made a ChatGPT telegram bot


I saw we are having the turbo model but it gives out an error at the moment.


I did it with a HTTP node. I assume the OpenAI node hasn’t been updated yet for the new API endpoint.

Best look at the API docs and import the curl example


Version 2.18.0 was just released today with a new chat option!


we need the Whisper API to be added too

1 Like

Hey @RedPacketSec,

Pop open a feature request and we can add it to the list :smiley: It looks like an interesting option to add though.

I updated my flow to now also take audio speech and sent it to Whisper API , this then transcribes it into text, sends it to ChatGPT, Chat GPT sends it to Eleven Labs (that can clone voices) to read the text in a natural voice and then sends it back to the telegram channel, so now you can have an audio conversatioon with chatGPT in near real time (takes about 10 seconds per reply) as n8n cant convert audio files at all with any nodes, so i have to SSH it around and pull it back in again.

Works pretty well anyway


Hey Redpacket,

Is it possible I could see how you achieved this please? I have only had n8n a week or so but its already taking over my life especially with my love for AI :grinning:

Yeah of course when I’m back at PC will show you my flow.

1 Like

I have 3 different Chat Groups, all using the same Telegram Bot, the IF checks for the telegram channel ID/Group name and filters the requests.

The bottom flow checks for a voice message/audio file and then replied with a voice reply.


Love it, Thank you, will try my best this evening to get one working :grinning:

1 Like

i also had to (in the chat GPT node / HTTP Node ) filter out / escape special characters like " etc otherwise it caused issues.

1 Like

for the different chat groups you can set the style as i like to call it for the middle flow, i initially set it to be in the style of a drunk pirate and the kids would send it messages, so you can engineer the initial prompt before someone sends a message to it, if that makes sense.

I got most things working, Only thing I am struggling with is the audio converting, installed FFmpeg but can’t work it out, also tried api2convert but again can’t get it to work correctly either.

This is the command i use:

ffmpeg -i {{ $node["Telegram"] }} {{ $node["Telegram"]'.oga','.mp3') }}

for the middle execute SSH node


So I upload the file to another host on my network, with ffmpeg installed , send cmd line to execute and then download the output file and delete files when flow is finished.


Thank you, will give it a go later on :crossed_fingers:

1 Like

Its been painful uninstalling and reinstalling hundreds of FFmpeg installations but we got there :grinning:

Just the Whisper HTTP request now.

All working perfectly, Thanks for the advice @RedPacketSec

1 Like

glad i could help :slight_smile:

1 Like

@RedPacketSec do you mind sharing the code for these 3 nodes?

Want to implement telegram voice transcription with whisper but can’t figure out how to store the audio file through ssh and then upload to whisper