> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getunblocked.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Routines

> Run tasks on a schedule or when triggered by events from your integrations

Use routines to automate recurring work, like sending a weekday summary of what shipped or adding context to each new issue. Each routine runs as the team member who created it, using that person's permissions.

* **Relevant context.** Each run researches across connected data sources the same way Unblocked answers a question.
* **Acts on the result.** A routine can notify the creator with its result, take actions in your integrations, or start a coding task when the work calls for a code change.

> [!WARNING]
>
> **Routines may share sensitive information**
>
> A routine uses its creator's permissions to access information and carry out its instructions. Depending on those instructions, information may be shared with people who wouldn't otherwise have access to it. To limit what a routine can read, see [Data access](#data-access).

***

## How it works

To create a routine, open **Routines** in the Unblocked web app sidebar and select **New Routine**, or start from a template. Templates fill in the name, trigger, and instructions for a common task, and you can change any of them before you save.

**1. Name the routine**

Enter a **Name** so you can recognize the routine and its results later.

**2. Add a trigger**

Under **Trigger**, select **Add** and choose what starts the routine. See [Triggers](#triggers) for the available options.

**3. Write the instructions**

In **Instructions**, describe the task and the result you want. See [Write effective instructions](#write-effective-instructions) for tips.

**4. Review data access and notifications**

Check which [data sources](#data-access) the routine can use, and choose whether you want [notifications](#notifications) when it runs.

**5. Save the routine**

Select **Save**, then confirm with **Yes, create routine**. Saving requires a name, instructions, and a trigger. The confirmation dialog reminds you that a routine can share information with people who wouldn't otherwise have access to it.

Each run creates a discussion in the creator's [questions list](https://docs.getunblocked.com/unblocked-chat/my-discussions.md), named after the routine, where they can read the answer, check the [cited sources](https://docs.getunblocked.com/unblocked-chat/cited-sources.md), or [ask a follow-up question](https://docs.getunblocked.com/unblocked-chat/asking-followups.md). To review earlier runs, open the routine and select the **Run History** tab, then select any run to open its result.

***

## Triggers

A trigger decides when a routine runs. A routine can have more than one trigger, and each one starts its own run when it fires.

### On a schedule

Choose **Hourly**, **Daily**, **Weekdays**, or **Weekly** for common schedules. For anything else, select **Custom (cron)** and enter a five-field cron expression, such as `0 */3 * * 1-5` to run every 3 hours on weekdays.

After you choose a schedule, Unblocked shows its time zone and the next run time, so you can confirm the schedule before you save.

![A weekly schedule trigger set to Monday at 9:00am PDT, with the next run time below it](https://mintcdn.com/unblocked/BrEl0z-2b8GthzBc/img/routines/schedule-trigger.png?fit=max\&auto=format\&n=BrEl0z-2b8GthzBc\&q=85\&s=5fbdafa711ab978c2290fb44434c79b8)

### Linear

Linear triggers start a run when an issue is created or a label is added in the workspace you choose:

* **Issue created**: When someone creates an issue. To run only for issues with a particular label, choose that label; otherwise the trigger uses **Any label**.
* **Label added**: When someone adds the label you choose to an issue.

You can choose either a workspace label or a team label. Each run receives the triggering issue as context, and the routine can comment on that issue. The **Triage new issues** template, for example, adds relevant context to each new issue as a comment.

> [!NOTE]
>
> Linear triggers require a [connected Linear workspace](https://docs.getunblocked.com/data-sources/linear.md) that uses the Unblocked workspace app. If your workspace uses a personal connection, [upgrade it to the workspace app](https://docs.getunblocked.com/data-sources/linear.md#upgrade-a-personal-linear-connection). Until the connection is in place, the trigger shows a **Connect** button and you can't save the routine.

### Slack

Slack triggers start a run when someone posts in the channel you choose:

* **Slack message**: When a person or another bot posts a new top-level message in the channel.

Each new top-level message starts one run, and the run receives that message as context. Thread replies, edited messages, and messages from Unblocked itself don't start a run.

> [!NOTE]
>
> Slack triggers require a [connected Slack workspace](https://docs.getunblocked.com/data-sources/slack.md). Until it is connected, the trigger shows a **Connect** button.

You can choose any public or private channel you have access to, except channels shared with another organization.

After you choose a channel, you can also choose a person from that channel in the **User** menu. The trigger then starts a run only for that person's messages. Leave it set to **Anyone** to run for every new message in the channel.

When you save the routine, the Unblocked bot joins the channel automatically. If someone removes the bot later, the trigger won't start any runs until you save the routine again, which adds the bot back.

Any routine can post in a Slack channel as the Unblocked bot, and a run started by a Slack message can also reply directly in the triggering thread. For example:

> Read the triggering message. If it asks a question, research the answer using relevant code, documents, and prior discussions. Reply in the triggering Slack thread with a short answer and source links. If the message does not need an answer, do not reply.

#### Slack limits

To protect busy channels, Slack triggers have rate limits for each channel:

* **Messages from people**: 300 an hour, with bursts of up to 30.
* **Messages from bots**: 120 an hour, with bursts of up to 20.

Each Slack workspace or Enterprise Grid organization also has an overall limit of 600 messages an hour from people and 300 from bots. When a channel goes over these limits, some messages may not start a run.

***

## What a routine can do

A routine researches across connected data sources and can take actions in your integrations, such as posting a message or commenting on an issue. Each [trigger](#triggers) section describes the actions available for that integration.

If your team uses [Unblocked Code](https://docs.getunblocked.com/unblocked-code.md), a routine can also start a coding task, and Unblocked opens a pull request when the task finishes.

Describe the action you want the routine to take in its instructions.

## Write effective instructions

Because a routine runs on its own, Unblocked can't stop to ask follow-up questions. Clear, specific instructions keep each run focused:

* **Set a time range.** Phrases like "from the past week" or "since yesterday" tell Unblocked what to cover.
* **Name the sources.** Mention the repositories, projects, channels, or documents that matter most.
* **Describe the result.** Say what you want back, such as a list of changes with links to their sources.
* **Say where to send it.** Name the destination so the result reaches the right people.
* **Say when to do nothing.** For event triggers, tell Unblocked which events don't need a response.

For example:

> Summarize new pull requests from the past week. List anything blocked or waiting for review, and what needs my attention.

***

## Data access

By default, a routine can use all the data sources its creator has access to. To narrow that down, select **Configure** under **Data Sources**, choose the data sources the routine should use, and select **Done**, then save the routine.

## Notifications

Notifications are optional, and Unblocked sends them when a run finishes. Under **Notifications**, select any of these options:

* **Send me an email notification**: Sends an excerpt of the result and a **View Thread** link to the email address you choose.
* **Send me a Slack DM**: Sends you a Slack direct message. This option appears once your team has connected a Slack workspace, and you don't need to connect a personal Slack account.

## Test a routine

If a routine has a schedule trigger, you can test it with the buttons at the bottom of the routine's settings:

* **Dry Run**: Appears for a new routine or a saved routine with unsaved changes. It runs the current instructions without saving the routine or sending notifications.
* **Run now**: Appears for a saved routine with no unsaved changes. It starts a real run, including notifications.

Both buttons open the result in a new tab.

To test non-scheduled routines that only have event triggers, cause the event yourself, such as creating an issue or posting a new top-level message that matches the trigger.

***

## Manage routines

The **Routines** page lists your routines, and you can use **Filter** to find one or sort by any column.

To edit a routine, open it, change its settings on the **Configuration** tab, and select **Save**.

To pause, resume, duplicate, or delete a routine, use the menu next to it in the list. From the routine's own page, select **Pause Routine** or **Resume Routine**, or use the page menu to **Duplicate** or **Delete** it. A paused routine doesn't run on its triggers until you resume it.

Duplicating a routine opens a copy as a new, unsaved routine, the same way a template does. Review the copy and select **Save** to create it. You become the creator of the saved copy, so it runs with your permissions.

### Routines created by other team members

Admins also see a list of **Routines Created by Other Team Members**. They can view, duplicate, pause, resume, or delete these routines, but only the creator can edit or run them. A copy includes only the data sources the admin has access to.

If [role-based access](https://docs.getunblocked.com/team-settings/role-based-access.md) is off, every team member is treated as an admin.
