Telegram chatbot (incomplete)

My goal is to create a continuous telegram chatbot. A bot that can have a conversation with someone for as long as possible or even maybe for like 30 minutes…

Im using the basic scenario shown below:

Everything is setup correctly and works well for a single response.

The problem is when someone messages again, the chatbot basically restarts and sends a messages as if its the first time someone is messaging.

Is it because I’m prompting the chatpgt module wrong?

or do I need to add more modules to continue the chat?

This scenario seems to be a single response and not an actual “chatbot”

Hopefully someone with knowledge of creating chatbots can help me out!

you need to pass the chat history
for example of request body:

“n”: 1,
“model”: “gpt-3.5-turbo-0301”,
“top_p”: 1,
“messages”: [
“role”: “user”,
“content”: “hi my name is dorian”
“role”: “system”,
“content”: “hi dorian”
“role”: “user”,
“content”: “what is my name?”
“logit_bias”: {},
“max_tokens”: 300,
“temperature”: 1,
“response_format”: {
“type”: “text”

you need to use stored procedure and hold the chat history per chat and then pass it through the module… for example:

and here is the documentation for chat completions:
Text generation - OpenAI API


Use the OpenAI Assistants Module

I suggest using the new OpenAI “Message an Assistant” module for this, since it can store “threads”.

1. Fetch Thread ID

2. Use Thread ID if exists

3. Save Thread ID if did not exist yet

For more information, see