Bubble Workflows: The Logic of a Bubble App

By | Last Updated: 9 June 2023

Bubble allows developers to design their project's functionality using workflows. While most Bubble developers are familiar with one type of Bubble workflow, the front-end workflows, there are other types of workflows, the backend workflows. If you're not familiar with Bubble, you should get started with our Bubble review before continuing.

Workflows are one of the key components in the Bubble software platform, which is designed to enable developers to build powerful user interfaces and applications quickly. Bubble’s intuitive drag-and-drop interface makes it easy to lay out how elements should interact with each other. This structural aspect of developing apps relies on workflows.

Before we jump into showing you how to set up some workflows, we would like to go through some definitions to help you understand workflows a little better.

What are Workflows in Bubble?

A workflow is comprised of several actions that all work together as part of a particular task or process. For example, if a button is clicked on an app created in Bubble, it will activate some kind of action. Those actions can range from loading new content onto the page, for sending an email, to interacting with APIs or external web services. All these actions are organized and assembled into a conceptualized workflow within Bubble’s environment for execution when needed. It's really that straightforward – create various triggers (which could be manual interactions from users) by simply dragging blocks into place, connect them up with whatever action you need executing following the trigger, and voila! A workflow has been successfully implemented!

What are actions in Bubble?

Workflow actions in Bubble are operations that help automate workflows within your software platform. With actions, users can create triggered events that will execute when a certain condition is met. For example, an action might be to send an email to a customer when an order has been completed or as simple as login a user when the email and password match and are in the database. Actions combine multiple functionalities and allow for the execution of any particular task with just one click. As such, they play a crucial role in streamlining business processes and increasing efficiency.

On the server side, backend workflow, actions can be used to make automatic changes directly to the database (read our Bubble database guide here) without having to manually input data or update fields. These server-side actions are particularly useful for making real-time updates that don't require user intervention or manual inputting. Likewise, on the client side, actions can be used to perform visual changes like hiding or showing elements as well as animating them based on predetermined conditions – all at once with no coding necessary! Ultimately, Bubble's powerful action feature allows users to quickly and easily trigger particular functions depending on the situation and reach desired objectives faster than ever before.

What are backend workflows? 

Bubble backend workflows are workflows that happen on the server side of your application, meaning in Bubble. Similar to front-end workflows, these workflows can be triggered by front-end interactions although these can be scheduled or triggered in other ways, such as cron jobs. These server-side workflows can be as simple as creating data in your database or complex workflows such as deleting a large amount of data or updating it. 

These workflows run asynchronously in the background of your application, meaning they can handle more than one task at a time at any given moment. This is important when it comes to tasks that require a long time to execute as it provides a better user experience by allowing your user to continue using your app while these tasks are completed. 

Backend workflows are an invaluable asset for Bubble developers and Bubble applications looking to optimize workflows and ensure their apps run smoothly.

Where do the backend workflows run in Bubble?

With Bubble, backend workflows are designed for server-side execution and won't use up the user's computing/processing power. This is critical to delivering a high-performance end-user experience, as the majority of processing-intensive operations happen on Bubble’s servers instead of on the user’s computer. As such, users don't have to worry about their local device performance affecting the engagement and speed of your immersive Bubble app.

Bubble leverages cloud-based server technology to streamline and manage processes so that tasks like authentication, data storage, information streaming, application variable tracking, and more can be achieved securely with reliable performance. In addition, Bubble offers advanced analytics within its admin interface to help track metrics and performances related to workflows executing in the backend. These additional insights allow developers more control over any changes they need to make in order to optimize their app's performance.

Client versus server-side actions

Client-side actions, front-end workflows in Bubble, refer to a type of workflow or action taken within a web page or application that can only be executed by the client. Examples include going to a page, toggling or scrolling to elements, setting custom states (learn more about custom states here), and similar minor tasks. In comparison to server-side tasks, client-side activities are not written in the logs of an application’s server and therefore cannot be traced back easily if something goes awry.

On the other hand, server-side actions, known as backend workflows in Bubble, rely on the use of a platform such as Node.js or Ruby On Rails, in this case, Bubble.io, and involve more complicated processes such as writing data, connecting to external services, sending emails, and more; these processes require larger amounts of resources than client-side activities. Although this is not always the case due to performance optimization techniques, it's generally fair to assert that server-side actions should be used for performing heavier computations in order for them to take place faster. 

Benefits of Backend Workflows

Backend workflows provide opportunities to optimize your application and ensure it runs faster. This allows your users to have a better experience when visiting your site and potentially rank higher on search engines. While not every workflow should be a backend workflow, there are some benefits to running them when it makes sense, let's explore those benefits:

  • Backend workflows work great when you need to either process or manipulate a large amount of data in your Bubble apps. 
  • Execute repetitive workflows at certain intervals
  • Scheduled actions such as charging users after a trial ends and sending reminders for example
  • These workflows run in the server, freeing browser resources to execute other tasks such as navigation. 

Are API workflow and Backend Workflow different in Bubble?

An API workflow is a type of backend workflow that can be triggered by requesting an API endpoint URL. This means you are able to control what kind of authorization and privacy rules and protection you want to be applied to it. An API workflow allows for external clients (other than the app you’re creating) to access this data, create further operations of their own from the data, or even build new applications around your database without assistance from your team.

A backend workflow, on the other hand, encompasses all workflows created through Bubble’s Backend Workflow editor. This includes API workflows as well as custom workflows though they are not necessarily API workflows. They are designed to provide solutions over conventional web development languages like PHP or Ruby and Rails that require more time and technical knowledge to configure. They are often written with “human-readable” logic and are conveniently modularized so that they can be easily edited for future changes in politics or business procedures—making them invaluable for modern businesses that need to act quickly in order to adjust to changing dynamics of the market.

How do you enable backend workflows in Bubble.io?

Enabling backend workflows on Bubble is easy and straightforward. To do so, users must go to the Settings tab and select API, then click 'Enable Workflow API and Backend Workflows'. This will allow you to access the fully featured capabilities of Bubble, enabling powerful automation that's sure to make your project easier to manage in the long run!

How do you create a backend workflow in Bubble.io?

Creating a backend workflow in Bubble starts by going to the pages dropdown menu at the top of the app builder and clicking Backend Workflows.

There, you can create a workflow for which you have 4 options:

  • New API workflow
  • New Recurring event
  • New database trigger event 
  • Create a custom event

How to trigger a backend workflow in Bubble

There are many ways you can trigger backend workflows in your application. Depending the type of workflow you selected in the previous step are the options you will have. More than likely the trigger will be an step within a front end workflow in your application.

To begin, simply navigate back to the design tab on your chosen page. Select the element that will serve as a trigger for your backend workflow. For example, if you have a Stories feature, similar to Snapchat, you can schedule an API workflow at the creation of a story to delete the story in 24 hours. In this case:

  1. When you navigate to the workflow for the Create button
  2. Create a new action
  3. Hover over Custom Events
  4. Select the "Schedule API Workflow" action

From here, you can select the backend API you wish to trigger and configure your desired scheduled time. In this case, we're asking the workflow to delete the story in 24 hours. You can see the screenshot below for reference on how it's set up.

With these few simple steps, your backend process is now ready to go -- doing all the necessary work conveniently in the background as your users continue their experience with your app.

Canceling a scheduled workflow in Bubble

Bubble has made it easy to cancel any scheduled workflow execution. All you need to do is to find the scheduled API Workflow in the Logs tab.  From there, you can cancel a specific workflow once it's been scheduled or all at once. You could also pause them so you can execute them manually at a later time. 

You could also set up a front-end workflow to cancel a specific backend workflow that has been scheduled by creating a step in a workflow and asking it to Cancel a scheduled API Workflow. It'll request the workflow ID which once again can be found in the Logs tab.

Lastly, you could also 'Cancel a list of scheduled API Workflows' which allows you to cancel multiple future executions at once. This option will require you a list of the canceling workflows.

Canceling a scheduled workflow in Bubble is incredibly convenient and time-saving. Whether setting up workflows in advance or just wanting to avoid being up late or early modifying multiple requests each time they need to be modified, canceling future workflows makes the process quicker and easier. It's important to keep records of all your previous workflow IDs so that you can use them reliably when needed - otherwise, new requests need to be set up manually all over again.

The 'Schedule API Workflow' action returns an ID. This ID can be used to abort a scheduled workflow.

More Posts