> For the complete documentation index, see [llms.txt](https://manual.bubble.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://manual.bubble.io/help-guides/logic/workflows/events/backend-events.md).

# Backend events

Backend events run workflows on Bubble's server, even when nobody has your app open. Learn how to trigger them on a schedule, from another app, when data changes, or at an interval.

Backend events are triggers that happen on Bubble's **server** instead of on a page. Because the server is always running, backend events can start workflows even when nobody has your app open: at 3 AM on a Sunday, when another system sends a request, or the moment a record in your database changes.

There are several ways to trigger a backend event:

<table><thead><tr><th width="211.83203125">Trigger</th><th>What happens</th><th>What you use</th></tr></thead><tbody><tr><td>At a specific time</td><td>A workflow runs at a date and time you choose</td><td>The <strong>Schedule API workflow</strong> action</td></tr><tr><td>From an external app</td><td>Another app or service sends a request that starts a workflow</td><td>A public API workflow</td></tr><tr><td>When data changes</td><td>A workflow runs when a change in the database matches your conditions</td><td>A database trigger event</td></tr><tr><td>At an interval</td><td>A workflow repeats daily, weekly, monthly, and so on</td><td>A recurring event or a recursive workflow</td></tr><tr><td>From another workflow in your app</td><td>A workflow runs on the server and hands back a result</td><td>A <a href="/help-guides/logic/workflows/events/backend-events/backend-custom-events.md">backend custom event</a></td></tr><tr><td>From a billing update</td><td>Apple or Google sends an update about a subscription in your native mobile app</td><td>An <a href="/core-resources/events/in-app-purchase-events.md">in-app purchase event</a></td></tr></tbody></table>

All backend events are set up in the **Backend workflows** tab:

<figure><img src="https://34394582-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M5sbzwG7CljeZdkntrL%2Fuploads%2FbkEH3xurb9lHUIzY0wUq%2Fbackend-workflows-tab.png?alt=media&amp;token=7917618d-8d0e-49b2-9bd8-2029ecc52886" alt=""><figcaption></figcaption></figure>

***

## How backend events differ from frontend events

The difference comes down to *where the trigger happens*. A frontend event happens on a page, and a backend event happens on Bubble's server, without involving the user's device at all. A page stops doing any work as soon as it's closed, but the server keeps running around the clock.

**Article section:** [Frontend and backend events](/help-guides/logic/workflows/events.md#frontend-and-backend-events)

***

## Triggering a workflow at a specific time

You can schedule a workflow to run at a specific date and time. This is part of the [Workflow API](#user-content-fn-1)[^1], and it's a great fit for things like reminder emails, expiring trial accounts, or following up with a user a few days after they sign up.

{% stepper %}
{% step %}

#### Create the API workflow

In the **Backend workflows** tab, create a new [API workflow](#user-content-fn-2)[^2] and give it a descriptive name. Add the actions you want to run when the time comes.

If the workflow needs data to work with, such as the user to email or the booking to update, add it as a parameter.
{% endstep %}

{% step %}

#### Schedule the workflow

In any workflow, on a page or in the backend, add the **Schedule API workflow** action. Pick the API workflow you just created, and set *Scheduled date* to when it should run.

For example, to send a reminder 24 hours before a booking starts, you could set the scheduled date to `This Booking's Start date +(hours): -24`.

If the API workflow has parameters, fill them in here.
{% endstep %}

{% step %}

#### Check that it's scheduled

Open the **Logs** tab and go to the **Scheduler** section to see upcoming scheduled workflows. From here you can confirm that the workflow is queued for the right time.
{% endstep %}
{% endstepper %}

{% hint style="info" %}
The *scheduling* isn't the event. The event happens when the workflow actually runs at the scheduled time. That means you can schedule a workflow from the frontend, but the workflow itself still runs on the server, even if the user has closed your app by then.
{% endhint %}

**Article:** [The Workflow API](/help-guides/integrations/api/the-bubble-api/the-workflow-api.md) (start here if you're new to the Workflow API)\
**Article:** [Creating API workflows](/help-guides/integrations/api/the-bubble-api/the-workflow-api/api-workflows/creating-api-workflows.md)\
**Article:** [Scheduling API workflows](/help-guides/integrations/api/the-bubble-api/the-workflow-api/api-workflows/scheduling-api-workflows.md)

***

## Triggering a workflow from an external app

The Workflow API also lets other apps and services start workflows in your app. For example, a payment provider can notify your app when a payment goes through, or an automation tool can create records in your database.

{% stepper %}
{% step %}

#### Create the API workflow

In the **Backend workflows** tab, create a new API workflow and add the actions you want to run. Add parameters for any data the external app will send.
{% endstep %}

{% step %}

#### Expose the workflow

In the workflow property editor, check *Expose as a public API workflow*. This gives the workflow its own endpoint that external apps can send requests to.
{% endstep %}

{% step %}

#### Find the endpoint URL

The endpoint follows this format:

| Version     | URL                                                                   |
| ----------- | --------------------------------------------------------------------- |
| Live        | `https://yourapp.bubbleapps.io/api/1.1/wf/workflow-name`              |
| Development | `https://yourapp.bubbleapps.io/version-test/api/1.1/wf/workflow-name` |

If your app uses a custom domain, replace `yourapp.bubbleapps.io` with your domain.
{% endstep %}

{% step %}

#### Send a request from the external app

Set up the external app to send a request to the endpoint, including any parameters the workflow expects. When Bubble receives the request, the workflow runs.
{% endstep %}
{% endstepper %}

{% hint style="warning" %}
By default, external apps need to authenticate to run a public API workflow. If you check *This workflow can be run without authentication*, anyone who knows the endpoint URL can trigger it. Only use this option when the workflow is safe to run for anyone, and consider adding conditions that check the incoming data.
{% endhint %}

**Article:** [The Workflow API](/help-guides/integrations/api/the-bubble-api/the-workflow-api.md)\
**Article:** [Creating API workflows](/help-guides/integrations/api/the-bubble-api/the-workflow-api/api-workflows/creating-api-workflows.md)

***

## Triggering a workflow when data changes

[Database trigger events](#user-content-fn-3)[^3] watch your database and run a workflow whenever a change matches the conditions you set. Since they react to the data itself, they run no matter where the change came from: a page, a backend workflow, an API request, or a manual edit in the **Data** tab.

For example, if you run an e-commerce app, you can use one to send a confirmation email the moment an order is completed.

**Article:** [Database trigger events](/help-guides/logic/workflows/events/backend-events/database-trigger-events.md)

***

## Running a workflow at an interval

There are two ways to run a workflow on a repeating schedule, such as once per day, week, or month:

<table><thead><tr><th width="171.37109375"></th><th>Recurring events</th><th>Recursive workflows</th></tr></thead><tbody><tr><td>How it works</td><td>Bubble runs the workflow at a set frequency</td><td>The workflow schedules itself to run again</td></tr><tr><td>Interval options</td><td>Daily, weekly, monthly, quarterly, or yearly</td><td>Any interval you can express dynamically</td></tr><tr><td>Setup</td><td>Simple</td><td>More involved</td></tr><tr><td>Workload</td><td>Predictable</td><td>Can use more workload units (WU)</td></tr></tbody></table>

### Recurring events

[Recurring events](#user-content-fn-4)[^4] are built specifically to run a workflow on a thing at a fixed frequency. You could use one to send a weekly summary to each user, or to renew a subscription every month.

A recurring event has two parts: the event itself, which holds the actions, and the **Set/cancel a recurring event** action, which starts it and tells Bubble how often to run it.

{% stepper %}
{% step %}

#### Create the recurring event

In the **Backend workflows** tab, create a new recurring event. Give it a name, pick the type of thing it should run on, and add the actions you want to repeat.
{% endstep %}

{% step %}

#### Start the recurring event

In any workflow, add the **Set/cancel a recurring event** action. Pick the recurring event, the thing it should run on, the frequency, and the date of the first run.

You can use the same action later to change the frequency or stop the event.
{% endstep %}
{% endstepper %}

### Recursive workflows

A recursive workflow is an API workflow that schedules itself. As one of its actions, it uses **Schedule API workflow** to schedule *the same workflow* to run again. Since you can set the next run time dynamically, you can create practically any interval, like every 90 minutes or every third business day.

{% hint style="warning" %}
A recursive workflow without a working stop condition can run indefinitely and consume a lot of WU. To protect against this, apps created on or after July 1, 2024, stop recursive workflow chains after 10 iterations by default.

If you plan to use recursion, you can set a higher limit (recommended) or turn the protection off. Otherwise, **any recursive workflow chain stops after 10 iterations.**

**Article:** [Infinite recursion protection](/help-guides/workload/tracking-workload/monitoring-workload/infinite-recursion-protection.md)
{% endhint %}

**Article:** [Recursive API workflows](/help-guides/integrations/api/the-bubble-api/the-workflow-api/api-workflows/recursive-api-workflows.md)

***

## Overriding time zones

{% hint style="info" %}
To override time zones in the backend, you first need to check *Enable timezone override controls* in the **Settings** tab, under **General**.

**Reference:** [Enable timezone override controls](/core-resources/application-settings/general.md#enable-timezone-override-controls)
{% endhint %}

When a backend workflow runs, Bubble uses a time zone to interpret dates and times. Some backend events let you override that time zone with a static or dynamic choice:

<table><thead><tr><th width="222.4921875">Event</th><th>What the override replaces</th></tr></thead><tbody><tr><td>API workflows</td><td>The time zone of the API request</td></tr><tr><td>Recurring events</td><td>The time zone the recurring event was first scheduled in</td></tr><tr><td>Database trigger events</td><td>The time zone of the user who made the change</td></tr></tbody></table>

Overriding the time zone helps your app parse and store dates consistently. For example:

<table><thead><tr><th>Time zone used</th><th width="127.2734375">Input</th><th>Saved as</th></tr></thead><tbody><tr><td>Default (the user is in Eastern Time)</td><td>1/1/2000</td><td>1/1/2000 12 AM Eastern Time</td></tr><tr><td>Overridden to Pacific Time</td><td>1/1/2000</td><td>1/1/2000 12 AM Pacific Time</td></tr></tbody></table>

This can be useful when:

| Scenario                                                      | How the override helps                                                                              |
| ------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
| An external API request includes a timestamp but no time zone | You can set the time zone when the request is received, so the timestamp is parsed correctly        |
| A scheduled appointment needs to stay in one time zone        | If a user in Tokyo books a conference in London, your app can use London time instead of Tokyo time |

{% hint style="info" %}
You can also override time zones on individual input forms and on pages.

**Reference:** [Input forms](/core-resources/elements/input-forms.md)\
**Reference:** [The page element](/core-resources/elements/page-element.md#time-zone-selection)
{% endhint %}

***

## Other ways to learn

**Article:** [API workflows](/help-guides/integrations/api/the-bubble-api/the-workflow-api/api-workflows.md)\
**Article:** [Backend custom events](/help-guides/logic/workflows/events/backend-events/backend-custom-events.md)\
**Reference:** [Recurring event](/core-resources/events/recurring-event.md)

***

## Build backend events with Bubble AI

You can ask the [Bubble AI Agent](/help-guides/ai/bubble-ai-agent.md) to create and edit [backend workflows](/help-guides/ai/bubble-ai-agent/edit-apps-with-ai.md#generate-and-modify-backend-workflows). It can set up an API workflow or a scheduled workflow, add parameters and conditions, build recursive workflows, and connect a backend workflow to a button with the **Schedule API workflow** action. Open the **Backend workflows** tab to see what it built.

The Agent declines very complex workflows, and it can't build custom events, payment actions, or analytics actions in backend workflows. It also can't run or test a workflow for you. Database trigger events aren't on its list of supported tasks, but it can explain how to set one up.

Here are a few prompts to try:

{% code overflow="wrap" %}

```
Create a backend API workflow named publish-post with a parameter for post. The workflow should change the published field on the post to yes.
```

{% endcode %}

{% code overflow="wrap" %}

```
Create a backend workflow named weekly-reset that runs every Friday.
```

{% endcode %}

{% code overflow="wrap" %}

```
Create a workflow on the Publish post button on the dashboard page that triggers the publish-post backend workflow. Use the parent group's post as the post parameter.
```

{% endcode %}

{% code overflow="wrap" %}

```
Explain how to set up a database trigger event that runs when an order is completed.
```

{% endcode %}

**Article:** [Edit apps with AI](/help-guides/ai/bubble-ai-agent/edit-apps-with-ai.md)

***

## FAQ: Backend events

<details>

<summary>Do backend events run when nobody is using my app?</summary>

Yes. They run on Bubble's server, so they don't depend on anyone having your app open.

</details>

<details>

<summary>Can I use backend events on the Free plan?</summary>

You can use backend workflows on the Free plan, but you need to turn them on first, and some operations, such as API calls and emails, have limits meant for testing.

**Article section:** [Enabling backend workflows](/help-guides/logic/the-frontend-and-backend.md#enabling-backend-workflows)

</details>

<details>

<summary>How do I check whether a workflow is scheduled?</summary>

Open the **Logs** tab and go to the **Scheduler** section to see upcoming scheduled workflows.

</details>

<details>

<summary>Why did my recursive workflow stop after 10 runs?</summary>

That's probably infinite recursion protection. Apps created on or after July 1, 2024, stop recursive workflow chains after 10 iterations by default. You can set a higher limit or turn the protection off.

**Article:** [Infinite recursion protection](/help-guides/workload/tracking-workload/monitoring-workload/infinite-recursion-protection.md)

</details>

<details>

<summary>Do backend events use workload?</summary>

Yes. Work done on Bubble's server uses workload, so the actions in a backend workflow add to it. Recursive workflows can use more workload than recurring events.

**Article series:** [Optimizing workload](/help-guides/workload/optimizing-workload.md)

</details>

<details>

<summary>Can anyone trigger my API workflows?</summary>

By default, external apps need to authenticate to run a public API workflow. If you check *This workflow can be run without authentication*, anyone who knows the endpoint URL can trigger it.

**Article section:** [Triggering a workflow from an external app](#triggering-a-workflow-from-an-external-app)

</details>

<details>

<summary>Do backend events work with native mobile apps?</summary>

Yes. If your project has both a web app and a native mobile app, they share the same backend.

</details>

[^1]: The Workflow API is the part of Bubble's built-in API that lets you set up workflows that can be triggered by an external app or system through an API request, or scheduled from within your app.\
    **Article:** [The Workflow API](/help-guides/integrations/api/the-bubble-api/the-workflow-api.md)\
    **Reference:** [The Workflow API](/core-resources/api/the-bubble-api/the-workflow-api.md)

[^2]: API workflows are server-side workflows that you can schedule from within your app, or expose so that an external app or system can trigger them through an API request. API workflows are part of the Workflow API.\
    **Article:** [API workflows](/help-guides/integrations/api/the-bubble-api/the-workflow-api/api-workflows.md)

[^3]: Database trigger events are backend events that watch for specific changes in the database and run a workflow when a change matches their conditions.\
    **Article:** [Database trigger events](/help-guides/logic/workflows/events/backend-events/database-trigger-events.md)

[^4]: Recurring events are backend events that run a workflow on a thing at a fixed interval, such as once per day or once per week.\
    **Reference:** [Recurring event](/core-resources/events/recurring-event.md)
