Writing a custom javascript function to start a workflow

Can anyone please help with a javascript function that will start a workflow when a modal is close d. Basically a javascript function that will run a workflow. I’m using the html input widget.


Tell me more. But yes.

So I have a workflow that opens a new tab to process payment from user. Which will take a couple minutes. The challenge is how to pause a workflow when the user leaves the bubble tab and resume it when they are redirected back.

The second option is to use a javascript function that will start a workflow when a javascript alert pop up is closed.

1 Like

Can you redirect back to the app from the payment processor? If so, can you pass some state in the url?

I Think this aproach its not much reliable. Because your user can simply give up for many reasons. And your workflow will not work correctly. The best way to do that its to create a Backend workflow via API.

Yes I can redirect back to the app with a callback url. I’m not sure I understand what you mean by states.

@moabe.leite @jared.gibb The best solution I think is to start a workflow when a javascript “success” alert pops up. But because javascript alerts are not a thing in bubble. I can’t use them in bubble. Which is why I’d like to know if there is a way to start a workflow when this pop up shows on the screen?

You can make an alert using various manners. alert() is one of them

The easiest way is to pass a state back in the URL when you redirect. Then you can use bubbles built-in detector to identify if there’s a parameter in your URL and what its value is. You can use that to trigger a workflow to continue on with what you’re trying to do.

URL parameters are :crown:

Can you add extra parameters to your callback url. Most platforms allow this to control what happens on the redirect and for additional security.

I definitely don’t understand what you are saying. I’m new to webflow, it’s miracle I’ve gone this far without any help. I found a way to use toolbox for the js function. In layman’s terms how can I trigger a workflow in the callback function here(kindly see attached image). Thank you
Screen Shot 2022-09-16 at 9.59.58 PM

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