iOS Chat SDK: Error 800130 while trying to mark message as delivered

Hello,

please help us debug a strange error we come across in our iOS app while trying to mark a chat message as delivered.

This is the notification JSON payload we receive from Sendbird:

{
    "sendbird": {
        "app_id": "XXXXXXXXX-XXXX-XXXX-XXXX-7013FFD0F2C9",
        "audience_type": "only",
        "category": "messaging:offline_notification",
        "channel": {
            "channel_url": "sendbird_group_channel_136367504_88efab5fa76ed63a79d471723850b633aa7cd697",
            "custom_type": "team_chat",
            "name": "Company BD"
        },
        "channel_type": "chat",
        "created_at": 1644565493320,
        "custom_type": "",
        "files": [],
        "mentioned_users": [],
        "message": "Hello my friend! ",
        "message_id": 6779116511,
        "push_sound": "default",
        "push_title": "<null>",
        "recipient": {
            "id": 390,
            "name": "Worker 5005",
            "push_template": "default"
        },
        "sender": {
            "id": 278,
            "name": "Owner Of 5001",
            "profile_url": "https://good-work-public-dev-bucket-2.s3.us-east-1.amazonaws.com/users/353/Bz9fsE8cGAxpOFTkcTCNZX8XrEVd8QOmDwbetxSz.jpg",
            "require_auth_for_profile_image": 0
        },
        "sqs_ts": 1644565493479,
        "translations": {},
        "type": "MESG",
        "unread_message_count": 16
    },
    "aps": {
        "alert": "Owner Of 5001: Hello my friend! ",
        "badge": 16,
        "category": "sendbird_mesg",
        "mutable-content": 1,
        "sound": "default"
    }
}

According to the instructions in Sendbird docs, we are handling it with this code found at Delivery receipt | Chat iOS SDK | Sendbird Docs

SBDMain.markAsDelivered(withRemoteNotificationPayload: bestAttemptContent.userInfo) { (error) in
    guard error == nil else {
        // Handle error. 
        // We end up here because an error 800130 is raised.
    }
    ...
}

We end up in the error handling block with this error:

(Error Domain=Invalid payload Code=800130 "Invalid payload" UserInfo={NSLocalizedDescription=Invalid payload})

As you see there’s no useful information in the error message about what exactly is wrong in the payload. We assume it expects something else but we can’t figure out what exactly?

Please give us a hint at what we are doing wrong here?

Hello @Neskodi

Are you using FCM to send a push to iOS device? Because it looks like the payload doesnt contain session_key which is required to process on iOS SDK

@Woo Thank you for the response! Indeed we don’t use FCM for notifications. We are using a p8 certificate instead. Is it possible to find this key/value elsewhere and inject into the payload manually?

I dont think that would resolve the problem since session key is not visible to public. Would you DM me your app Id and will look into it. If this payload was from the sendbird server, its something off

Oh btw did you receive this push payload while the device was on background or foreground?

or maybe your application does not turn on delivery receipt feature. Either way, DM me your application id and I will look into it! Thanks