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?