In my instance of Marketing Cloud, our contact Key is a Person Contact ID from our Salesforce Service Cloud org. These values are 18 characters. When a person uses their mobile device to opt-in to SMS, a contact is created with their mobile phone number as the contact key (since their phone doesn't know their Person Contact ID). I am creating a process to fix these contacts, but I first need a way to get all the contacts with bad contact keys.
I am trying to use the /contacts/v1/attributes/search
REST API, but there seems to be very poor documentation about the ConditionSet. Simply, I want to get all contacts where Contact.Contact Key
Equals MobileConnect Demographics.Mobile Number
.
{
"request": {
"attributes": [
{
"key": "MobileConnect Demographics.Mobile Number"
},
{
"key": "Contact.Contact ID"
},
{
"key": "Contact.Contact Key"
}
]
},
"conditionSet": {
"operator": "And",
"conditionSets": [],
"conditions": [{
"attribute": {
"key": "Contact.Contact Key"
},
"operator": "Equals",
"value": {
"items": ["MobileConnect Demographics.Mobile Number"],
"isAttribute": true
}
}]
}
}
Unfortunately, I get the following error when I try this:
{
"page": 0,
"pageSize": 0,
"count": 0,
"links": {},
"requestServiceMessageID": "743ff7a8-874e-47ac-9be3-de924cf4a323",
"resultMessages": [
{
"resultType": "Validation",
"resultClass": "Error",
"resultCode": "InvalidAttribute",
"message": "Data Type 'Phone' for Referenced Attribute 'Mobile Number' in Value for Attribute 'Contact Key' must be Text."
},
{
"resultType": "Validation",
"resultClass": "Error",
"resultCode": "ValueNotAllowed",
"message": "Value 'null' used for Attribute with DefinitionID 'd94f7d4d-dbe3-e611-9fee-00110a67f371' is not valid for Data Type 'Text' and Operator 'Equal'."
}
],
"serviceMessageID": "16c874c4-f5f6-45b1-b990-47bf1bcf4d82"
}
Any ideas or thoughts on how to solve this? I've tried a number of alternates and none seem to work.
ConditionSet
.