Similar to what’s been suggested I’m going to get it to return a value (the URL) that can be used in the next workflow step. I’ll then create a separate client-side action to open the URL.
I was hoping that I could make it as simple as possible all in one server-side action the same as the bubble stripe plugin when it creates a checkout when you get the user to pay.
I’m currently having issues with the server-side script timing out. Looking at the logs the HTTP request is running ok and returning the JSON body, but my action is just timing out. I’m quite stuck again now.
I spotted this in the documentation, wonder if this is causing my problem.
Note: When writing server-side actions, avoid using async/await syntax to wait for promises. The framework we use to to handle asynchronous code (notably used in context.async or context.request) relies on a special library called “Fibers”, which works very differently from usual promises and will cause unexpected behavior if async/await is used. Consider using the traditional Promise.then/catch syntax instead, which is supported by Fibers.
I’ll have a go at rejigging the code later to use promise instead of await.