Forum Documentation Showcase Pricing Learn more

Adding List of Things to API connector

I’m trying to add multiple recipients to Sendgrid from database on Bubble.

The POST Call Request body should look like this:

[
{
“email”: "jones@example.com",
“last_name”: “Jones”,
“pet”: “Fluffy”,
“age”: 25
},
{
“email”: "miller@example.com",
“last_name”: “Miller”,
“pet”: “FrouFrou”,
“age”: 32
},
{
“email”: “invalid_email”,
“last_name”: “Smith”,
“pet”: “Spot”,
“age”: 17
},
{
“email”: "pre-existing_email@example.com"
}
]

I’m able to replace data for these three entries and upload them, however how do I do the same for 500 recipients at once?

This isn’t something the API connector supports yet.

Seems like quite a few people have been bringing up API and “lists” in the forum. Is it something we can expect soon?

How would you go about solving this with what we have available already? (I’m thinking custom workflow, however open to any suggestions)

What people were asking was ability to fetch lists, and we did solve that already.

Here you’re asking about input, which is more complex, and a much more rare case.

To follow up. Any chance this will be implemented soonish? I can add recipients one by one however it will be sorta killing the workflow if other users of my app will do the same.

I can’t commit on adding that in the coming weeks.

That’s alright. I’ll sort it out another way. (I hope)

Speaking of which: How can I send a list of things to Blockspring so it fills in as a table?

Right now if I run a block: “Append values to a Sheet”, I enter the following into JSON input:
[[“List of things first_names”, “List of things last_name” ]]

RESULT:
Column A Column B
Row 1 Bernie, Hillary, Donald “Sanders, Clinton, Trump”

I can add one column of repeating group by entering JSON:
[["List of Things first name joint with “],[” "]]

        Column A

Row 1 Bernie
Row 2 Hillary
Row 3 Donald

How can I get Blockspring to enter it into the table with both first and last name like this:

        Column 1   Column 2

Row 1 Bernie Sanders
Row 2 Hillary Clinton
Row 3 Donald Trump

(Or is this pretty much the same issue and I can’t do it?)

Hi Martin, same issue with populating blockspring tabel, haw had you solved finally?
Thanks a lot
Andrea

Hi @adycarlo, I can think of a couple of ways to do this.

1 . If you are initiating the send from a browser, and the user has access to all the data sending, could build up the list with the Toolbox plugin List Item Expression.

2 . If the API call is from an API workflow step, i.e. from the server, could send the following to an external host …

{
“email”: [“jones@example.com”,“miller@example.com”, …],
“last_name”: [“Jones”, “Miller”, …],
“pet”: [“Fluffy”, “FrouFrou”, …]
}

and have it return back a structured form
[
{ “email”: "jones@example.com", “last_name”: “Jones”, “pet”: “Fluffy” },
“email”: "miller@example.com", “last_name”: “Miller”, “pet”: “FrouFrou” },

}

How often does it need to run? If its infrequent, could use a free webtask.

3 . Build up the text for each item as it is created / updated.

1 Like

Hi @emmanuel! I was wondering if this feature of inputting a list to the POST body will ever be added? I would love this feature and currently there is no seems to be no workaround sending a list of data to the API connector (or even converting a list to a string). Any input would be helpful!

Have you tried this?

Thanks for the input @renelonngren! I need something specifically for the API and no element related. So I want to send a POST request with the body containing a List of Things in the Bubble database (e.g. Users). If you know of a plugin/method that is able to send a List of Things from Bubble to an external API that would be fantastic!

Ive used the above plugin to do that. I send a list of users with their respective names and emails to Sendgrid as a json using the plugin.

1 Like

Oh, do you have an example (or directions) for that? I cannot seem to see any plugin action in the API workflow or in the API connector that will allow me to do that.

@gbannister So, first, after reviewing my app, the plugin to use is Toolbox, not the one I mentioned above.

I use the List item expression to extract the data from a list, like so:

Then we clicking SEND I set the data source of the list item expression:
image

and then I save the json text that now contains the email addresses in a state:

and then I call the API (in this case update a google event), passing along the json:

Thanks for the steps @renelonngren! Unfortunately, this requires some UI interaction in order to send the list as a string to the API Workflow endpoint (Note that I have already played around with Toolbox plugin to no avail). I would like a way to send a List of Things through the API Connector from the API Workflow.

Example:

  1. I curl the bubble endpoint (e.g. curl -X POST https://bubble.is/api/1.1./wf/endpoint)
  2. The endpoint will trigger the API Workflow and the workflow will send a List of Things as a JSON String Body (since there is no way to input as a list right now) to the API Connector API call endpoint

So with what I require, I cannot have a Bubble element be triggered by a user before I can get the List of Things as a string. Thank you for the help though!

One approach could be to build up the list one item at a time, using the text functions, storing as a text database field, and use recursive scheduled API workflow to add each item.

Another approach is to call an external API of your own creation, with separate lists for each field, and have it zipper them together to build up the list of fields.

Edit – oops I already answered with similar to this in this topic, post #9

Just wondering if this is still an issue?

I have a list of X recipients to send a message to. The current call is sending it as

{“contact”:“Contact_1,Contact_2,Contact_3…”, “message”:“body”}

This results in an error as the API I’m hitting cant handle an array for Contact.

I need to pass it as {“contact”:“contact_1”, “message”:“body”}, “contact”:“contact_2”, “message”:“body”}, and so on for the list

This is for a workflow.