API - Logic Not Working

I’ve been working on this for 7 hours and no luck! Here is the logic:

  1. A General Contractor submits a project.
  2. Bubble searches for subcontractors who fit the criteria.
  3. API send emails notifying subcontractor they have a project.
  4. API is set up that X days before “project due date”, it sends a reminder email. (This is the part not working).

The way bubble knows to not send the email in #4 above is when the subcontractor confirms, then #4 should not occur.

Here is the API Logic:

Here is a test project showing it registering in the database:

At this point, since the subcontractors have confirmed they will bid, they SHOULD NOT be receiving emails.

Here is the email:

Here is the API and it’s called the “invitationreminder”.

Have you tested the “only when” condition on a page element? The “contains” expression is rather finicky for texts.

The logic might be improved by cancelling the schedule if the reminder is no longer needed.

I put the “only when” condition on the API because if I did the “only when” condition on the page element then condition wouldn’t be met at that time. In order to trigger the page element the user has to hit a submit button then that sets up the API to send in X days.

So, I put the “only when” condition on the API because there could be a few day delay from when the user accepts the bid and when the API was originally set up. Does that make sense or should I move it to the page element??

I don’t know what you mean here. Could you clarify? “The logic might be improved by cancelling the schedule if the reminder is no longer needed.”

Here is the page element where I didn’t put the “only when”

Here the “only when” on the API.

The part of your app that handles their confirmation could cancel the schedule for the API workflow reminder.

Yes its a good idea for the scheduled reminder to check conditions before sending.

Since testing the API workflow is more difficult than testing on a page, you can set up similar conditions on a page to see if the logic will work.

For example, a test page with a text element that shows the result of the first “doesn’t contain” expression, etc …

I appreciate your help but still can’t make it work. Is there any chance you can go in there and check it out/change whatever I’m doing wrong?

Here is Step 1. The user adding a project, so I am sending the initial email (this is working) & then I’m setting up the next step which is the reminder (not working).

Here is the next part where the user is confirming (by hitting a “yes” button) and then I need to cancel the AP we set up above which isn’t working. I don’t see any choices to cancel that API.

Typically you’d want to cancel a scheduled workflow when the conditions for it are no longer valid, which might be the next day, so you’d need to save the scheduled id in the database in a place that relates to its conditions … in your case, the project record (thing).

Then either:

  • A workflow runs which invalidates the need for the schedule, so that’s a good time to cancel it.
  • Or the schedule activates, and its condition is checked.