> For the complete documentation index, see [llms.txt](https://codemash.gitbook.io/codemash/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://codemash.gitbook.io/codemash/cloud/files/triggers.md).

# Triggers

Run an action every time a file is uploaded or deleted — in every folder, or in one folder only.

**Where:** Files → Triggers · `/projects/<project>/files/triggers`

{% hint style="info" %}
This is the Files version of Triggers. The rules that are the same in every module are on the [Triggers](/codemash/cloud/concepts/triggers.md) concept page.
{% endhint %}

A **files trigger** runs an action every time a file is uploaded or deleted — for example it emails the catalog team when a new file lands in the `catalog` folder. The list is titled **File Triggers**.

<figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-626cd380ac7fda191e12c7556e5989e915ede8aa%2Ftriggers-list-1.png?alt=media" alt="File Triggers list: Tell the catalog team (When uploaded, Send Email, Yes), Tell support about deleted files (When deleted, Send Email, Yes), Temp trigger (When uploaded, Send Email, Yes)"><figcaption><p>File Triggers with real rows.</p></figcaption></figure>

## Columns, search and filters

| Column       | What it shows                                                                         |
| ------------ | ------------------------------------------------------------------------------------- |
| Trigger Name | The name; click it to edit.                                                           |
| When         | The event: **When uploaded** or **When deleted**.                                     |
| What         | The action, for example **Send Email**.                                               |
| Enabled      | **Yes** or **No**. A trigger whose last run could not send shows **Needs attention**. |

No search and no filters, and the list does not show the folder a trigger watches — open the trigger to see it. The events and their webhook names: `OnFileUploaded` (`files.file.uploaded`) and `OnFileDeleted` (`files.file.deleted`). The text at the top of the list also names "modification"; there is no such event.

## What you can do here

* [Create a trigger](/codemash/cloud/files/triggers/new.md) — pick the event, the folder and the action.
* [Edit a trigger](/codemash/cloud/files/triggers/edit.md) — change the folder, the action, the recipients and the template tokens.
* [Enable or disable a trigger](/codemash/cloud/files/triggers/enable.md)
* [Delete a trigger](/codemash/cloud/files/triggers/delete.md)

## Do it from code

```ts
const { list } = await norbix.hub.files.getFilesTriggers();
console.log(list.items.map((t) => `${t.viewId} ${t.name} ${t.type} folder=${t.folder ?? ''} enabled=${t.isEnabled}`));
// [ 'trg_1DvMA9Nn07AFouYobkEHUA Tell the catalog team OnFileUploaded folder=catalog enabled=true',
//   'trg_7ThVAcuyPV2TNuI0iwl7Qf Tell support about deleted files OnFileDeleted folder= enabled=true' ]
```

```sh
norbix hub files triggers get
```

The client setup is on the [Files page](/codemash/cloud/files.md#use-it-from-code). API: [Get Files Triggers](/codemash/api-reference/files/triggers/get-files-triggers.md)
