How to create things from a list

Hello Bubble community,

I hope you can save my life on this :
I am calling the new ChatGPT API to try to write articles and some other things in my app. The problem is that when I ask an outline to the AI and get it, I can’t find a way to create H2s and H3s from the text I’m getting.

For example, with this response :
<h2>My first H2</h2>
<h3>My first H3</h3>
<h2>My second H2</h2>
<h3>My second H3</h3>

I would want to create 4 things in my DB. I managed to create a list from it with regex so that my “Article” object now have a list called “Structure” in it with a line per item.

I downloaded the Toolbox plugin to run JS but I’m not sure how to create a thing inside the Toolbox JS.

Also, I am on the free version of Bubble, so no Bubble API for me and no recursive workflow…

Here is a screenshot where I am currently, but I might have taken the wrong way :man_shrugging:

Thanks for your help !

I realize that you specifically said you’re on the free version of Bubble, but the only way I know how to do this is by using a backend workflow and calling “schedule an api workflow on a list.”

Since there is a built-in (and easy) way for this to be done in Bubble, I would be surprised if there are any good plugins or workarounds to re-solve the same problem. I think you will have to pay to do what you describe.

Though I’m a little confused: from your description it sounds like you don’t have separate data type for Structure? Can you just add a field to Article that contains a list of text, and then you can just save the list of text to that field in the Article? This won’t work well if you ever need to do a search for a structure-line but I don’t know if you need that or not.

Good luck.

Hello Steve, thank you for your help.

To clear out how it works : an “Article” is an object having "H2"s objects among other things. My "H2"s are objects having a “Title”, "H3"s and other things. And my "H3"s have a “Title” and a “Text”.

I added a “Structure” list of text to my “Article” thing to try to do what I want, by splitting the text with a regex.