API connector - When?

Hi everyone,

Do you know if we are going to be able to use the API connector in our workflows anytime soon ?

If you use backend workflows you can also use them now… I don’t know what your needs are though…

Yeah backend workflows work fine, but in certain cases I need to run the API calls in the frontend.

For example, I have an API call which processes a payment and I need to know whether the payment went though successfully before continuing the workflow’s actions

If the API call is made in the backend I can’t have the response to proceed

Ahi… then I wouldn’t know how to help you… unfortunately not even the states come to the help in this case…

but if I had a field in the database successful payment? Editing from the backend only if the answer is payment accepted?

I have a data type dedicated to backend workflows for that purpose. You can then create a thing in the app, pass it on to the backend workflow, and make changes to the thing’s fields as the backend workflow progresses and monitor those changes in the frontend to execute any actions dependent on the result of the backend workflow.

Hi Toby,

This sounds like a solid approach.

In my case, I need to handle two steps:

  1. Payment processing
  2. Displaying a “Payment Successful” screen

Would you structure it like this?

  1. Create a “Payment Session” data type, including:
  • A reference field (e.g., “Order ID”)
  • A payment successful field (yes/no)
  1. Schedule an API workflow for payment processing, passing the reference as a parameter.
  • Once the payment is successful, update the “Payment Session” to set payment successful = yes.
  1. On the frontend:
  • Set the mobile view state to “waiting”.
  1. Use a custom event to check the payment status periodically:
  • Every X seconds, run a search for Payment Session where reference = reference and payment successful = yes.
  • If the count is greater than 0, proceed to the next step.

While this seems feasible, the “Do every X seconds” approach isn’t ideal since it unnecessarily increases WUs consumption.

Would love to hear if there’s a more efficient alternative!

On the backend workflow; yes, that’s exactly what I’d suggest.

On the frontend though, rather than running a WU-intensive recurring event, I’d use conditionals to show the content you’d like (e.g. payment success screen) as Payment Session fields change in the backend. Frontend workflow would look like this:

  1. Create a Payment Session.
  2. Set state of view or group to the new Payment Session.
  3. Schedule backend workflow for payment processing.

Then monitor changes to the Payment Session using conditionals, displaying the success screen when payment successful = yes.

If you need to run other actions when payment is successful, you could also use a “Do when”-event and set the condition to every time payment successful = yes.

1 Like

So, I’ve noticed that in frontend workflows, we can not use API connector “action” API calls :

BUT, if you “copy with workflows” an element from your web app, that has API calls in its workflow, and paste it in your mobile app, the API calls work when running the workflows !

I’ve chatted with Bubble’s support team about this and they mentioned “If your API calls are functioning correctly in the mobile app, it suggests that they have been properly set up”

Is anyone working like this and have you encountered any issue ?

Is this approach is okay, or is there are any potential issues I should be aware of ?

Would love to hear your thoughts @nick.carroll

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.