How to trigger a backend workflow?

I am trying to trigger a backend workflow, from a workflow on the client side. Is this possible? If so, how can I do this?

The reason for this is so that the backend workflow can access private data not available to the client.

Thank you in advance for your help.

Of course it’s possible…

What exactly are you trying to do?
And which part of it are you having trouble with?

Using an API workflow that ignores privacy rules is a good solution to keep data safe. For example for checking whether a Phone number is being used in the app without exposing all user phone numbers.

As you probably realised, the Schedule API action will not let you return data from the API’s ‘Return data’ workflow step. As you said, you will have to Trigger/Call the API instead.

Check the ‘Expose as public API workflow’ box on the API , and then connect it to the API Connector with https://yourdomain.com/api/1.1/wf/workflow_name
The API connector will allow you to call the API from the page, return the data, and access it by using Result of step x.
Make sure to somehow handle authentication, so that people cant call the API arbitrarily/maliciously and access private data. I would recommend at least using a Private Parameter and checking that private parameter on the API conditional, but further security depends on your particular usecase.

3 Likes

Complementing @nico.dicagno great advice … if you are running availability checks (data entries existing or not) … have the endpoint return yes/no fields to your queries (searches).

1 Like

@nico.dicagno Thank you so much for the detailed response. That worked!

Also, thank you for the recommendation on the protecting the exposed API.

Bahar

1 Like

Thank you, @adamhholmes! @nico.dicagno answered my question.

Got it!

I have another question. Is the exposed API call a blocking call? I assume it is.

Is there a way to make it non-blocking and respond to the response when the response is available?

What do you mean by blocking?
The response will be used in following steps only once the API response is available.

Got it. So it is blocking. In other words, the following steps of the workflow will wait to be executed until the API call returns.

If you have other steps which you want to run while waiting for the response, using the API as data instead of as an action might help. This is a setting in the API connnector. But even without this Bubble might complete following non-dependent steps before the API responded.
Workflow order of operations depend on the particular workflow. Best way to figure it out is to actually test it.

Thank you, @nico.dicagno.

No problem!
You could also use this solution as outlined by @georgecollier, it can be quite a lot less work for complex API calls.

This topic was automatically closed after 70 days. New replies are no longer allowed.