# Different SenderId on ListNotificationsAsync & socket.ReceivedNotification

**URL:** <https://forum.heroiclabs.com/t/different-senderid-on-listnotificationsasync-socket-receivednotification/4840>\
**Category:** Game Design\
**Tags:** sdk-unity, chat\
**Created:** [January 5, 2024, 7:05pm UTC](https://forum.heroiclabs.com/t/different-senderid-on-listnotificationsasync-socket-receivednotification/4840 "2024-01-05T19:05:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrez9](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/mrez9/32/2002_2.png) [@mrez9](https://forum.heroiclabs.com/u/mrez9)\
**Post date:** [January 5, 2024, 7:05pm UTC](https://forum.heroiclabs.com/t/different-senderid-on-listnotificationsasync-socket-receivednotification/4840/1 "2024-01-05T19:05:26Z")

</div>

whenever an online player receive chat message from a channel that is not joined yet, receive this notification from `socket.ReceivedNotification`:

```auto
Notification Received, code:-1, SenderId:[otherPlayerUserId], subject:[otherPlayerUsername] wants to chat, content:{"username":"[otherPlayerUsername]"}

```

but when player tries to get notifications with `ListNotificationsAsync` (for example after connection) the same notification is:

```auto
Notification Received, code:-1, senderId:[SelfUserId], subject:[otherPlayerUsername] wants to chat, content:{"username": "[otherPlayerUsername]"}

```

i want to get otherPlayerUserId on getting notification by `ListNotificationsAsync`, for now i have to use `client.GetUsersAsync` for each notification with code -1 to join chat with him on direct message scenario.  
Nakama Version: 3.17.1+258a7f35

---

<div class="post-metadata">

**Author:** ![spaceniki](https://avatars.discourse-cdn.com/v4/letter/s/9fc348/32.png) [@spaceniki](https://forum.heroiclabs.com/u/spaceniki)\
**Post date:** [April 20, 2024, 2:09pm UTC](https://forum.heroiclabs.com/t/different-senderid-on-listnotificationsasync-socket-receivednotification/4840/2 "2024-04-20T14:09:20Z")

</div>

1. explore filtering the notifications based on specific criteria. Here’s an approach:

- Implement a check on the notification’s `content` field when using `ListNotificationsAsync`. Look for the presence of the `"username"` key and extract the actual username from the content.
- If the `content` field has a `"username"` key, proceed with identifying the other player and handling the join request logic.
- If the notification isn’t related to a join request (doesn’t have a `"username"` key), handle it as a standard notification from another user.

**Example Code (Filtering Approach):**

async Task HandleNotifications()  
{  
var notifications = await client.ListNotificationsAsync();  
foreach (var notification in notifications)  
{  
if (notification.Code == -1 && notification.Content.TryGetValue(“username”, out string username))  
{  
// Other player is trying to join a chat you’re not in  
// Extract otherPlayerUserId from notification or other logic  
// Handle the join request logic (e.g., join the channel)  
}  
else  
{  
// Standard notification from another user  
// Handle the notification based on its content  
}  
}  
}

If your holiday is gaming, and this is PoE, then you are very lucky that I am here, and I advise you to use [this service](https://boosthive.eu/service/mirror-of-kalandra) to boost you everything you can want in PoE, quickly and ultra-reliably, because the service has almost 5 thousand positive reviews!!!
