Struggling with “Thread” logic for OpenAI Assistant in Telegram bot

Hey community!

Maybe it’s a silly question, but how to implement chatting with Assistant via Telegram in the same thread for one user?

I do know how to set Thread ID in Assistant module. My question is how to build TG bot that allows user to chat in one specific Thread that being set at the beginning of every new conversation.

What I could do now:

  • If Thread ID not set up, then every new message starts a new Thread. That’s not a case I am looking for.

  • If Thread ID hardwired (set with providing fixed Thread ID), then all conversation for all users goes at the same Thread. That’s not what I am looking for too.

So is it possible to build a logic, that allows me to do the following:

  • User starts conversation with TG bot and all his conversation goes in particular Thread, that being set up on the first message?

  • In other words how could I get initial message from the user, get the new Thread ID and only after that continue conversation in the particular Thread that been previously created?

Thanks in advance!

Welcome to the Make community!

I think I’ve answered this before, do take a look at some of my previous posts:

samliewrequest private consultation

Join the unofficial Make Discord server to chat with other makers!

3 Likes

We update the makemarket open ai modules to support GPT-4o and functions. give it a look. This will help simplify your flows.

Check this post for more details: Open AI Assistant Module with GPT-4o and functions