Notification payload returning targetName as "undefined" for mentions

We are seeing an issue with the notification tray history endpoint where mention notifications sometimes return targetName as ”undefined”, which also causes the description field to read awkwardly (e.g., “UserX has mentioned you in a comment in undefined”)

Here’s an example payload from our environment:

{
 "targetType": "comment",
  "verb": "mention",
  "targetName": "undefined",
  "parentTargetType": "post",
  "parentTargetId": "6862fd41020414d0a3f769d5",
  "targetId": "68b8a91565078eda567a5637",
  "actors": [{ "name": "TheWatchGuy" }],
  "description": "TheWatchGuy has mentioned you in a comment in undefined."
}

For comparison, here’s a case where it works correctly

{
  "targetType": "comment",
  "verb": "mention",
  "targetName": "Wrist Time",
  "parentTargetType": "post",
  "parentTargetId": "68a5d533de362aeea9ec6a01",
  "targetId": "68b88fac65078eda56775163",
  "actors": [{ "name": "MicroRotor7482" }],
  "description": "MicroRotor7482 has mentioned you in a comment in Wrist Time."
}

Questions:

  1. Is targetName supposed to always resolve to the post/community name for mention notifications?
  2. is there a recommended workaround to ensure description doesn’t come back with ”undefined”?

Thanks in advance!

Hello @abrown1916 , Thank you for raising this issue and for providing the payload examples.

Our team suggests using the following endpoint instead for more reliable results:
:backhand_index_pointing_right: Notification Tray API