Toolbox plugin help - server script

Hi all,
I’ve done a bunch of googling but can’t find anything that talks about how to use the server script action:

I have a feeling this action does what I want it to do as it allows you to return any datatype you want but I need some direction on how to use it.

There are plenty of videos on how to use the “run javascript” action but not the “server script”.

Anyone have any useful links?

Hi @paul29

Put on the last line the result.
Here is an example of a simple list:

const List = [];  // comment : initialize the List.

if     (data == "Hi") {
    List[0] = "firstname", List[1] = "english", List[2] = "hi_firstname" }
else if (data == "Hello") {
    List[0] = "lastname", List[1] = "english", List[2] = "hello_lastname" }

else { List[0] = "firstname", List[1] = "english", List[2] = "hi_firstname" };

List;  // last line if you want some result, in this case Result List.

___ AND


In Javascript list started with 0,1,2 …
In Bubble list started with 1,2,3

Thanks for this. Do you have any insight as to how to get this to work when the return type is an actual data type? I am trying to run some code that returns the data type in the proper format so that bubble can properly understand it as if it were a normal thing.

If that’s a little confusing, let me know and i’ll explain what I mean in more depth
Thanks again.

Hi @JohnMark sorry to bug you but I just wanted to follow up and see if you had any insight into my follow up question. Thanks

1 Like

@paul29 :raised_hand:
Here is the working example of server script which generates JSON…

Here is the link of the editor which covers all the toolbox plugins functions


Hi @viquarahmed07
Thanks for your reply. Apologies, maybe I needed to explain a little more. I am setting up algolia as an autocomplete feature. I’d like to make the api call in javascript and return it as a datatype so that I can manipulate it in normal bubble fashion (i.e. 's name, 's id, etc).

The reason I’m not calling algolia as per the normal api connection is because there is a slight delay making the UX no good as autocompletes need to be super fast.

hi @viquarahmed07

I m interested in using server script for facebook pixel
Could you make an example of this script:

s.parentNode.insertBefore(t,s)}(window, document,‘script’,’);
fbq(‘init’, ‘facebookpixelcode’ , {external_id: ‘12345’});
fbq(‘track’, ‘PageView’);
fbq(‘track’, ‘Purchase’,{
value: ‘100’,
currency: ‘USD’,
content_ids: ‘xxxxxx’,
content_name: ‘haircut’,
content_type: ‘product’,
num_items: ‘1’
{eventID: ‘xxxxx123’}

fbq(‘init’, ‘facebookpixelcode’ , {external_id: ‘12345’});

Hi @cm1
Well, i am not an expert in using server script
It’s better if you make your reply as a separate question maybe other experts can solve your issue…