# Connecting Open AI Assistants API with your Bubble application

**URL:** <https://forum.bubble.io/t/connecting-open-ai-assistants-api-with-your-bubble-application/293056>\
**Category:** Showcase\
**Created:** [November 14, 2023, 7:20am UTC](https://forum.bubble.io/t/connecting-open-ai-assistants-api-with-your-bubble-application/293056 "2023-11-14T07:20:01Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![ZubairLK](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/zubairlk/32/53301_2.png) [@ZubairLK](https://forum.bubble.io/u/ZubairLK)\
**Post date:** [November 14, 2023, 7:20am UTC](https://forum.bubble.io/t/connecting-open-ai-assistants-api-with-your-bubble-application/293056/1 "2023-11-14T07:20:01Z")

</div>

Customized GPTs are great, but there isn’t much flexibility on how you can design and interact with them via ChatGPT.

Thankfully, the Assistants API is here to just solve that. It’s highly customizable. You can build your own chatbots and use them however you want within your Bubble application.

I am making a series of tutorials to help you navigate your way through setting up the _OpenAI Assistants API_.

**There are three parts to the process**

1. **Creating an Assitant (GPT)**- This can be done on the Open AI playground or via the API

2. **Interaction with the GPT** - Threads, messaging, and running the Assistant

3. **Front end in Bubble** - Displaying the interaction in your Bubble app

The first video in the series focuses on the Interaction part. How to setup the API calls in Bubble to send and receive messages.

I’ve kept it very sharp and to the point.

Check it out.

[![](https://img.youtube.com/vi/6oWuFSr2eTs/maxresdefault.jpg "Open AI Assistant API Tutorial (Bubble)") ](https://www.youtube.com/watch?v=6oWuFSr2eTs)

Stay tuned as I’ll be covering the other two topics very soon.

Comment below if you’d like more information.

If you like this video, please show some ❤

Thanks  
[Zubair](https://www.linkedin.com/in/zubairlk/)

> **[AZKY Tech Labs: Launch your new product in weeks!](https://www.azkytech.com)**
>
> We use NoCode to build products faster and help you get to product market fit quicker!

---

<div class="post-metadata">

**Author:** ![ZubairLK](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/zubairlk/32/53301_2.png) [@ZubairLK](https://forum.bubble.io/u/ZubairLK)\
**Post date:** [November 16, 2023, 5:59am UTC](https://forum.bubble.io/t/connecting-open-ai-assistants-api-with-your-bubble-application/293056/2 "2023-11-16T05:59:23Z")

</div>

Here’s part two of the series.

Setting up Bubble frontend workflows

Check it out!

[![](https://img.youtube.com/vi/BrGQNQvMPFY/maxresdefault.jpg "Open AI Assistants API tutorial part two (Bubble) I Front end workflows") ](https://www.youtube.com/watch?v=BrGQNQvMPFY)

What would you like to see next?

Thanks  
[Zubair](https://www.linkedin.com/in/zubairlk/)

---

<div class="post-metadata">

**Author:** ![bennymac1](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/bennymac1/32/130316_2.png) [@bennymac1](https://forum.bubble.io/u/bennymac1)\
**Post date:** [January 3, 2024, 5:20pm UTC](https://forum.bubble.io/t/connecting-open-ai-assistants-api-with-your-bubble-application/293056/4 "2024-01-03T17:20:52Z")

</div>

Hi Zubair, thanks for creating these videos. Would you be open to sharing your editor or providing screenshots of the workflow & api calls? I had initially set up the calls and workflow a slightly different way, but was unable to get the RG to refresh, even after a user submitted a message, prior to the assistant returning a response. If I manually refreshed the page, then the RG content was correct, and included the user’s message and the assistant’s response. I tried setting things up the same way you did, and am still running into the same problem with the RG refresh not happening, my ‘get run’ api call doesn’t seem to show a single run ID (it returns a list), and my notifications aren’t working as part of the ‘do every second’ workflow.  
Thanks!  
-ben

---

<div class="post-metadata">

**Author:** ![bennymac1](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/bennymac1/32/130316_2.png) [@bennymac1](https://forum.bubble.io/u/bennymac1)\
**Post date:** [January 4, 2024, 3:25pm UTC](https://forum.bubble.io/t/connecting-open-ai-assistants-api-with-your-bubble-application/293056/5 "2024-01-04T15:25:52Z")

</div>

Scratch that, I actually got it sorted last night. 👌  
It’s actually surprising how quickly the responses come back using gpt3.5 turbo. i’d say the speed is good in one sense (users aren’t left hanging, wondering if the chat has hung) but the speed is almost too much and feels unnatural. I’ll likely add a pause and a lottie animation to make it look like the assistant is typing, then let the response come through. thanks again for this videos, much appreciated! 🙏

---

<div class="post-metadata">

**Author:** ![ZubairLK](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/zubairlk/32/53301_2.png) [@ZubairLK](https://forum.bubble.io/u/ZubairLK)\
**Post date:** [January 5, 2024, 5:28am UTC](https://forum.bubble.io/t/connecting-open-ai-assistants-api-with-your-bubble-application/293056/6 "2024-01-05T05:28:30Z")

</div>

glad you could make it work.

For other people, I’ve made the app public read-able

> **[Bubble Editor - azky-openai](https://bubble.io/page?name=index&id=azky-openai&tab=tabs-6&subtab=General)**
>
> Build stuff without code and launch a startup without a tech-cofounder! Bubble is a visual programing language. Instead of typing code, use a visual editor to build applications.

However, I had to revoke the API key so the app wont work.

But the editor view is visible. Not sure how useful that would be.

In an ideal world, there should be a way to show the editor of the app but without the API keys… But even then. OpenAI is expensive and bill can start adding up.

Thanks  
Zubair

> **[Idea to App in Just 8 Weeks | Done For You](https://www.azkytech.com/)**
>
> Confused about how to start your app or tech business? Don't worry! Our "8 Week Idea to App Program" is a tried-and-tested framework that will turn your concept into a successful software business. We've worked with over 50 founders and we have...

---

<div class="post-metadata">

**Author:** ![bennymac1](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/bennymac1/32/130316_2.png) [@bennymac1](https://forum.bubble.io/u/bennymac1)\
**Post date:** [January 5, 2024, 3:07pm UTC](https://forum.bubble.io/t/connecting-open-ai-assistants-api-with-your-bubble-application/293056/7 "2024-01-05T15:07:16Z")

</div>

thanks! definitely still helpful even without the API key. i think one of the things that I got tripped up on was the ‘list messages’ call. i initially had it as a data call rather than an action (and then used that as the data source for the RG), but that’s likely more due to my inexperience with API calls. thanks again for sharing!

---

<div class="post-metadata">

**Author:** ![comete99](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/comete99/32/208883_2.png) [@comete99](https://forum.bubble.io/u/comete99)\
**Post date:** [March 15, 2024, 4:12pm UTC](https://forum.bubble.io/t/connecting-open-ai-assistants-api-with-your-bubble-application/293056/10 "2024-03-15T16:12:14Z")

</div>

Hello,  
Thank you for your advice.  
I followed your instructions in the first video, and I don’t understand the steps in the second.  
My problem is the following, after following your first tutorial, I am unable to generate an answer to a question related to my API assistant.  
It shows me the descriptive text of my wizard, instead of providing me with an answer.  
What am I missing? How do I edit my action button so that it works?  
Thanks a lot!

---

<div class="post-metadata">

**Author:** ![artemskopych666](https://avatars.discourse-cdn.com/v4/letter/a/f04885/32.png) [@artemskopych666](https://forum.bubble.io/u/artemskopych666)\
**Post date:** [March 21, 2024, 2:04pm UTC](https://forum.bubble.io/t/connecting-open-ai-assistants-api-with-your-bubble-application/293056/11 "2024-03-21T14:04:36Z")

</div>

Hi, I have the same problem. Please tell me if you managed to solve it. I ran several tests and realized that in :each item’s content :each item’s text value mode it displays according to the following algorithm if you make 2 queries  
Query 1  
system text \<request text 1  
Request 2  
system text \<request text 1\> \<response to request 1\> \<request text 2

---

<div class="post-metadata">

**Author:** ![NickT](https://avatars.discourse-cdn.com/v4/letter/n/ce7236/32.png) [@NickT](https://forum.bubble.io/u/NickT)\
**Post date:** [March 21, 2024, 8:23pm UTC](https://forum.bubble.io/t/connecting-open-ai-assistants-api-with-your-bubble-application/293056/12 "2024-03-21T20:23:34Z")

</div>

Thanks for the great tutorials!

I see they just introduced streaming to assistants within the last month or so. Any idea if they’ve also enhanced it, so we no longer need to keep polling?

---

<div class="post-metadata">

**Author:** ![ZubairLK](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/zubairlk/32/53301_2.png) [@ZubairLK](https://forum.bubble.io/u/ZubairLK)\
**Post date:** [March 22, 2024, 5:09am UTC](https://forum.bubble.io/t/connecting-open-ai-assistants-api-with-your-bubble-application/293056/13 "2024-03-22T05:09:59Z")

</div>

Just noticed streaming has been released.

Great news.

However, I suspect this is trending in the custom plugin/code territory

My main worry is how bubble can keep the API key secure while supporting streaming.

From a glance at other forum topics, that may still be a challenge and this will need an intermediate server…

> [@OpenAI GPT Streaming Functionality](https://forum.bubble.io/t/openai-gpt-streaming-functionality/250645/24):
>
> Bubble does not support streaming, both api connector and server side plugin action don’t support it. So you will always need a third party server.

Don’t think I can make a ‘quick’ tutorial or simply suggest something for streaming.

I’m sure custom plugins will appear soon. However, please keep the key aspect in mind.

Thanks  
Zubair

---

<div class="post-metadata">

**Author:** ![NickT](https://avatars.discourse-cdn.com/v4/letter/n/ce7236/32.png) [@NickT](https://forum.bubble.io/u/NickT)\
**Post date:** [March 24, 2024, 3:38pm UTC](https://forum.bubble.io/t/connecting-open-ai-assistants-api-with-your-bubble-application/293056/15 "2024-03-24T15:38:50Z")

</div>

Thanks! Streaming is a nice UX, but was thinking more in terms of whether with this update, if we can do away with the constant polling, which is continuously checking for a response. So basically still use the original method Zubair demonstrated, but without the polling. Then we get the efficiency of not having to send large snowballing payloads to OpenAI and also do away with the wasted WU it takes to keep polling open AI.

---

<div class="post-metadata">

**Author:** ![redvivi](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/redvivi/32/59955_2.png) [@redvivi](https://forum.bubble.io/u/redvivi)\
**Post date:** [March 26, 2024, 9:57pm UTC](https://forum.bubble.io/t/connecting-open-ai-assistants-api-with-your-bubble-application/293056/16 "2024-03-26T21:57:01Z")

</div>

I have built this to provide a solution, keeping your keys secure.

> **[Open AI - Assistants with Streaming Plugin for Bubble, by wise:able](https://bubble.io/plugin/open-ai---assistants-with-streaming-1711101215133x177753180018311170)**
>
> Open AI - Assistants with Streaming Plugin page on Bubble, by wise:able. Add Open AI - Assistants with Streaming in one click to your app. Bubble lets you build web apps without any code.

---

<div class="post-metadata">

**Author:** ![jonbernardy](https://avatars.discourse-cdn.com/v4/letter/j/b9e5f3/32.png) [@jonbernardy](https://forum.bubble.io/u/jonbernardy)\
**Post date:** [April 11, 2024, 4:02am UTC](https://forum.bubble.io/t/connecting-open-ai-assistants-api-with-your-bubble-application/293056/17 "2024-04-11T04:02:49Z")

</div>

Excited to see what you and others can/will do with the additional streaming functionality, Z!  
-jpb

---

<div class="post-metadata">

**Author:** ![guile.brazil](https://avatars.discourse-cdn.com/v4/letter/g/c37758/32.png) [@guile.brazil](https://forum.bubble.io/u/guile.brazil)\
**Post date:** [June 3, 2024, 3:20am UTC](https://forum.bubble.io/t/connecting-open-ai-assistants-api-with-your-bubble-application/293056/18 "2024-06-03T03:20:52Z")

</div>

Meu amigo, que Deus abençoe imensamente a sua vida!  
Pessoas como voce merecem todo o sucesso do mundo, desejo prosperidade em sua trajetória.  
Muito obrigado!!!

---

<div class="post-metadata">

**Author:** ![aditya8080993750](https://avatars.discourse-cdn.com/v4/letter/a/9f8e36/32.png) [@aditya8080993750](https://forum.bubble.io/u/aditya8080993750)\
**Post date:** [July 8, 2024, 1:48pm UTC](https://forum.bubble.io/t/connecting-open-ai-assistants-api-with-your-bubble-application/293056/19 "2024-07-08T13:48:25Z")

</div>

If anyone is still looking for a solution to this, I’ve built a much simpler way to build a full-fledged chatbot with the OpenAI Assistant that can be published to websites, here’s a video on it:

[![](https://img.youtube.com/vi/nn_6X43kTsc/maxresdefault.jpg "How to share your OpenAI Assistant?? (and monetize it)") ](https://www.youtube.com/watch?v=nn_6X43kTsc)

---

<div class="post-metadata">

**Author:** ![ZubairLK](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/zubairlk/32/53301_2.png) [@ZubairLK](https://forum.bubble.io/u/ZubairLK)\
**Post date:** [July 11, 2024, 1:39pm UTC](https://forum.bubble.io/t/connecting-open-ai-assistants-api-with-your-bubble-application/293056/20 "2024-07-11T13:39:50Z")

</div>

I’ve taken another stab at it to simplify everything and break things down step-by-step.

Here’s what’s included

- Setting Up (API Connector Plugin, Open AI playground)
- Creating the Assistant in Playground
- Understanding Threads and Messages
- Running and Managing API Calls in Bubble
- Securing Your API and **Preventing Prompt Leaks**
- Front End and Backend on Bubble
- **Streaming** for Long Responses

Check it out here:

[![](https://img.youtube.com/vi/cWKaYtf5BVg/maxresdefault.jpg "Open AI Assistants API using Bubble | Complete Step by Step Tutorial") ](https://www.youtube.com/watch?v=cWKaYtf5BVg)
