# MoEngage

Easily synchronize user segments from MoEngage to Apxor

### Prerequisites: <a href="#id-6ce55d5a-a1e9-456d-8172-153c8d629f23" id="id-6ce55d5a-a1e9-456d-8172-153c8d629f23"></a>

* MoEngage Account
* Segments that you want to send to Apxor

## 1. Create a Custom Destination

### **Step 1:** Open the Moengage dashboard and hover on the left panel

* Click on <mark style="color:red;">`App Marketplace`</mark>

<figure><img src="https://300211688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQuYbJ9bg7CFtrBaVp9pB%2Fuploads%2FA7rZJdS5EkxJyLj6hvpE%2FUntitled.png?alt=media&#x26;token=bccc036a-aefe-4d01-b0aa-009a0710e72d" alt=""><figcaption></figcaption></figure>

### Step 2: Scroll down and click on <mark style="color:red;">`Custom destinations`</mark>

<figure><img src="https://300211688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQuYbJ9bg7CFtrBaVp9pB%2Fuploads%2FaCyZu9iYfqxi2UlivgVg%2FUntitled%201.png?alt=media&#x26;token=8c0b8df3-2380-4e06-a560-7172294d42ae" alt=""><figcaption></figcaption></figure>

### Step 3: Click on <mark style="color:red;">`Add Custom Destination`</mark>

<figure><img src="https://300211688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQuYbJ9bg7CFtrBaVp9pB%2Fuploads%2FIUiREutdLpGQF12Ejptk%2FUntitled%202.png?alt=media&#x26;token=e203d6e2-f802-41bb-a6cc-4129477f66fb" alt=""><figcaption></figcaption></figure>

### Step 4: Give a name to the destination and click on <mark style="color:red;">`Add`</mark>

<figure><img src="https://300211688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQuYbJ9bg7CFtrBaVp9pB%2Fuploads%2F2HslBC8HGAhHxLgCbwIw%2FUntitled%203.png?alt=media&#x26;token=685c0cc0-be8c-45fb-90aa-c4ed78bd0af5" alt=""><figcaption></figcaption></figure>

## 2. Create an Integration

### **Step 1:** Click on Integrate and then select <mark style="color:red;">`+ Add Integration`</mark>

<figure><img src="https://300211688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQuYbJ9bg7CFtrBaVp9pB%2Fuploads%2FyqMNBlW2QDU3tdku3UcZ%2FUntitled%204.png?alt=media&#x26;token=b22c8809-2a96-43ec-90ec-618302eca524" alt=""><figcaption></figcaption></figure>

### Step 2: Enter a name to identify the integration

* Select the POST method
* Now, enter the URL as “\*\*<https://server.apxor.com/v1/cohorts/moe/sync/:appId**”>, where <mark style="color:red;">`appId`</mark> is the customer's unique identifier in the Apxor dashboard.

<figure><img src="https://300211688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQuYbJ9bg7CFtrBaVp9pB%2Fuploads%2Fjtwn7W9m9k4zFInnEyYO%2FUntitled%205.png?alt=media&#x26;token=822ee587-6a2a-45f3-b993-42cbe0583619" alt=""><figcaption></figcaption></figure>

### Step 3: Authentication

Under Authentication, select <mark style="color:red;">`Basic Auth`</mark> and enter **ApxCohortSync** in the *username* field and <mark style="color:red;">**`auth token`**</mark> given by the Apxor team in the *password* field.

<figure><img src="https://300211688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQuYbJ9bg7CFtrBaVp9pB%2Fuploads%2FelQMcFle6LKtbqhsDQ8g%2FUntitled%206.png?alt=media&#x26;token=e3364543-4edd-47f2-b22a-4f86bfe7ccd5" alt=""><figcaption></figcaption></figure>

### Step 4: Configure

* In **Map user identities**, set <mark style="color:red;">`Destination identifier`</mark> as **custom\_user\_id**
* In the **Request body,** change `add_users` to <mark style="color:orange;">`add_members`</mark> and `remove_users` to <mark style="color:orange;">`remove_members`</mark>
* Set the **Throttle** to **5000** users at a time

<figure><img src="https://300211688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQuYbJ9bg7CFtrBaVp9pB%2Fuploads%2FBonlq1qw3sL4p9Xd8Puu%2FUntitled%207.png?alt=media&#x26;token=b4d7f674-9274-4c5b-b6e8-428023b43bc6" alt=""><figcaption></figcaption></figure>

* The request preview should match the highlights in the snapshot below
* Click on Next

<figure><img src="https://300211688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQuYbJ9bg7CFtrBaVp9pB%2Fuploads%2FQdZddShRjnDj8gojmJ4Q%2FUntitled%208.png?alt=media&#x26;token=a2b3bb22-c8f3-45a4-87a0-675390957229" alt=""><figcaption></figcaption></figure>

### Step 5: Test

* In the test page enter a example custom\_user\_id in the **User value** and click on **test**
* The response should be **Success** with response code **200**

<figure><img src="https://300211688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQuYbJ9bg7CFtrBaVp9pB%2Fuploads%2FDgbXU2epvHX0tJON1pLy%2FUntitled%209.png?alt=media&#x26;token=87f3a66c-1c98-45be-ab3f-86124e2cb405" alt=""><figcaption></figcaption></figure>

* Click on Add integration
* Integration has been created successfully!

## 3. Segment Sync

### Step 1: Navigate to **All Segments** tab in the left panel

Navigate to **All Segments** tab in the left panel and click on the options button for the segment you want to sync and select **Sync Segment**

<figure><img src="https://300211688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQuYbJ9bg7CFtrBaVp9pB%2Fuploads%2FUeGRl7d3WFY9puQqR28g%2FUntitled%2010.png?alt=media&#x26;token=3f11237f-9e0a-412a-af1d-e2adbe4e0551" alt=""><figcaption></figcaption></figure>

### Step 2: Click on the destination dropdown

* Now click on the **Destination** drop-down and select the integration that you wish to sync with.
* You can also add a Destination and create an Integration from the **Add Destination** option in the drop-down menu. Follow the above procedures.

<figure><img src="https://300211688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQuYbJ9bg7CFtrBaVp9pB%2Fuploads%2FSf0CXYFvqfhQMOhxASAu%2FUntitled%2011.png?alt=media&#x26;token=caccbab4-e392-4f55-852b-159096b28c34" alt=""><figcaption></figcaption></figure>

* Select the sync frequency **(one-time or recurring)**, configure notification settings, and click on **Save Sync**

<figure><img src="https://300211688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQuYbJ9bg7CFtrBaVp9pB%2Fuploads%2Fibsd1i8wI7siAYeFISOl%2FUntitled%2012.png?alt=media&#x26;token=dea1a37a-96e8-44d3-ac38-a5775298fba2" alt=""><figcaption></figcaption></figure>

* The segment sync status and history can be seen on the **Segment Sync Info** page

<figure><img src="https://300211688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQuYbJ9bg7CFtrBaVp9pB%2Fuploads%2FEB1yNUjgIPkIqJhs9Ml8%2FUntitled%2013.png?alt=media&#x26;token=81f20902-6810-4716-adcf-b31a1c28b4b5" alt=""><figcaption></figcaption></figure>

* The same segment will be visible on the **Apxor** dashboard in the "**Cohorts**" tab, with the source set as "MOENGAGE". It might take up to 20 minutes for the segment to sync with Apxor on the cohorts page.
