# Service trigger

## Introduction

The **trigger** tab is used to define how and when a service is triggered to run and synchronise data:

<figure><img src="/files/BcQ3cf3FRyQVrwQMtCzz" alt=""><figcaption></figcaption></figure>

Two trigger types are available:

* [Schedule](#trigger-schedule)
* [Webhook](#trigger-webhook)

## Trigger schedule

Trigger **schedule** options are used to schedule the associated service to run at a specified frequency and/or time. Here, you can use intuitive selection options to define your requirements or - if you are familiar with regular expressions - use advanced options to build your own expression:&#x20;

<figure><img src="/files/uq3X8fDp0aPzjjM7u9qV" alt=""><figcaption></figcaption></figure>

Notes to help you use these settings are below:

<table><thead><tr><th width="100">#</th><th>Name</th><th>Summary</th></tr></thead><tbody><tr><td>1</td><td>Preset</td><td>Use this option to select a predefined time period (e.g. every 2 hours). Even if you don't see the exact period that you'd like, choose something similar and then update the <a data-footnote-ref href="#user-content-fn-1"><strong>minutes</strong>, <strong>hours</strong> and <strong>days</strong> fields further down</a>.</td></tr><tr><td>2</td><td>Advanced</td><td>If you are familiar with regular expressions, you can select this option to activate the <a data-footnote-ref href="#user-content-fn-2"><strong>expression</strong> field beneath</a> and enter your required expression directly. When an expression is entered in this way, you'll notice that the selection fields below update to match the expression. If you are NOT familiar with regular expressions, don't worry! You can simply ignore this field and continue building your schedule using selection options.</td></tr><tr><td>3</td><td>Expression</td><td>With the <a data-footnote-ref href="#user-content-fn-3"><strong>advanced</strong> checkbox</a> selected, you can enter a regular expression directly. Otherwise, this field updates automatically as you make schedule selections.</td></tr><tr><td>4</td><td>Minutes, hours, days</td><td>By default, these fields are set to reflect whatever <a data-footnote-ref href="#user-content-fn-4"><strong>preset</strong></a> is selected. You can change these as needed.</td></tr><tr><td>5</td><td>Months &#x26; days of week</td><td>By default, all months and all days of the week are selected (so the service would run every day of the week, every month of the year). You can check/uncheck these fields as needed. </td></tr><tr><td>6</td><td>Updated schedule</td><td>This field updates automatically, showing any selections as a regular expression - it cannot be changed manually.</td></tr><tr><td>7</td><td>Summary</td><td>A summary if your schedule settings is displayed in readable text form, so you can confirm that your selections are correct.</td></tr></tbody></table>

## Trigger webhook

Trigger **webhook** options are used to trigger the associated service to run when a defined webhook receives events.

[^1]: See item 4 in the screenshot [above](#trigger-schedule).

[^2]: See item 3 in the screenshot [above](#trigger-schedule).

[^3]: See item 2 in the screenshot [above](#trigger-schedule).

[^4]: See item 1 in the screenshot [above](#trigger-schedule).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.wearepatchworks.com/product-documentation/patchworks-services/working-with-services/the-anatomy-of-a-service/service-trigger.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
