# Start a task when something happens

Let a task start when a new email arrives, a calendar event is about to begin, an email is forwarded to your Bluedeer address or a web request arrives, instead of at a set time.

A task does not have to run on a clock. It can start when something happens: each event starts a run, and the task's AI receives the event together with the task's instructions. Tasks that start when something happens need a plan that includes scheduled tasks. Scheduled tasks are included on paid plans by default; your plan page shows what your plan includes. See [What limits apply to scheduled tasks?](https://support.bluedeer.ai/using-bluedeer/tasks-and-inbox/what-limits-apply-to-tasks.md)

## Choose what starts the task

Ask Bluedeer in a chat, for example "When an email from my accountant arrives, add its attachments to my Taxes folder", or change an existing task:

1. On the task's page, click **Edit**.
2. Under **Schedule**, choose **When something happens**.
3. Under **Starts when**, choose what starts the task, then fill in **Only when** if you want to narrow it down.
4. Click **Save**.

These are the things that can start a task:

- **New email in Gmail**: a message arrives in your mailbox. Drafts and mail you sent to other people don't count. The task starts only for mail that arrives after you set it up, never for mail that was already there, and it starts within a few minutes of the mail arriving.
- **Calendar event starting soon**: a timed event on your calendar is about to begin. All-day events don't start a task. An event that is moved to another time starts the task again for its new time.
- **Email forwarded to your Bluedeer address**: an email you forward is filed in the File manager. See [How do I forward email into Bluedeer?](https://support.bluedeer.ai/using-bluedeer/files/forward-email-to-bluedeer.md)
- **A web request to the task's own address (webhook)**: another service sends a request. See [Start a task from a webhook](https://support.bluedeer.ai/using-bluedeer/tasks-and-inbox/start-a-task-from-a-webhook.md).

A source you can't use yet is listed with the reason: "This workspace has this app switched off.", "Connect this app in this workspace first." or "Connect this app again to let Bluedeer read these events." The Gmail and calendar sources read the account of the person who owns the task.

## Start only for some events: "Only when"

By default every event starts the task. The fields under **Only when** narrow it down, and they depend on what you chose:

- **Email** (Gmail and forwarded email): **From**, **To**, **Subject contains** and **Has an attachment**. For Gmail there is also **Folder or label**. Spam is left out unless you choose it there.
- **Calendar event starting soon**: **Calendar**, **Title contains**, **Only events I accepted**, **At least this many people** and **Minutes before it starts**.

Leave a field empty to ignore it. The task page shows the filter in one line next to **Only when**, and it shows "Every event" when there is none.

## Group events into one run

By default each event starts its own run. Under **Group events over (seconds, optional)**, enter a number of seconds, and events that arrive within that time of the first one start one run together. The editor says so, for example "Events within 5 minutes of the first one start one run together."

## See why a run started

On the task page, **Schedule** reads like "When: New email in Gmail, grouped over 5 minutes". In **Run history**, a run that an event started says why, for example "Started because of New email: From Dana Lee: Invoice 1042, and 2 more events." Times in it, such as a calendar event's start, are shown in your own time zone and in the date and time style of your device. The event's own words show only to people who are allowed to see that event.

## When these tasks pause, and what limits apply

- **The app is gone.** If you disconnect the app, its sign-in stops working or the workspace switches it off, the task pauses by itself. It starts again by itself once you can use the app again.
- **The plan stops covering it.** A failed payment puts your plan on hold at once, and tasks that start when something happens pause at once, not at their next run. They start again by themselves when the payment succeeds or the plan returns. A task you paused yourself stays paused.
- **Plan limits.** How many of these tasks you can keep active, and how many runs events can start in 24 hours, depend on your plan: see [What limits apply to scheduled tasks?](https://support.bluedeer.ai/using-bluedeer/tasks-and-inbox/what-limits-apply-to-tasks.md). A run over the daily limit isn't run. **Run history** lists it as **Limit reached**.

Your workspace's rules, and the actions that need permission or an approver, apply to runs that an event starts just as they do to any other run. See [Let a scheduled task use your connectors](https://support.bluedeer.ai/using-bluedeer/tasks-and-inbox/let-a-scheduled-task-use-your-connectors.md).
