Unlocking the power of Custom Events in your Bubble app's backend
Learn how to use Custom Events in Bubble to streamline backend workflows, manage complex logic, and boost app efficiency. Watch the free full video tutorial!
Happy Friday!
Welcome to this week’s NoCode SaaS newsletter, where I take you along for the ride with building a profitable SaaS business without code on Bubble.
This week I’m taking a look at something which has helped me simplify the logic in my app’s hundreds of backend workflow - Custom Events.
In traditional programming these are typically called functions - reusable bits of code which can complete a task and return data.
The insanely powerful thing about them when used with backend workflows in Bubble is how they can complete actions in the middle of a workflow which is running.
This is super helpful for things like refreshing API keys, returning data from other APIs and enriching it, and generally making your app more streamlined and easy to maintain.
Watch the Bubble Custom Events Tutorial
While Custom Events are often associated with frontend tasks, their real potential shines in managing complex logic and returning data during backend processes.
I recommend watching the video to get the full picture, but I’ve also included a written version of the tutorial below.
I hope you find this useful and give it a try - I think you’ll end up using Custom Events everywhere in your app’s backend once you give it a go!
Custom Events in Bubble Backend Workflows
Custom Events: Bubble’s Equivalent of Functions in Traditional Programming
If you’re familiar with traditional programming, think of custom events in Bubble as functions.
Just like functions in code, custom events allow you to encapsulate a set of actions or logic that you can then reuse throughout your app.
This means you can write the logic once and call it whenever you need, without duplicating code.
Why is this similarity interesting?
Modularity: Just like functions, custom events make your app more modular. You can break down complex workflows into smaller, manageable pieces that can be tested and maintained independently.
Reusability: Instead of rewriting the same logic in multiple places, you can simply call your custom event wherever it’s needed, saving time and reducing errors.
Simplified Debugging: By isolating specific logic into custom events, it’s easier to debug and optimize your app, as you can focus on one piece of functionality at a time.
Custom Events can accept any kind of data inputs, and then also output any kind of data which you can use in your workflows, just like an API Call - this is what makes them so amazing!
Why Are Custom Events So Powerful?
Efficiency: Custom events can pause your workflow, perform a task (like calling an external API), and then return the result before continuing. This makes handling complex logic much more straightforward.
Data Management: By using custom events, you can manage and manipulate data in ways that would be cumbersome with traditional workflows, all while keeping your backend organized and maintainable.
If you're looking to make your Bubble app more efficient and scalable, I highly recommend checking out the full tutorial. Trust me, once you start using custom events, you'll wonder how you ever managed without them!
In the next episode I’m going to be taking a look at some of my favourite new AI tools to use with Bubble, primarily FlowiseAI - the new nocode builder for LLM workflows. So be sure to check keep an eye out for that.
In the meantime I hope this was helpful, any questions, feedback or ideas for future episodes? Drop me a reply, I love hearing from you!
That’s it for this week, happy building!
James.
Love to see this refresh api tokens ( im going to need this for Nylas). You may have seen this but you can use the "app connector" Post here: https://forum.bubble.io/t/how-to-return-data-from-backend-api-workflows-no-manual-api-connector/306357.
And flowise with bubble is awesome, I've tested it and used it for chunking all sorts of docs and you can give long term chat history memory amongst other things
Amazing stuff, James. Thanks for creating this. Can't wait to start implementing this and can already see why you also have it on your wish list to be able to call these from the front-end!