How to support both dev and production version of bubble webhook?

I have a backend API that sends callback update to Bubble API. The bubble interface gave me the following call back url to use: https://yourdomain.com/version-test/api/1.1/wf.

It works for my dev front-end. But when I push to live, it doesn’t work on the live web-app. If I switch my backend to use https://yourdomain.com/api/1.1/wf, then it works.

I cannot find any documentation on best practice to support this. I didn’t want to send call back to both all the time from the backend. Any suggestions?

thanks.
Amy

1 Like

Easy.

  1. Create an option set called env.
  2. Create the following parameters;
  • display (default)
  • prefix (text)
  1. Create two options:
  • dev (prefix = “version-test/”)
  • live (prefix = BLANK)
    blank = do not enter anything.

Now, in your apis, use this parameter within the url like so:
https://yourappname.com/[envPrefix]/api/1.1/wf

Now, whenever you use the api call to initialize at first, use “version-test/” as your first “envPrefix” data source, and when you use it on a workflow, use this:
Isn't live version:formatted as text [yes = OPTION: dev's prefix, no = OPTION: live's prefix].

You’ll have to do this for every API you use within your site, but it beats needing to use different API’s for test mode/production mode.
Bam!

2 Likes

How do you create a blank option? It should be something on it to enable?

How to use it in the API since it generated in the workflow?

that works perfect! thanks :slight_smile:
but in your example you have to remove the slash before the “/api” right? and why with an option set? its always “version-test/” or if bubble will change this in the future you never know…

No. This depends on your branch. If you’re using anything higher than a starter plan that is. You can utilize whatever branch name you want.

1 Like

Hi! thanks for the answer, but i’m still not sure what are the steps to use it in a workflow?

For some reason, everytime i go to live version, rather than leaving the option blank, it is automatically filled by “null”. Even if i checked the box allow blank!

Any ideas what is going on?