How to return objects from plugins (SSA, CSA, Element Update & Element Workflow Actions)

@jared.gibb Thanks for your help. I have solved the problem. For anyone else with issues of returning Arrays of objects, my solution is the following code"

const response = context.request(options);

var body = JSON.parse(response.body);

const {convert} = require('json-to-bubble-object');
let returnlist = []

if (Array.isArray(body) == false){
    else {
        for (let i = 0; i < body.length; i++) {
  returnlist[i] = convert(body[i]);
    return {
        "result": returnlist,    

Essentially, if the returned API data is just one single object, without [], we can pass that through as per the usual. If not, Iterate through each object in the array and use the convert function to include the p prefix to each object. This then allows it to be passed back through the API as a list.


Would love some help returning a value client side from an action - so far this seems impossible!

1 Like

Did you see the video above? Which part didn’t work for you?

Hi @jared.gibb ,

Mostly the part where there was no video :wink:

Although on further reading, I don’t believe it’s possible with Client Side actions


1 Like

@jared.gibb Hey Jared, First, thank you for taking the time to thoroughly outline and explain these steps! This is enormously helpful. I have a followup question for you or anybody that can answer. Perhaps you will cover this in video 2, but I’m not sure, so I’ll go head and ask here.

How do you pass dynamic url parameters from the API call tab to the elements tab for use in the code on the elements and/or actions tab?

Essentially, I want to use/transform a dynamic variable(s) provided from the “get data from API” feature, before returning the response as JSON.

Adding the parameter is easy, I’m just perplexed about how to call it and assign it as a variable in the actual code. Maybe it’s obvious, but I haven’t seen any documentation on how to explicitly do this.

awesome, thanks!

1 Like

Hello Everybody,

First of all, thank you very much @jared.gibb for this full tutorial, it’s help me a lot, and I think I (finally) understand some basics. It’s real game changer for bubble building.

Second, English is not my native language, so I’m sorry if some things are not clear. Plus i’m not a “coder” and I have just very few knowledges about JS et nodejs.

Third, PLEEEEAAASE I need your help. I’m struggle with this for weeks, so there it is :

I’m trying to create a plugin for calculate Levenshtein Distance.
If you don’t know what it is, it’s the difference between to strings (e.g : love/love = 0 because it’s the same word, love/hate = 3 because 3 letters has been changed… )

for that I use the nodejs package levenshtein.

I need to catch the result (levenshtein.distance) and change a cell’s data of my bubble DB.
I use server side action, because I need to loop the worklow.

Here is how I process :

1 - The user click on the button, the first action launch the API Workflow.

2 - Here is the API Worklow launched. First step, is ok then, I launch my plugin SCORE

3 - I want to keep the result on the database in a user field in the next step

That where it’s not working.

So plugin side :

1 - Plugin API Calls

2 - API Response

3 - Values

4 - Code

5 - SSA Console Output

If I change the console.log(score) to return {“score_titre” : score}, nothing happend… I don’t get it.
I don’t know what I missing or if use it the wrong way ?

Thank you very much for reading me and your help!!


You never return {“some”:”value”}

You probably want to

return {
“_p_score_titre”: levscore.distance

But you probably have an async action happening there and you’ll need more code than that if true

1 Like

Thank for your answer.
Actually, I try both way and the both return nothing.

But… just with this

function(properties, context) {
		var levenshtein = require("levenshtein")
		var srt1 = properties.reponsetitre
		var srt2 = properties.sessiontitre
		var levscore = new levenshtein(srt1,srt2)
		var score = levscore.distance
return {"score_titre": score};

I have the response.
I don’t understand why, but it’s working

The reason it works is because score_titre is the name of the return field that you defined in your returned values above. It appears that levscore.distance is simply a number. You don’t need to define the API type to return a simple type like a number.

Maybe your end goal/hope is to return more than just the distance value. But as your code is currently I think you have slightly overcomplicated the concept.


do a search for a plugin called “Return a bubble thing”

see it in action here

its a demo i made. be sure to check out the code. this is what you are shooting for.

1 Like

Thank you, it’s more clear now!

And yes, I have overcomplicated the concept!! But, reassure me, it’s newbies mistakes no ??

1 Like

Thank you so much for your work !!

1 Like

Excellent tutorials, @jared.gibb . I love the name of the test app poop123. I’m here for that.


Thanks for sharing this tutorial !!
I’m struggling to make it work I get an error when parsing the response.

Can anyone help me here? I must be missing something but I cannot find it

This is my setup:

I’m having issues with this myself today it seems… you’re not alone

Thanks, could this be after a Bubble upgrade?

I am wrong. I got mine to work. Both client-side and server-side able to return objects

Are you testing your plug-in or did you install your test plug-in? There’s a difference between the two if you installed your test plug-in, are you sure you’re running the latest version?

1 Like

Good morning, thanks for your reply.
No I have not installed it. I have not done any release, just using the test application

Might be worth switching out the return value for just the object stringified so that you’ve got eyes on exactly what’s being pushed back.

This does look really strange though…
I’m keen to get to the bottom of it has we heavily rely on this.

Also would be worth deleting the api call and setting it up again.