Merge Users
The Merge User API merges two users in MoEngage based on their ID. ID is a client-defined identifier for a user. This API can be used when multiple profiles have been created for a single user. For example, a user registered once with a mobile number and once with an email id can be merged. Duplicate users created due to integration or tech issues can also be merged.
- Default or normal merge
- MoEngage merges users with the same ID
- Happens automatically, and no action is required from your side.
- Manual merge
- MoEngage merges users having different IDs
- Does not happen automatically; the Merge User API needs to be called with the list of users to be merged along with their IDs.
- Retained User- This is the user that is retained in the system. The merged user’s attributes and associated devices are mapped to the retained user post-merge. Reachability calculation is done for the retained user based on the devices. All of the user attributes of the merged user are moved to the retained user. If an attribute is present for the retained user and the same attribute is not for the merged user, the attribute is retained for the retained user.
- Merged user- All the data of this user will merge into the retained user. Merged users will be deleted after 30 days of inactivity. If MoEngage receives any event or user property for the merged user after the merging activity, the merged user will not be deleted. The following happens in MoEngage post-user merging:
- In the user profile, all events of the last 30 days are moved from the merged user to the retained user.
- Segmentation and campaign have moved all of the data from merged user to retained user.
- Will the merged user information be available after using this API?
- What will happen to the reachability of the retained user?
- Can any two users be merged?
- Should both users have a device attached to them before merging?
- Is there any restriction on the number of times a user can be merged?
- Is there any restriction on the number of devices a merged/retained should have?
- What happens to the
merged_userafter the merge?
retained_user, and all the events and user details of merged_user will reflect on the retained_user. A merge event MOE_USER_MERGE_EVENT will be added to the merged_user (who will only have the MoEngage ID now).
- What happens to
retained_userafter the merge?
retained_user will now have all the user, device, and event details of merged_user along with details of retained_user, MOE_USER_MERGED will be added to retained_user.
-
What happens if a user creation request comes with the same
IDas the deleted user (which is deleted after the merge)? We will create a new user with thatID, but the MoEngageIDof this user will be different as compared to the deleted user.- What happens to the reachability if both users do not have devices?
- What is the SLA to see user details reflect after the merge?
- How are events copied from the merged user to the retained user?
Authorizations
This authentication parameter, used for access control, must be passed along with the request. The API request will be authenticated through Basic Authentication. Basic Authentication sends a Base64-encoded string containing your username and password with every API request. It encodes a 'username:password' string in Base64 and appends the encoded string with 'Basic '. This string is included in the authorization header as shown below:
{"Authorization: Basic Base64_ENCODED_WORKSPACEID_APIKEY=="}
The username and password details can be obtained from the MoEngage Dashboard. If you're using the API for the first time, follow these steps:
- Navigate to Settings -> Account -> APIs.
- Copy the following details:
- Username: Under Workspace ID (earlier app id), click the copy icon to copy the username.
- Password: In the API keys section, click the copy icon in the Data tile to copy the API key.
Use these details to authenticate the API requests.
Query Parameters
This is the Workspace ID of your MoEngage account that has to be passed along with the request. You can find your Workspace ID at Settings > Account > APIs > Workspace ID.
Body
This field contains the list of UID pairs of the users who are to be merged.
Example:
{
"merge_data": [ // All the different pairs of users to merge
{
"merged_user": "<sample_uid>", // This user will merge into below user
"retained_user": "<sample_uid>" // Above user will merge into this user
},
{
"merged_user": "<sample_uid>", // This user will merge into below user
"retained_user": "<sample_uid>" // Above user will merge into this user
}
]
}
- Every object in the Array contains a pair of UID strings - the ‘merged_user’ and the ‘retained_user’.
- UID is the unique identifier for a user maintained by you. MoEngage stores this identifier in the ID attribute in the user profile.
- If the merging of any user fails in the array, it will skip that object and continue with others.
Response
This response is returned when the request is processed successfully.
This field contains the status of the request and specifies whether the request was successful. Supported values are : "success", "failure"
"success"
This field contains “created” when there is no error in the payload, and the user merge is successful.
"created"