How to Create a Webhook to Trigger a Page Based Workflow Event (not an API Workflow)

Hey folks…

I’m implementing Stripe Checkout in my app. Once the user has paid, my page needs to sit and wait for an incoming webhook from Stripe.

How do I build the webhook api so it is then available as an event trigger on the page?

Best wishes,
Antony.

1 Like

Create an api workflow to receive data

Yes… so I can do that, have it write some data to the database and have my workflow trigger on the change of that data…

… but I was hoping there is a way within a plugin to just have the webhook create an event I can then detect directly on the page without needing to go through the database!

This is not a plugin.
Api Workflow is a native function of Bubble.
You don’t need a workflow to trigger on change of data. When the webhook will come in Bubble, this will trigger a workflow. Do what you need.
However, I think you should store information in DB like the status of the payment.

2 Likes

Hi there @Jici… thanks for your reply… but I need a workflow to trigger on the page, to show and hide information etc, and an API workflow doesn’t do that! :slight_smile:

OK.
You can use Conditionnal for that
Example: If current page payment “status” is “Paid” Set this group to Visible.

1 Like

Hi @antony,
Do you have details on how you implemented Stripe Checkout on your site?

I have exactly the same issue with Stripe Connect.

Stripe takes about 30-60 seconds to validate a seller once they have uploaded bank/id details. The Seller Account is updated, and a Webhook sent to notify.

I have the webhook working, and it updates a field on the User correctly to say if they have passed or failed validation.

There is also an API which I can call to get the status.

However… none if these work “in workflow” as the workflow never seems to see the updated field on the user until after it is finished. Also, the API to get the status always returns the same value (assume it is also being cached, despite me writing multiple versions of the call.

What I have tried to do …

  1. Have a workflow run and pause for x seconds, then check a different API to see if the validation has been performed. It never returns an updated value, however when the workflow ends and that page is refreshed, the new value appears.

  2. Wired up the webhook to update a field on the user. Same, pause/check/pause/check but it never sees that field on the User has been updated. Even though I have timestamped the update, and it has been changed before the workflow has run.

The page is already quite busy, so I don’t want to do “Do every x seconds” when this is something that is only ever done once.

Alternatives …

Navigate to another page immediately and have that page do the “do every x seconds” and check for the field being updated. Update a counter so that after x tries it navigates back if no response/

Show a Pop Up and wait for the API timestamp to be updated and then proceed. However in this case I don’t think I can terminate the popup after 60 seconds “automatically”. Don’t want to leave the user hanging waiting.

Any other solutions that spring to mind.

Basically … wait for a Y or and N to come back from a Webhook or 60 seconds … whichever is the soonest ?

2 Likes

Triggering “When data changes” works nicely as Bubble then takes notice of the field in the workflow.

What you then can’t do is look at ANOTHER field on the same Thing.

So you can’t say If user “stripe timestamp” is updated and trigger something "only when user stipe status = “Y” as it won’t see that being updated, only the timestamp.

What you have to do is trigger a custom workflow and THEN look at the field.

You can timeout by scheduling a custom workflow for x seconds. But then you need to handle when that triggers and the “when data changes” have too.

2 Likes