# Merge

### **When to Use the Merge Component?**

Use the Merge component when you need to:

* Combine outputs from two or more previous steps
* Bring data back into one path after branches
* Append or merge lists into a single list for next steps

## **How to Configure the Merge Component?**

### **Step 1: Add and Name the Merge Component**

* Add the **Merge** component to your flow

<figure><img src="https://1255842839-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3iSr2Tx8FvvuoLPncziH%2Fuploads%2FFZ65dfaDRVSrcblW7sP0%2Fimage.png?alt=media&#x26;token=4481218c-1aa4-4b18-a043-6ec2f403a0f6" alt=""><figcaption></figcaption></figure>

* Give it a clear and descriptive name based on what you're merging\
  \&#xNAN;*(e.g., “MergeOutputandTokens”)*

This helps in identifying the merged output in the next steps.

### **Example Use Case**

You previously had:

* A **Loop Over Webhooks** step → produced a list
* A **Slack – Generate Token** step → produced token headers

<figure><img src="https://1255842839-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3iSr2Tx8FvvuoLPncziH%2Fuploads%2FiGYOqJixpJxzNsCWcMrK%2Fimage.png?alt=media&#x26;token=68e243d6-7828-42f6-9300-1f9c860fbd2a" alt=""><figcaption></figcaption></figure>

After adding the Merge step, both outputs will be taken as inputs

* Strategy selected: **Append**
* The outputs are merged into one unified list

This lets you work with one combined result rather than handling two separate values.

{% hint style="info" %}
When merging lists, ensure that **both lists follow the same format.** This ensures the merge works correctly, and you can map the merged data without issues
{% endhint %}

### **Step 2: Select the Input Lists to Merge**

You will see fields to add the inputs you want to merge:

* Enter the reference for each list you want to merge\
  e.g.:
  * `{{steps.loopOverWebhooks.output}}`
  * `{{steps.generateToken.headers}}`

<figure><img src="https://1255842839-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3iSr2Tx8FvvuoLPncziH%2Fuploads%2FdeWX0JdcsAS6f7HDg441%2Fimage.png?alt=media&#x26;token=c0bc2904-95dd-4a21-a62b-7a7544cf3b9c" alt=""><figcaption></figcaption></figure>

> Add or remove fields using the icons on the right, based on how many sources you are merging.

### **Step 3: Choose the Merge Strategy**

You must select how the lists should be merged. For example:

* **Append** → Appends the lists in order, combining them into one list

<figure><img src="https://1255842839-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3iSr2Tx8FvvuoLPncziH%2Fuploads%2FDYPLrzbDGjCGvpY93pR4%2Fimage.png?alt=media&#x26;token=161e0510-46db-4ec8-8da8-256719989e1c" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
*This means list items from the second input will be added after the first list.*
{% endhint %}

### **Step 4: Set the Number of Sources**

* Specify the number of sources you are merging

> Add or remove the source fields to match this count

<figure><img src="https://1255842839-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3iSr2Tx8FvvuoLPncziH%2Fuploads%2FR3gtIGIPQateSuy5Tzwb%2Fimage.png?alt=media&#x26;token=e29f8bb7-36ef-4bf1-9222-72452dd081a3" alt=""><figcaption></figcaption></figure>

### **Step 5: Add a Success Message to Display Output**

Once your merge is complete:

* Add a **Success Message** component at the end of the flow
* Output the merged value inside this step
* Run the flow to confirm it executes successfully

<figure><img src="https://1255842839-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3iSr2Tx8FvvuoLPncziH%2Fuploads%2FxDK4ztavdKCx9Fdzje9S%2Fimage.png?alt=media&#x26;token=033e070f-955b-41de-acbe-8ed50ecb2060" alt=""><figcaption></figcaption></figure>

> This will allow you to view both merged values clearly in the final output of the flow.
