đŸ§©Facing challenge in Sending Emails to Selected or All Users in Bubble.io

:waving_hand:Hi everyone!
I wanted to share something I recently figured out — I was facing an issue in Bubble.io where I needed to send emails to specific users or all users at once from a list. It seemed tricky at first, but I managed to solve it step by step, and I thought it might help others too! :blush:

Here’s my approach:

Step 1: User Interface (Frontend)

  1. Add a Repeating Group (type: User, source: Search for Users).
  2. Inside each cell, add:
  • A checkbox (to select the user).
  • Any user details you want (name, email, etc.).

Step 2: Add “Select All” and Track Selected Users

  1. Outside the repeating group, add a “Select All” checkbox.
  2. Create a custom state (on the page or a group):
  • Name: SelectedUsers
  • Type: User
  • Set to list
  1. Workflow logic:
  • When a checkbox is checked in a cell → Add that user to SelectedUsers.
  • When unchecked → Remove that user from SelectedUsers.
  • When “Select All” is checked → Set SelectedUsers = RepeatingGroup’s List of Users.
  • When unchecked → Clear SelectedUsers.

Step 3: Enable Backend Workflows

  1. Go to Settings → API.
  2. Check :check_mark: Enable Workflow API and Backend Workflows.

Step 4: Create a Backend API Workflow

  1. Go to Backend Workflows (in the editor left panel).
  2. Click “+ New API Workflow”, name it send_email_to_user.
  3. Add these parameters:
  • user (type: User)
  1. Inside the workflow, add an action:
  • Action: Send Email
  • To: user's email
  • Subject: subject
  • Body: body
  1. inside this from, add an action schedule api workflow(send_email_to_user)
    minus the user until it goes to first item(user:minus item user:first item) and put condition also (user:count>0)

Step 5: Trigger the Workflow from the Page

On the “Send Email” button:

  1. Workflow → Add action → Schedule API Workflow on a List
  2. Set:
  • API Workflow: send_email_to_user(Schedules the API workflow and emails selected users.)

Step 6: Show Confirmation & Reset

  1. After the workflow:
  • Show a popup or alert: “Emails sent successfully”

:tada: Final Result

Now the system works exactly as expected:

  • I can send an email to just one person, a few selected people, or everyone at once.
  • It’s all smooth, efficient, and works in the background thanks to the backend workflow.

I’m glad I figured this out; I hope it helps you if you’re facing a similar issue.