1

Our requirement is to send alert (push) + Inbox message to the end users by creating a mobile optimized cloudpage in SFMC. However, when the message is being sent from SFMC, there is no way for our App development team to identify the message in the notification payload and mattch the message from the inbox message dictionary. We were told that there were two ways of doing this:

  1. Use markMessageReadOnInboxNotificationOpen for Android, but it can only support the scenario of landing the user onto the message detail page and mark it as "Read" but later when the sfmc_getAllMessages is executed, the message is coming back to be "Unread". On the other hand, this SDK initialization is not at all available for iOS.

  2. Our App development team was able to provide the notification payload and inbox message dictionary with the list of all messages.

Notification payload:

    {
  {
    "alert" :{
        "body": "Test message4"
        "title": "Test 4"
    },
    "badge": 4,
    "mutable-content" = 1,
    "sound": "default"
},
"_h": "7TJjhewRYOd3EhbugJuGlQAAAAAA",
"_mt": 8,
"_sid": "SFMC",
"_m": "MTg4MToxMTQ6MA", //Is this not Message Id?
"Preview": "Preview message4",
"_x": "https://xxxxxxxxxxxxxxxxxxxxx.pub.s10.sfmc-content.com/1l0431wxtia",
"_r": 7d65e0e0-4e4b-4c20-827c-32862feca3ad" // This is request id.
}

Inbox Message Dictionary:

{
        alert = "Test message4";
        contentType = 2;
        deleted = 0;
        endDateUtc = "2021-03-04 11:51:00 +0000";
        id = MTg4MToxMTQ6MDo0T0JsZlV0T0lFeUNmREtHTC15anJR;// This is message id not matching
        keys =         (
                        {
                key = Preview;
                value = "Preview message4";
            }
       );
        messageDeleted = 0;
        messageHash = 7TJjhewRYOd3EhbugJuGlQAAAAAA;
        name = "";
        read = 0;
        requestId = "7d65e0e0-4e4b-4c20-827c-32862feca3ad"; // THIS IS MATCHING
        sendDateUtc = "2021-02-04 10:54:00 +0000";
        sound = default;
        startDateUtc = "2021-02-04 06:00:00 +0000";
        statusDirty = 0;
        subject = "Test subject3";
        title = "Test 4";
        url = "https://xxxxxxxxxxxxxxxxxx.pub.s10.sfmc-content.com/1l0431wxtia";
   }

Here are some major questions with respect to second option outlined:

  • As per Salesforce, the message_id (i.e. Id) in the inbox message dictionary should match with "_m" in the notification payload which is not the case above. What could be the reason for it?

  • If message id can't be used to recognize and match the message, can we use "request_id" matching with "_r" parameter in the notification payload?

  • Is there any other way of achieving this? (please note custom keys is not an option here because that could be manually updated value)

Any insights or pointers on this is highly appreciated.

1
  • How are you able to get notification payload and inbox message dictionary Commented Mar 7, 2022 at 18:42

1 Answer 1

0

If you are seeing a disparity between the value sent in the notification and the value you see in the downloaded message then you will have to Base64 decode the Message ID to break it down into its component parts. This will give you the Message ID as the first segment from the notification and the downloaded message.

For instance:

atob('MTg4MToxMTQ6MA')
"1881:114:0"
atob('MTg4MToxMTQ6MDo0T0JsZlV0T0lFeUNmREtHTC15anJR')
"1881:114:0:4OBlfUtOIEyCfDKGL-yjrQ"

1881:114:0 is what you would key off of.

Question: are your messages set to "replace"?

4
  • Thanks Bill for your response! This definitely could be a possible solution however there were few challenges that I see with this. If we decode both "_m" and "Id" values, we should decode the Id's in the entire inbox message object to identify the "_m" value from the payload which could degrade the performance. Instead, we have the "requestID" parameter which is readily available without a need for decode, do you know if we can leverage this value? Last but not least, the value you've shown above '1881:114:0' is remaining the same when I test it by modifying the _m and Id values. Thx!
    – KV_
    Commented Feb 10, 2021 at 0:40
  • requestId is not part of the public API and could break your implementation in the future. I don't like the solution I proposed at all, but it is a way you could get it to work.
    – Bill Mote
    Commented Feb 10, 2021 at 2:48
  • Got it! The other option we were exploring is to add a custom key in SFMC MobilePush interface and match it in the payload and the inbox message dictionary but the only problem there is that the SFMC user should input that custom key as unique which is manual and prone to errors. Also in your comment above, you asked a question about "replace", can you elaborate your question please?
    – KV_
    Commented Feb 10, 2021 at 17:43
  • Inbox messages can "replace" messages or create net-new messages. This is largely an option for API created messages where the root ID is unchanging.
    – Bill Mote
    Commented Feb 11, 2021 at 15:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .