How do I use the auto list bubble?

I would like to use the auto list bubble to generate a list automatically. Either by API or by using data keys. Can you tell me how to do this ?


If you want to create an automated list which will display data from an API, you can use the “List Auto” bubble.

In this thread, we are using the Asteroids - NeoWs API from NASA, which is available here.

For this example we are going to show you how you can make a list with all names and IDs of near earth asteroids spotted on March 22nd, 2022. Here is a glimpse of the content of the API:

First of all, you need to create an API bubble that you have to connect to the first bubble of your bot:

Inside that API bubble, you need to enter the URL of the API, with the “start_date” and the “end_date” which for this example is “2022-03-22” in both cases. At the end of the URL, don’t forget to write your own API key. If you want to know more about how to make queries, you can check out this website (each API has a specific documentation, don’t forget to read it before you start making queries):

Once you’ve filled out the URL, you need to choose the type of request you are going to make. Here, to get information from the API, it’s going to be “GET”. You also have to specify the format of the API, here it’s JSON.

Then you’ll have to create a data key in which you are going to store the data you are going to receive. Click on “Store response” and then on “Storage data name” to create a new data key that you can call for example “List”:

That data key will contain a “List” of “Object”, with “name” and “id” as properties:

Once you’ve created and set up your new data key, you need to specify the path, you can find out what the latter is by looking at what’s inside the API:

Here it’s going to be “near_earth_objects” and “2022-03-22” to get to the information you want:

Then in “Data structure”, you need to write what you want to get from the API, here it’s “id” and “name”:

Then you need to link your API bubble to a “List Auto” bubble you are going to create (don’t forget to also set up a fallback bubble in case things go wrong, a simple “Text” bubble can do):

Here is where you can find the aforementioned “List Auto” bubble:

Once on this new bubble you need to select the day key in which your data are stored (here it’s called “List”):

Then you’ll be able to use the data stored in that list. To display it, you need to press on “Data key” in the text editor, and select the data you would like to show:

For the title, you can for example put the name of the asteroids:

And their respective IDs as a subtitle in the other text editor just bellow:

Once again, don’t forget to set up a fallback bubble, in case the API doesn’t respond properly. And you won’t be able to click on “ok” if you don’t do it :slight_smile:

You can now give it a try in the “Tests” section, here is what you should get: