Merge profile based on 2 property in Apache-Unomi

620 Views Asked by At

I am trying to build an customize logic in action for profile merging, can anybody suggest me how to create a rule where I can merge profile based on email and phone-number, as of now I am able to do with only one property value email. you can find the sample rule below in code :

  "metadata": {
    "id": "exampleLogin",
    "name": "Example Login",
    "description": "Copy event properties to profile properties on login"
  },
  "condition": {
    "parameterValues": {
      "subConditions": [
        {
          "type": "eventTypeCondition",
          "parameterValues": {
            "eventTypeId": "click"
          }
        }
      ],
      "operator": "and"
    },
    "type": "booleanCondition"
  },
  "actions": [

    {
      "parameterValues": {
        "mergeProfilePropertyValue": "eventProperty::target.properties(email)",
        "mergeProfilePropertyName": "mergeIdentifier"
      },
      "type": "mergeProfilesOnPropertyAction"
    },
    {
      "parameterValues": {
      },
      "type": "allEventToProfilePropertiesAction"
    }
  ]
} 
1

There are 1 best solutions below

0
On

In order to be able to merge based on multiple identifiers you would have to extend the default built-in action to support that.

This can be done by creating a module but it will require some Java knowledge since this is how Unomi is implemented.

The code for the default merge action is available here: https://github.com/apache/unomi/blob/master/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/actions/MergeProfilesOnPropertyAction.java