I have a slash command that when called, prints a list of teams (which are stored in a List) with checkboxes next to them. I have no problem creating the checkboxes with a team name next to them, but only when the team name is hardcoded in. How can I iterate through the list and create an unknown amount of checkboxes?
app.command("/message", (req, ctx) -> {
ctx.respond(res -> res
.responseType("in_channel") // or "in_channnel"
.blocks(asBlocks(
section(section -> section.text(markdownText("Select channels to receive message")).accessory(
checkboxes(checkboxes -> checkboxes
.options(asOptions(
option(option -> option.value("0").text(markdownText("some-team")))
option(option -> option.value("1").text(markdownText("another-team")))
))
)
)),
actions(actions -> actions
.elements(asElements(
button(b -> b.actionId("submit").text(plainText
(pt -> pt.emoji(true).text("Submit"))).style("primary").value("submit"))
))
)
))
);
return ctx.ack();
});