0

I'm using Marketing Cloud to send push notification to our Android users. I also need that the contact key is valorized as userId when the user performs the login. So in the same transaction, I update the contact key (with the user id) and another field that contains the user id too. This is the snippet of code:

MarketingCloudSdk.requestSdk {
        it.registrationManager.edit().run {
            attributesToSet.forEach { attribute ->
                setAttribute(attribute.key, attribute.value)
            }

            if (contactKey != null && contactKey.isNotBlank()) {
                setContactKey(contactKey)
            }
            commit()
        }
    }

The attributesToSet is a Map and an entry has the "user_id" as key and the user id value (e.g. 10102334) as value. The contactKey contains the user id value too.

In some rows of my Mobile Push table I see that the user_id column is valorized and the corresponding contactKey is not equal to the user id. This is strange because the updating of the contactKey and user_id columns is done in the same transaction.

Someone have any suggestions about this issue?

3

The only requirements for Contact Key are that it is not null, does not contain only whitespace characters and that it is less than 100 characters in length. We do not currently enforce the length requirement in the SDK as that could be changed server side. Also, there is a uniqueness requirement that we cannot enforce in the SDK, but that would be unrelated to your question, though I figured it was worth calling out here while documenting other requirements.

What does the output from getSdkState() show for your registrations?

You should open a support request through your account executive for this issue so that we can better assist you -- we have no known issues with Contact Key operations in the SDKs.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.