The functions in this group work with lists: they add and remove items, check whether an item is there and join a list into text. A list saved to a field is stored as JSON, and you can pass a JSON list string to these functions directly.

Where it helps:

  • a shopping cart or a list of selected courses;
  • the subscriber’s interests that they pick along the flow;
  • checking whether the subscriber has already chosen an option.

Functions

FunctionDescriptionExample
arr_len(list)Returns the number of items in a list.arr_len(client.products) → 3
in_array(list, value)Checks whether the value is in the list.in_array(client.products, "course") → True
append(list, value)Adds a value to the end of the list.client.products = append(client.products, "course")
insert(list, index, value)Inserts a value into the list at the given position (starting from 0).client.products = insert(client.products, 0, "course")
remove(list, value)Removes a value from the list.client.products = remove(client.products, "course")
join(list, separator)Joins list items into a string with a separator.join(client.products, ", ") → "course, book"

Example: a shopping cart

client.cart = split_list("Yoga course, Membership", ", ")
client.cart = append(client.cart, "Consultation")
client.has_consult = in_array(client.cart, "Consultation")
client.cart = remove(client.cart, "Membership")
client.cart_text = join(client.cart, ", ")
client.cart_count = arr_len(client.cart)

Result: cart_text — Yoga course, Consultation, cart_count — 2, has_consult — True.

To insert an item at a specific position instead of the end, use insert: insert(client.cart, 0, "Gift") puts “Gift” first — positions start from 0.

random_choice picks a random item from a list — see examples in Formula: Games and Giveaways. How to parse a list from an external request response is described in Formula: External Request Response (JSON).


If you did not find the answer to your question, feel free to contact us in the chat inside your dashboard, message us on Telegram at @BotHelpSupportBot, or email us at hello@bothelp.io.

Enjoy the full functionality of the BotHelp platform for creating broadcasts, automated funnels, and chatbots — free for 14 days.

Get 14 Days Free

Sign up for BotHelp

Get 14 days of full access for free — enough to build your first bot and test it on real subscribers.

Create account

Была ли статья полезна?

Our channelsTelegramMAX
Спасибо за обратную связь!