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.