Forum Documentation Showcase Pricing Learn more

How to automatically add "..." to dynamic values? (SOLVED)

Hi everyone,

I’m not sure what it’s called. I want to send messages to selected multiple users. The API requires “” for every user. Here’s the API example

19

My data field stores just user ID without “”. So every time Bubble gets data it will go without “” just like this

“to”: [U4af4980629, U0c229f96c4],

And the API won’t work.

Any ideas?

1 Like

@privilet.info would :find&replace work for your use case?

Hello,

Try the following plugin, please:

Demo:

For instance, you have a list - A, B, C.
The plugin will return the array - “A”, “B”, “C”.

Cheers!

1 Like

Hi @neerja,

Thanks for your suggestion, but I’m not sure I know how to do that.

Let me try and will let you know :slight_smile:

Hi @lottemint.md

This might be my solution. I have tried and found out that the plugin has to get the data from database first then convert it. This might take time to do a search and cause slower workflow. I’m trying to work around to grab data from input and convert it straight away.

Correct me if I am wrong.

Thank you.

Hi,

Can you share the screenshots of your workflow, please?

Hi,

Workflow: The value straight from input is not allowed.

Here’s the test screen

The other thing is - do I have to create a data first then display it?

You don’t need to save it to the database.

Check out the attached screenshot:

Regex pattern:
[^,]+

image

You can also use :trimmed to avoid unnecessary spaces.

I’m really appreciated for your help. But this seems super hard for me T_T

But I will give it a try and let you know.

Thank you so much.

1 Like

Hi, @lottemint.md

I revisit this plugin and it doesn’t work the way it should be.

Here is the before

and the after

I go straight with the plugin without modifying anything

I expected the result should be “A”, “B”, “C”

Do I miss anything?

Thank you.

Hello,

Can you enable the debbuger and share a screenshot of your input value for the Array field, please? Thanks!

1 Like

Hi @lottemint.md

I think I’ve made it. But not the real solution I am looking for.

I misunderstood the plugin concept. My input was A, B, C from a text filed type and this didn’t work. So I tried to use the input from ‘a list of thing’ field type and it worked. I think the name of the plugin reflects the function itself but I just overlooked :sweat_smile:

Correct me if I’m wrong.

Is there anyway that I can add “…” to each individually value in the text field? The result of text field is from a search with both constraints and intersects from database. So it writes each result with a comma at the end of each value.

Now the problem is when I search and write the values as a ‘list of thing’, it still does not write values as a list, it writes the same as a normal text field. (I suppose it will add the list when values are added at different times, not a one time search).

This “list of thing” that works. I manually make a list.

This one does not work. But this is a real use case that I got from a search.

Anyway, here is what you asked. I made both kinds of fields but I don’t know why they look the same in the debugger? But only the result from a list of thing works the way I want.


Thank you so much for your help.

PS. The reason behind all of these because I want to store values without “…” and will convert them with having “…” just for sending this notification API only.

If there’s no way I can do this I may have to go back to storing values with “…” way. :sweat_smile:

I think you’re misreading the documentation for your API. But, even if so, you can easily append strings to items in a list with the “:join with” operator. Go play around with that.

Let us say that “some_list” is a list of texts like so:

[“Keith”, “is”, “your”, “friend”]

Printing some_list to a text element will yield:

Keith, is, your, friend

The commas are just the default join.

Want to see ellipses between every word? That’s just:

some_list:join with “…”

This will yield:

Keith… is… your… friend

What API are you trying to connect, anyway?

1 Like

Thanks for the details!

If I understood correctly, your “A, B, C” is a simple string/text.
You need to use a list for that field. For instance, [ A, B, C ]
If you want to store it as a simple string, try to split it by “,”

1 Like

Hi @keith

Thanks for your help :slight_smile:

It’s a LINE messaging API, a common chat app in Asia. The ‘Send multicast message’ API requires each userID with “…”. (Array of strings) Here’s the document
https://developers.line.biz/en/reference/messaging-api/#send-multicast-message

I have found a solution (bad solution) by storing each userId with “…”. So when I search users and found more than one users, it will go like this (and the API works)

But if I want to store each userID without “…” it will go like this. And the API won’t work.

I want to do the latter because I want to use userID in other case. Like getting user profile, just do this HTTP GET request

This case, I will get another problem if I store each userID with “…”. I have to remove “…” before making a request :sweat_smile:

That’s why I just want to put “…” to each userID for sending messaging to multiple users only. Not storing them with “…” at the first place.

Now I’m finding a way to use a list for that field. But the search result returns as a simple string.

Still struggling :face_with_thermometer:

Please read a detail I replied to keith.

Thanks for your help.

I’ve solved the problem.

I write this just to share to those who may face this kind of problem.

First, the data type has to be a list of thing to store the values. Then create a new list of thing with ‘add list’ instead of ‘add’ from a search.
18

This way the values that come from a search will be added to a list one by one. Like this

Then use Wrap list to array plugin to add “” to each value. The final result will be “A”, “B”, “C”

Thank you so much everyone.

1 Like

So, you just configure your API Connector field so that it looks like:

[“<your variable>“]

You’re going to type the bracket and first double quote and then insert the token for the variable part and then type the second double quote and close bracket.

Now, when you do your data call, you do put in the dynamic data field:

That_list_of_recipients:join with ...”, “

And then your API call argument will be in the format you need. Looking like:

[“recip1...”, “recip2...”, “recip_last”]

This is just one way to do it, of course.

2 Likes

Thanks so much @keith

Your way works faster. It can reduce the amount of workflow.

:smile:

1 Like