Hey there!
I want to share how we use OpenAI assistants in our Bubble app to update an entry in our database by using Buildship!
Workflow Overview
I will cover the following topics:
- Setup an AI assistant in Buildship
- API Call node used by AI assistant
- Using json_schema for the body of API Call
- Triggering Buildship Workflow from Bubble
You can try the demo here LINK
Setup an AI assistant in Buildship
Buildship is a no-code backend tool that allows us to create open AI assistants. You can duplicate a copy of this workflow with the following link:
You must add your open AI API key for this workflow & your Assistant ID to work. You can do it by clicking the input field.
- You can get your API key here: https://platform.openai.com/api-keys
- You can get your Assistant ID here: https://platform.openai.com/assistants
You can add your API key as a secret and the assistant ID as an environmental variable.
After that, change the Assistant instructions and mention to use your API call. You should also rename your API call to your usecase.
Reference your API call by passing the full name of it inside your assistant instructions.
API Call node used by AI assistant
The URL of this API is an endpoint I have set up on the backend workflows in my Bubble app.
This workflow searches in my database the ID of the replaced Pokemon and then modifies it with the response of the AI assistant
Buildship API Call node and Bubble Backend Workflow
Using json_schema for the body of API Call
In the node “API Call - Replace Pokemon”, the body value is filled by the Ai assistant indicated by the blue sparks icon.
We want the Assistant to always send the JSON schema we need inside the body, for that we will add a json_schema in our assistant. Mine looks like this:
Triggering Buildship Workflow
The last thing to do is now to make an API call to our Buildship endpoint from our application!
With the same principle, we can also give our Ai assistant access to any datatype of our Bubble app in case the response depends on some records.
Create a /get backend workflow your Bubble app and add a new node in buildship to trigger it!
I’ll be doing more of these guides, so feel free to explain in the comments what else you would like to know
I hope you found this guide useful and I’m available for work if you need further assistance