OpenAI beta assistants

Hi, How would I connect the responses from my own api, back into the chatbot list items or table, so it will show on the chatbot screen as a response from the AI api.?

I can get the entered in the chat/text box text to send to the API. Meaning the text I enter into textbox.

I am now using the to get the last entered value in that array? is this the preferred way ??

Note: I am using a js script that i call after entering the search text. the script calls the assistant api, adds a threadid, adds the messages to the thread, and then calls the run.

I have tried
chat1.table.addNotification({message: messageList});

My jsfunction returns the correct response from my assistant, but i cannot get the response connected to the chat messages to show ?