Forum Academy Marketplace Showcase Pricing Features

Writing a Plugin For 3'rd Party Service Using Bubble - Endpoint-triggered Page Workflows

I am writing a plugin for a customer to interface with my Bubble app. The customer’s program only allows me to provide one https endpoint. Basically, when a user clicks on a person inside of the customer’s application (ex. “Johnny Appleseed”), their application triggers a data object to be sent to the specified plugin endpoint (i.e. my Bubble app’s endpoint) with that person’s email address.

The issue here is that the endpoint should be my bubble page (not an API workflow), so that I can display the Bubble Page inside their plugin-view and show [email protected]’s info. As far as I can see, the problem is that Bubble API workflows cannot tigger a “send data to page” and Bubble pages cannot ‘listen’ for incoming data objects. I basically need a “send data to page” action to be triggered every-time the customer’s application sends my Bubble endpoint an email address via json.

If the customer’s application allowed me to enter both an endpoint and a front-end url, I would probably just store the email addresses coming to my endpoint in a Thing, and then having the plugin’s Bubble page ‘do every 5 seconds’ load the most recent email address entered into the thing. Since I can only specify one endpoint, this is not possible. Does anyone have ideas on how to solve this?

I think you are on the right track with this approach. The usual mechanism is for the page to be updated with data changes, and it “subscribes” to these changes by having reactive data sources, for example a search.

You could define a page workflow event do when condition is true, the trick then is to pick a condition that changes when the email addresses have been added or modified. One example is:

  • Save current timestamp in a custom state, or a timestamp of a time known as before the change, or the timestamp of the last seen change.
  • Initiate the external process.
  • Custom event when: Search for a record where the modified date > stored timestamp, :count, > 0

Note that the event will trigger only when going from false to true, so if there are already matching records, it won’t trigger on new ones. So after the event has been actioned , the stored timestamp will need to be updated to “turn off” the condition, so it can turn on again on a new update.

I do something like this for visible notifications.

The only reason this wouldn’t work, is if altering the records doesn’t cascade the changes through to the clients. This happens when altering data manually in the data tab, but the API workflow should be fine.

Too many words, so …


Excellent info, thanks @mishav. I wrote a test app to communicate with Bubble and I have managed to get it working using timestamp records as you suggested. I wonder if the Bubble team has plans to integrate an easy way for a page to subscribe to changes created by an API endpoint.

The challenge I am facing now is that the customer’s plugin system only allows for one endpoint, which is displayed in their application via a webview. Here is a screenshot to shed some light:

I guess I could externally host an index.html file and utilize an iframe to display my Bubble app as the front-end, then use Javscript to reload the Bubble url (i.e. the plugin’s ‘endpoint’) with [email protected] in the URL. That way, Bubble could receive info dynamically via the url and not the endpoint. What do you think?

//something like this load Bubble URL with ?email at the end

//something like this to "listen" for data objects being sent to the page
  iframe.addEventListener('did-receive-dataobject', load_new_bubble_url);
1 Like

I’d be surprised if you got the iframe working nicely, although it could work if it is “one-way”, i.e. “display my stuff with this url, and don’t bug me again”.

There would be the issue of authentication, the Bubble app having a separate login to the customer app, etc.

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