Trying to grab last message from a thread for a chatbot

Hi everyone! It’s my first day working with OpenAI to please bear with me if I seem slow here.

I’m trying to build a chatbot using an assistant and need to grab the last message in a thread to shoot back to use through that bot.

Right now the flow looks something like this:

  1. POST create thread and run (grabbing thread ID and run ID)
  2. GET List run steps (grab last step ID)
  3. GET Retrieve Run Step (grab message ID)
  4. GET Retrieve message (using message ID above)

This works but seems a little excessive and operationally heavy. Is there a streamlined way of doing this that I’m just not seeing?

Thank you in advance!