Working with ChatGPT for Server Scripts - Get Started

When working with ChatGPT for things in Bubble, what I have found helpful is to start from the ground and work your way up.

One example is when attempting to use ChatGPT to help with the server script action from the toolbox plugin, I was asking ChatGPT from the beginning to generate a script that would do what I needed…we went around in circles and never get a working script; then I started from the ground.

One way to start from the ground is to just give ChatGPT a working example of a ‘base’ to understand how something should be done. In terms of using the server script action I found using this example allowed ChatGPT to understand how to simply get a function written as required so a result can be available in subsequent actions.


The screen shots above show a base example to provide…Do not worry about the field of step 2 for JSON output, the result is not JSON and has nothing to do with the base example.

(function(properties, context) {
    return "Hello, world!";
})(properties, context);

Once you get that base example for ChatGPT to know how to get a script written in proper format and get a result, you should be okay to get ChatGPT to produce most scripts you may need to produce the results required.

As a side note, I used this to take a webhook response with lots and lots of nested JSON arrays and to get a script to isolate only the relevant key:value pairs based on the webhook event type and to produce a flat-structure json with prefixed keys for the nested arrays so that I can have a valid JSON available to send through my app API for bulk updates to my Bubble database.

1 Like

GPT is ok.

If you’re just looking to write code you should try Github Copilot.

Actually documentation from Toolbox’s documentation page will help AI to write the appropriate scripts for Toolbox.

Toolbox just runs our custom code as a literal so the parameters properties, instance and context are just values Bubble plugins use.

Properties stores user values (from plugin element values? properties.param1 etc

Plugins use instanceto store data across a plugin’s element while containing methods to call Bubble functions.

context contains data about the plugin element like current width, height etc.

So once your AI has some context of the different native plugin parameters and how to return values to bubble_fn_someJ2Belement it’ll be able to write scripts with no issues.

@ihsanzainal84 is this the documentation link? Server Script - Toolbox docs

1 Like

Do they have their own LLM or is it just a service running off the back of OpenAI?

1 Like

It runs off of AI’s 'Codex" which was trained to code and created for Github.

GitHub Copilot · Your AI pair programmer · GitHub

1 Like