# 1.4 Setting up Callbacks for Integration activation/deactivation

## Use Cases

There are multiple use cases for setting up callbacks in Embed Flows:

* Registering/removing webhooks to trigger the Flow via webhook
* Receiving the activation state for specific Flows and users

#### Summary in 4 minutes:

{% embed url="<https://www.youtube.com/watch?v=kkbZ_kOYV9o>" %}
Callbacks and redirect\_urls for White Label Embed - Embedded iPaaS
{% endembed %}

## Setup

{% hint style="info" %}
As a prerequisite, you need to have your own Connector and edit access to it. In case you do not have either of them, please reach out to us.
{% endhint %}

1. Create a Flow that should be triggered whenever an Integration is activated and (optionally) a Flow that is triggered whenever an Integration is deactivated ("lifecycle Flows")
   1. These Flows send requests to your own Connector with callback parameters:
      1. [Example activation Flow](https://app.locoia.com/community-library?page=1\&perPage=10\&nameSearchString=White%20Label%20Embed%20Creation%20Callback%20Template%20Flow\&sortProp=reference\&sortOrder=ascending)
      2. [Example deactivation Flow](https://app.locoia.com/community-library?page=1\&perPage=10\&nameSearchString=White%20Label%20Embed%20Deletion%20Callback%20Templat\&sortProp=reference\&sortOrder=ascending)
      3. *Note*: The [JWT payload](https://docs.locoia.com/embed-white-label-portal/2.-configure-embed/embed-integration-via-sso#1.-passing-data-to-locoia) is available in these Flows and, when using the same Connector as in the Embed Flow, Authentication can be used from the Embed Flow by specifying `{{ connectorAuth }}` in the **Dynamic Authentication ID** field
2. [Create an Action](https://docs.locoia.com/connectors/building-connectors/building-connector-actions) for your Connector that is ideally called `triggered_by_embed`
   1. This action has the purpose of triggering the lifecycle flows and thus no method or endpoint needs to be specified
   2. Add the Flows you created to the **Pre Save Flow** and **On Delete Flow** fields respectively
   3. The action ideally has a password (first step of the created Flows in step #1) in order to prevent it from being used otherwise, thus the **UI Form Schema** field should be:

```json
{
  "password": {
    "type": "password",
    "title": "Password for White Label Embed Creation Callback Flow",
    "required": true
  }
}
```

<figure><img src="https://291121471-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-McrRFZHYH27bqKzOVDd%2Fuploads%2FmNs68QpHSYH0BPUU7e0u%2Fimage.png?alt=media&#x26;token=73188ff6-fadd-41a1-b8aa-190e4051a6eb" alt="" width="563"><figcaption><p>Enter <strong>Pre Save Flow</strong> and <strong>On Delete Flow</strong> into the fields</p></figcaption></figure>

3\. Use the created Action at the beginning of your Embed Flows. This way, every time one of your users activates or deactivates an Embed Flow, the lifecycle Flows will be triggered.
