# Create a playbook

> Build an OpenCTI playbook that triages new reports for the team, test it, offer it on chosen entities, and duplicate, export or import playbooks, including from the XTM Hub.

- URL: https://filigran.io/docs/lts/7.260811-lts/opencti/use/automate/playbooks/create/
- Products: OpenCTI 7.260811.0-lts.1
- OpenCTI line: 7.260811 LTS · 7.260811.0-lts.1
- Edition: requires an Enterprise Edition license
- For: CTI team leads, CTI analysts, administrators
- Type: How-to guide

This page builds a playbook that triages every new hospitality report for your team: it marks the report as in progress, assigns it to the analyst on duty and alerts the CTI analysts, so no report waits unnoticed. The same steps build any playbook. The page then covers testing, offering a playbook on chosen entities, and moving playbooks between platforms. If you are new to playbooks, read [Automate with playbooks](https://filigran.io/docs/lts/7.260811-lts/opencti/use/automate/playbooks/) first for how data flows through them and what to decide before you build.

## Before you start {#before-you-start}

- Your platform has an Enterprise Edition license.
- Your role has the **Manage Playbooks** capability, and **Create / Update knowledge** to see the buttons that create or import a playbook. Users who enroll entities in playbooks need **Use Playbooks**.
- You know what should start the playbook, which data it may change and who must be told. The [component chooser](https://filigran.io/docs/lts/7.260811-lts/opencti/use/automate/playbooks/choose-a-component/) maps common tasks to components.
- The values the playbook sets exist on the platform: the status in the [workflow](https://filigran.io/docs/lts/7.260811-lts/opencti/use/automate/entity-workflows/) of the entity type, the labels, the users or groups to assign or notify.

## Build and start a playbook {#build-and-start-a-playbook}

1. Open **Data > Processing > Automation** and click **Create Playbook**.
2. Give the playbook a name and a description that says what it does, then click **Create**. The playbook opens on an empty canvas, stopped.

   ![The Create a playbook panel with an empty Name field, an empty Description field, and the Cancel and Create buttons.](https://filigran.io/docs/shots/c7b728ffc828678c3da5830c86fedf72f02730a74c330f6862b2e3598ceed28f.webp)

3. Open the list of entry points from the middle of the empty canvas.

   *(OpenCTI before 7.261119)*

   Click **Add component**.

   Choose **Listen knowledge events**, **Listen PIR events**, **Query knowledge on a regular basis** or **Available for manual enrollment / trigger**, and set its filters so the playbook only runs on the data you mean; the [filter key reference](https://filigran.io/docs/lts/7.260811-lts/reference/opencti/filter-keys/) lists the keys and operators they accept.

   ![The Add component panel listing the four entry points under Start Playbook: manual enrollment, knowledge events, PIR events and scheduled knowledge queries.](https://filigran.io/docs/shots/48dd3163203abc4ead9338885d3d849786a380a0af36484ab35cdac1bfa3231a.webp)

4. Add the steps that filter, enrich or change the data. On the canvas:

   *(OpenCTI before 7.261119)*

   - to add a step after a component, click **Add component** under its output;
   - to insert a step between two components, click the **+** on the link between them;
   - to start a second branch from the same output, click **Add a sibling node**, the arrow at the bottom-right of a component;
   - to swap a component for another, open its menu and choose **Replace**.

   ![The Add component panel opened after an entry point, listing the components that transform, enrich, share and end a playbook.](https://filigran.io/docs/shots/f90daa31320d2517419b06ee6d5d7df26dd431e67c73cc1b03000b0745f172e7.webp)

5. End every branch. Use **Send for ingestion** wherever the playbook changed data, otherwise the changes are lost. Add **Send to notifier** or **Send email from template** where people should be told. To both save and notify, add a sibling branch.

   ![The out output of Mark as in progress splits into two branches: one ends with Send for ingestion, the other with Notify the CTI team.](https://filigran.io/docs/shots/4cb3a78ae1afd03bb2e1ab1dfd7cafa9300c3bf8add9e3fc8590af4bc93417bb.webp)

6. Open the menu next to the playbook name, choose **Start** and confirm. The header shows **Playbook is running**. From now on, every matching event runs it.

**Example: Triage new hospitality reports automatically**

Barbara leads the CTI team of Example CERT. Every new report labelled `hotel-sector` must be marked as in progress, assigned to the analyst on duty this week, Ana Duval, and announced to the CTI analysts. She creates the playbook `Triage new hospitality reports` with four components:

| Component | Name on the canvas | Settings |
| --- | --- | --- |
| **Listen knowledge events** | `Listen to new reports` | **create** on, **update** and **delete** off. **Filters**: **Entity type** = Report and **Label** = `hotel-sector` |
| **Manipulate knowledge** | `Mark as in progress` | Scope left on the main element, the report. First action: **Action type** **Replace**, **Field** **Status**, value `IN_PROGRESS`. Second action, with **Add action**: **Add**, **Assignees**, `Ana Duval` |
| **Send for ingestion** | `Send for ingestion` | No settings. Linked to the output of `Mark as in progress` |
| **Send to notifier** | `Notify the CTI team` | **Notifiers**: **User interface**. **Authorized members**: the **CTI analysts** group. Added with **Add a sibling node** on `Send for ingestion`, so both branches start from the output of `Mark as in progress` |

When a partner publishes a report with the `hotel-sector` label, the report is saved with the `IN_PROGRESS` status and Ana Duval as assignee, and every CTI analyst gets an alert in the platform. A report without the label does not start the playbook. When the duty changes, Barbara replaces `Ana Duval` in the second action.

*(OpenCTI 7.260811 and later)*

> **With XTM One: Hand the result to XTM One**
>
> An AI agent can take on a step that is hard to express as filters, such as reading a report's description. Insert **Transform with AI agent** between the entry point and the next step: the agent returns the bundle, changed or not, and the playbook carries on.
>
> For example, to catch the hospitality reports that partners forget to label, the triage playbook above listens to every new report (**Filters**: **Entity type** = Report only), then runs a `Classify hospitality reports` step:
>
> - **AI agent**: the STIX transformation agent of your XTM One catalog; the list only offers agents that return a STIX bundle
> - **Run as**: the `playbook-automation` service account, so the work is not tied to a person who may leave
> - **Additional instructions (optional, prepended to the STIX bundle)**: `Add the label hotel-sector to the report when its description is about hotels, hotel booking systems or hotel front desks. Change nothing else.`
>
> Its `out` output leads to a **Match knowledge** step on **Label** = `hotel-sector`, followed by `Mark as in progress` as above; its `unmodified` output ends there. Each run uses your XTM One quota. To end a branch with an agent instead, for example to have it post a summary, use **Send to AI agent**. See the [component reference](https://filigran.io/docs/lts/7.260811-lts/reference/opencti/playbook-components/#playbook-ai-agent-transform-component).

## Check that it works {#check-that-it-works}

1. Before you start the playbook, add a filter on **Creator** set to your own user to its entry point, so other people's data does not trigger it while you test.
2. Create or update an entity that matches the entry point filters, for example a test report with the `hotel-sector` label.
3. Open the execution traces of the playbook and check that every step ran. See [Monitor and troubleshoot](https://filigran.io/docs/lts/7.260811-lts/opencti/use/automate/playbooks/monitor/) if a step is missing or red.
4. Remove the **Creator** filter. The playbook now runs on everyone's data.

## Run a playbook on selected entities {#run-a-playbook-on-selected-entities}

Some actions are a choice for an analyst, not a rule: open a case for this report, send these IP addresses to a sandbox. Offer them as a playbook that analysts with **Use Playbooks** run on the entities they pick.

*(OpenCTI 7.260811 and later)*

A playbook appears in the **Enroll in playbook** list of an entity when it is running and either starts with **Available for manual enrollment / trigger**, or starts with **Listen knowledge events** with filters that match the entity and its `canEnrollManually` switch on (the default). The settings panel of the entry point shows this switch under its technical name. Turn it off for a playbook that must only react to events, so analysts cannot run it by hand.

1. Open the entity, open its actions menu (⋮) and choose **Enroll in playbook**. To enroll many entities at once, select them in any list and use the same action in the toolbar.
2. Choose the playbook. It runs on each entity as its main element.

![The Available playbooks panel lists the running playbooks with a manual or event entry point that match the entity, each with a run button.](https://filigran.io/docs/shots/819592e29d5803b4ce580052d01808368fdc75976d4a48f99e70fd0a88eee3da.webp)

To offer a playbook on any entity, leave the entry point filters empty and put a **Match knowledge** step right after it.

## Duplicate, export and import {#duplicate-export-and-import}

**Duplicate** a playbook to start a variant: in the list, open the row menu and choose **Duplicate**. The same action exists inside an open playbook.

**Export** a playbook to move it to another platform or to attach it to a support request: open the row menu and choose **Export**. You get a JSON file.

**Import** it on the target platform with **Import playbook** in **Data > Processing > Automation**. An imported playbook is stopped. Before you start it, check that everything it refers to exists on this platform, because missing objects show as deleted:

| Where | What to check |
| --- | --- |
| Filters of entry points, Match knowledge, Reduce knowledge and Manipulate knowledge | Labels, vocabularies, marking definitions, specific entities or observables, authors and creators |
| Enrich through connector | The connector exists and is running. Its ID is in the URL of its monitoring page |
| Container wrapper | The case template and its task templates |
| Send to notifier, Send email from template | The notifier or email template, and every recipient |

### From the XTM Hub {#from-the-xtm-hub}

The XTM Hub hosts ready-made playbooks. Click **Import from Hub** in **Data > Processing > Automation** to browse them; the button only shows when your platform can reach the XTM Hub. If your platform is [connected to the XTM Hub](https://filigran.io/docs/lts/7.260811-lts/opencti/configure/xtm-hub/), you can also deploy a playbook from the Hub in one click and land on it in OpenCTI. Either way, the playbook arrives stopped: check it as above, then start it. [XTM Hub content](https://filigran.io/docs/lts/7.260811-lts/opencti/configure/xtm-hub/content-library/) explains how deployment works.

## Design tips {#design-tips}

- **Notify groups, not people.** A notifier or an assignment aimed at a group follows the duty rota when its members change; one aimed at a person needs an edit each time.
- **Chain playbooks with labels.** A first playbook adds a label such as `weekly-digest`; a scheduled second playbook collects everything with that label into a report.
- **Filter early.** Put **Match knowledge** or **Reduce knowledge** before connectors and rules, which fail on elements outside their scope.

## What's next {#what-s-next}

- [Monitor and troubleshoot](https://filigran.io/docs/lts/7.260811-lts/opencti/use/automate/playbooks/monitor/) your playbook once it runs.
- [Playbook components reference](https://filigran.io/docs/lts/7.260811-lts/reference/opencti/playbook-components/) for every setting.
