# Configure Event Triggers

Stacksync lets you trigger custom workflows in real time when your data is created, updated, or deleted. When a data event happens and matches your custom filters, an HTTP request (or Database query) is sent to the endpoint of your choice.

* The triggered HTTP endpoint can be anything from an AWS Lambda function, a Zapier or Make workflow, or any other API endpoint.
* The triggered database query can target systems such as Postgres, Snowflake, BigQuery, DynamoDB, MongoDB, and more.

This guide illustrates how to create a trigger within a sync.

## Create a trigger

### 1. First, go to your Stacksync dashboard

[**https://app.stacksync.com**](https://app.stacksync.com)

### 2. Open a sync

<figure><img src="https://2867423571-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfJjIdV9cuW6K8asJjTPJ%2Fuploads%2FXAq2yRP2PRKLx9iDAOIV%2F1%20(2).png?alt=media&#x26;token=4bd6af34-262f-4db6-a6a9-0ba9d97d0c37" alt=""><figcaption><p>Open a sync</p></figcaption></figure>

### 3. Click "Create trigger"

<figure><img src="https://2867423571-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfJjIdV9cuW6K8asJjTPJ%2Fuploads%2FHWm69JAT5wIQbjnA17wy%2F2%20(1).png?alt=media&#x26;token=1e00d90a-934e-46f8-9e9a-2b357f5b30bc" alt=""><figcaption><p>Click "Create trigger" button</p></figcaption></figure>

### 4. Configure your trigger

<figure><img src="https://2867423571-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfJjIdV9cuW6K8asJjTPJ%2Fuploads%2FYrjU9Q4uk1noWgyfShsh%2F3%20(2).png?alt=media&#x26;token=46d40a66-f0fa-48d0-bc09-cd7da9215ae8" alt=""><figcaption><p>Example of trigger configuration</p></figcaption></figure>

<figure><img src="https://2867423571-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfJjIdV9cuW6K8asJjTPJ%2Fuploads%2FmEKXkmCYoOlODbseKklV%2F4.png?alt=media&#x26;token=cd384bca-1afc-4a79-a15f-06c3f9744ac9" alt=""><figcaption><p>Example configuration of Webhook in a trigger</p></figcaption></figure>

<figure><img src="https://2867423571-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfJjIdV9cuW6K8asJjTPJ%2Fuploads%2FsZVzbckkM6MmZd8bKxen%2F5.png?alt=media&#x26;token=18aae2a9-a4dd-4ffb-b7a3-03639e26de1e" alt=""><figcaption><p>Example configuration of DB query in a trigger</p></figcaption></figure>

Below is an explanation of every configuration parameter:

<details>

<summary>From app... [app_1, app_2]</summary>

This let's you choose which app should be watched for actions. For instance, if your sync is between Salesforce and Postgres and you create a trigger to be fired when a record is created **from app \[Salesforce],** this means that the trigger will only fire up when a record is created in Salesforce but not when a record is created in Postgres.

</details>

<details>

<summary>Conditional filter based on record values</summary>

You filter can contain zero (no conditions) or many conditions. The no-code editor lets you create any sort of custom logics in a "drag and drop" fashion.

Need any help or have a feedback? Drop your question at <hello@stacksync.com>.

</details>

<details>

<summary>CURL to be executed</summary>

This field is a full CURL as you know it from the open source project <https://curl.se/>

You can include any authentication, parameters, turn the POST into a GET request or anything else. The CURL will just get executed **as is**, we will not run any checks on your behalf. If the API call fails or timeouts, the failure will not stop the execution of other triggers as every trigger will be fired up independently.

We recommend to keep the CURL as a POST request.

The **payload** is also fully customizable. For example, add some additional custom parameters in the JSON body as follows:

```url
curl --request POST \
--url https://{YOUR_URL_HERE} \
--header 'Content-Type: application/json' \
--data '{ "record": "<<record>>", "my param": "my value", "my number": 1234 }'
```

If you need a utility to setup and test your requests and payloads, feel free to use the sandbox in our free and secure webhook  utility [**my.hookforce.app**](https://my.hookforce.app/)**.**

</details>

{% hint style="info" %}
If you need a free and secure sandbox to test your HTTP webhooks, check out Stacksync's free sandbox at [**my.hookforce.app**.](https://my.hookforce.app/)

![](https://2867423571-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfJjIdV9cuW6K8asJjTPJ%2Fuploads%2FNhyQzbu5s0qa7EHh9TSt%2Fimage.png?alt=media\&token=948ea405-37c3-4e7f-8a15-1043380fcc81)
{% endhint %}

<details>

<summary>Select Column Name Source for the JSON payload</summary>

When you sync data between your apps, apps will not always have the same schema and therefore column names. For instance, your column `first_name` in your CRM could be `user_first_name` in your database. Stacksync lets you choose which field names should be used for the data included in the JSON payload.

![](https://2867423571-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfJjIdV9cuW6K8asJjTPJ%2Fuploads%2FxCQ67h1CRwplAxV3fBSU%2Fimage.png?alt=media\&token=cf272889-2e54-4777-a647-889dd7c800ee)

In this example, selecting "Salesforce" will use field names from your Salesforce app.

</details>

<details>

<summary>Do not fire up trigger when all the changes belong to a given list of fields</summary>

Some Systems such as HubSpot do have frequently changing system fields that might fire trigger execution when you do not want it.

![](https://2867423571-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfJjIdV9cuW6K8asJjTPJ%2Fuploads%2FvtiKv1YsVsOTrDU7NnTu%2Fimage.png?alt=media\&token=db071d82-fcf3-4476-983c-bdacc4d4a592)

You can choose a *list of fields to ignore*. This means that if the **all the fields that changed in a record** belong to fields in this list, then the **trigger will NOT fire**.

For instance, let's assume you decide to ignore changes in columns `lastModifiedTime` and `PhoneNumber` (i.e. these fields are included in the *list of fields to ignore*).

* If only the column `lastModifiedTime` was updated, the trigger will NOT fire.&#x20;
* If the columns `lastModifiedTime` and `PhoneNumber` were updated, the trigger will NOT fire.
* If the columns `lastModifiedTime` and `Address` were updated, the trigger WILL fire since a field that does not belong to the *list of fields to ignore* was updated.

<mark style="background-color:green;">Good to know 💡:</mark>

* Fields included in the *list of fields to ignore* can still be used in all of your filters and conditions.
* The execution of a trigger remains subject to match all of the filters and conditions (if any) that you have defined for that trigger. So when at least one field not in the *list of fields to ignore* is updated, the data will still be evaluated against your filters and conditions as usual.

</details>

### 5. Click "Create trigger"

Once your configuration is done, click "Create trigger" to start sending data to your HTTP endpoint.

<figure><img src="https://2867423571-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfJjIdV9cuW6K8asJjTPJ%2Fuploads%2FkujtrCWcarDbmnjKLSOA%2F6.png?alt=media&#x26;token=2aa3dc10-3b6c-41bc-9221-ddc5bddd9c08" alt=""><figcaption><p>Click "Create trigger"</p></figcaption></figure>

{% hint style="info" %}
Created, Updated, or Deleted triggers can take up to a minute to propagate and start responding.
{% endhint %}

That's it! 🎉 You created a trigger!

## Pause a trigger

Pausing a trigger will stop its execution until you resume the trigger.

<figure><img src="https://2867423571-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfJjIdV9cuW6K8asJjTPJ%2Fuploads%2FD7eKKIftaSMiqTAxs1Cz%2F7%20(1).png?alt=media&#x26;token=4e31bbbd-b045-4ab7-8a2a-684178bb3336" alt=""><figcaption><p>Pause a trigger</p></figcaption></figure>

## Edit a trigger

Editing a trigger is easy, it follows the same procedure as creating one, but you first need to select the trigger you want to edit.

<figure><img src="https://2867423571-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfJjIdV9cuW6K8asJjTPJ%2Fuploads%2FlV1WL5XLawAZ7PxBGSAK%2F8.png?alt=media&#x26;token=1fcb3c86-8fe1-4ad5-b677-eb728399a339" alt=""><figcaption><p>Edit a trigger</p></figcaption></figure>

You can then follow our [Create a trigger](#create-a-trigger) guide to edit your trigger.

## Remove a trigger

Simply click on the bin icon to remove a trigger.

<figure><img src="https://2867423571-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfJjIdV9cuW6K8asJjTPJ%2Fuploads%2F8jMoT3NtUThLqLixhLVD%2F9%20(2).png?alt=media&#x26;token=2c9f2898-3b16-4ebd-a299-ecfea0220287" alt=""><figcaption><p>Click the bin icon to remove a trigger.</p></figcaption></figure>

That’s it for triggers! Stacksync’s simple no-code editor lets you greatly simplify your backend and create as many triggers as you want. No limits!

Learn more by visiting our full trigger documentation at [event-triggers](https://docs.stacksync.com/two-way-sync/features/event-triggers "mention")
