# Notification function is lacking features

**URL:** <https://forum.heroiclabs.com/t/notification-function-is-lacking-features/5321>\
**Category:** Client Libraries\
**Created:** [June 8, 2024, 10:17am UTC](https://forum.heroiclabs.com/t/notification-function-is-lacking-features/5321 "2024-06-08T10:17:25Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![dhforever](https://avatars.discourse-cdn.com/v4/letter/d/ebca7d/32.png) [@dhforever](https://forum.heroiclabs.com/u/dhforever)\
**Post date:** [June 8, 2024, 10:17am UTC](https://forum.heroiclabs.com/t/notification-function-is-lacking-features/5321/1 "2024-06-08T10:17:25Z")

</div>

Hello Nakama team,  
I’m using Notification and discovered that the following points are not reasonable:  
In a friend’s announcement.

1. Nakama sends username notification in the Content section. However, if a user changes their username, notifications sent from this person to other users will fail because the other party only receives the username before it was changed and cannot know who it is. Why not use UserId instead of Username.
2. In Notification there is SenderId, in Nakama it is my friend’s UserId. I think the SenderId should be the person who sent the notification: for example Person A received a friend request from person B, so the SenderId should be B’s userId. but in Nakama it is A’s.  
Please help me answer.

---

<div class="post-metadata">

**Author:** ![sesposito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/sesposito/32/2594_2.png) [@sesposito](https://forum.heroiclabs.com/u/sesposito)\
**Post date:** [June 17, 2024, 12:56pm UTC](https://forum.heroiclabs.com/t/notification-function-is-lacking-features/5321/2 "2024-06-17T12:56:06Z")

</div>

Hello @dhforever,

1. You’re correct, the username can be outdated by the time the receiver reads it, this is designed as is because usernames are not expected to change frequently, in any case this can be easily overridden by the client, it can fetch the user by userId for this specific notification code, instead of relying on its content.

2. I reviewed the code and the `addFriends` API clearly sends the caller of the function in the `SenderId` of the notification, so I’m not sure how you’re observing this, can you please create a reproducible example?

Best

---

<div class="post-metadata">

**Author:** ![dhforever](https://avatars.discourse-cdn.com/v4/letter/d/ebca7d/32.png) [@dhforever](https://forum.heroiclabs.com/u/dhforever)\
**Post date:** [June 17, 2024, 1:33pm UTC](https://forum.heroiclabs.com/t/notification-function-is-lacking-features/5321/3 "2024-06-17T13:33:56Z")

</div>

Yes. Of course. Look, I’m getting a list of notifications. This is the list of notifications for adding friends. Look at the senderId that starts with the person receiving the notification.

```auto
Result: {
        "cacheable_cursor": "S_-BAwEBG25vdGlmaWNhdGlvbkNhY2hlYWJsZUN1cnNvcgH_ggABAgEOTm90aWZpY2F0aW9uSUQBCgABCkNyZWF0ZVRpbWUBBAAAAB__ggEQz01bOMfaTiS5NX553E-HjAH4L5JSwhPAhXAA",
        "notifications": [{
                    "code": -2,
                    "content": "{\"username\": \"0-username\"}",
                    "create_time": "2024-04-24T08:05:25Z",
                    "id": "6644a510-7f25-4f49-b403-3182aa4efd86",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "0-username wants to add you as a friend"
                }, {
                    "code": -2,
                    "content": "{\"username\": \"10-username\"}",
                    "create_time": "2024-04-24T08:05:41Z",
                    "id": "5bbbf840-e828-4dc4-b5b4-23ce862659d2",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "10-username wants to add you as a friend"
                }, {
                    "code": -3,
                    "content": "{\"username\": \"12-username\"}",
                    "create_time": "2024-04-24T08:05:44Z",
                    "id": "d54f505b-47c4-439d-8bd8-660a2e9a9b58",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "12-username accepted your friend request"
                }, {
                    "code": -2,
                    "content": "{\"username\": \"13-username\"}",
                    "create_time": "2024-04-24T08:05:46Z",
                    "id": "38f9e87f-a654-4d40-829d-5d96de0d1900",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "13-username wants to add you as a friend"
                }, {
                    "code": -2,
                    "content": "{\"username\": \"17-username\"}",
                    "create_time": "2024-04-24T08:05:52Z",
                    "id": "6a7f9609-6a80-4c60-ab8e-86b1742db073",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "17-username wants to add you as a friend"
                }, {
                    "code": -2,
                    "content": "{\"username\": \"23-username\"}",
                    "create_time": "2024-04-24T08:06:00Z",
                    "id": "f4d6e7e5-80e7-4da5-a15a-93db4a10e47a",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "23-username wants to add you as a friend"
                }, {
                    "code": -2,
                    "content": "{\"username\": \"25-username\"}",
                    "create_time": "2024-04-24T08:06:03Z",
                    "id": "72515f7d-22e4-494b-8d17-c878f043fe9e",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "25-username wants to add you as a friend"
                }, {
                    "code": -2,
                    "content": "{\"username\": \"29-username\"}",
                    "create_time": "2024-04-24T08:06:09Z",
                    "id": "12461ad4-8c7b-4a0b-ac44-03f1a57734e6",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "29-username wants to add you as a friend"
                }, {
                    "code": -3,
                    "content": "{\"username\": \"32-username\"}",
                    "create_time": "2024-04-24T08:06:13Z",
                    "id": "a3da747b-4f5c-4a87-81a3-f973d91d8f51",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "32-username accepted your friend request"
                }, {
                    "code": -3,
                    "content": "{\"username\": \"35-username\"}",
                    "create_time": "2024-04-24T08:06:17Z",
                    "id": "18329010-2639-460b-a76e-ece79eb5c6a1",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "35-username accepted your friend request"
                }, {
                    "code": -2,
                    "content": "{\"username\": \"37-username\"}",
                    "create_time": "2024-04-24T08:06:20Z",
                    "id": "df4fb1ef-1212-4d66-a9b7-c62e2f287488",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "37-username wants to add you as a friend"
                }, {
                    "code": -3,
                    "content": "{\"username\": \"38-username\"}",
                    "create_time": "2024-04-24T08:06:22Z",
                    "id": "14fb8c91-b430-4244-b7f8-606f03d7bc3f",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "38-username accepted your friend request"
                }, {
                    "code": -2,
                    "content": "{\"username\": \"41-username\"}",
                    "create_time": "2024-04-24T08:06:26Z",
                    "id": "9a682c06-9d41-44f3-880f-40c22a639c6a",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "41-username wants to add you as a friend"
                }, {
                    "code": -2,
                    "content": "{\"username\": \"47-username\"}",
                    "create_time": "2024-04-24T08:06:35Z",
                    "id": "d1e7b738-009d-48db-a4eb-27fc38109b4d",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "47-username wants to add you as a friend"
                }, {
                    "code": -3,
                    "content": "{\"username\": \"51-username\"}",
                    "create_time": "2024-04-24T08:06:40Z",
                    "id": "b5f38cab-7ed2-4f43-836c-b0eeec372ba3",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "51-username accepted your friend request"
                }, {
                    "code": -3,
                    "content": "{\"username\": \"52-username\"}",
                    "create_time": "2024-04-24T08:06:42Z",
                    "id": "f7069923-e679-4441-90d0-4ad1b52370e1",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "52-username accepted your friend request"
                }, {
                    "code": -2,
                    "content": "{\"username\": \"62-username\"}",
                    "create_time": "2024-04-24T08:06:56Z",
                    "id": "8851a943-beaa-469a-933a-ab8162876011",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "62-username wants to add you as a friend"
                }, {
                    "code": -2,
                    "content": "{\"username\": \"63-username\"}",
                    "create_time": "2024-04-24T08:06:58Z",
                    "id": "b80bd7e3-844d-43bb-ab4a-d9ce780bec7e",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "63-username wants to add you as a friend"
                }, {
                    "code": -2,
                    "content": "{\"username\": \"64-username\"}",
                    "create_time": "2024-04-24T08:06:59Z",
                    "id": "80e367c6-86dd-414d-843d-d9489c6eebca",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "64-username wants to add you as a friend"
                }, {
                    "code": -3,
                    "content": "{\"username\": \"67-username\"}",
                    "create_time": "2024-04-24T08:07:03Z",
                    "id": "30ad6b09-3d3b-4af1-adbb-b9e750d67c2f",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "67-username accepted your friend request"
                }, {
                    "code": -3,
                    "content": "{\"username\": \"75-username\"}",
                    "create_time": "2024-04-24T08:07:15Z",
                    "id": "684ee5a5-5399-4cd3-9208-7ad4b1d8af4b",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "75-username accepted your friend request"
                }, {
                    "code": -2,
                    "content": "{\"username\": \"77-username\"}",
                    "create_time": "2024-04-24T08:07:18Z",
                    "id": "6243a640-a944-4e70-bd7b-c8b1845c9118",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "77-username wants to add you as a friend"
                }, {
                    "code": -2,
                    "content": "{\"username\": \"80-username\"}",
                    "create_time": "2024-04-24T08:07:22Z",
                    "id": "04fc9f47-4a89-4553-a0f8-f494e90e8321",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "80-username wants to add you as a friend"
                }, {
                    "code": -2,
                    "content": "{\"username\": \"91-username\"}",
                    "create_time": "2024-04-24T08:07:37Z",
                    "id": "91a3aef5-4141-486b-b4c9-6fd8cfc137fd",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "91-username wants to add you as a friend"
                }, {
                    "code": -2,
                    "content": "{\"username\": \"97-username\"}",
                    "create_time": "2024-04-24T08:07:46Z",
                    "id": "1cbd9e72-7427-4415-a2cc-117a4b42ec03",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "97-username wants to add you as a friend"
                }, {
                    "code": -2,
                    "content": "{\"username\": \"100-username\"}",
                    "create_time": "2024-04-24T08:07:51Z",
                    "id": "9803365d-d61a-48c6-9cf9-f9ef6184c191",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "100-username wants to add you as a friend"
                }, {
                    "code": -2,
                    "content": "{\"username\": \"101-username\"}",
                    "create_time": "2024-04-24T08:07:52Z",
                    "id": "81a2c848-a5ba-48dc-9bfb-d66daba3d096",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "101-username wants to add you as a friend"
                }, {
                    "code": -3,
                    "content": "{\"username\": \"103-username\"}",
                    "create_time": "2024-04-24T08:07:55Z",
                    "id": "0faaa46e-8542-425c-90bc-393299029873",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "103-username accepted your friend request"
                }, {
                    "code": -3,
                    "content": "{\"username\": \"106-username\"}",
                    "create_time": "2024-04-24T08:08:01Z",
                    "id": "19dd122a-0001-4749-a16b-e676f834c5ce",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "106-username accepted your friend request"
                }, {
                    "code": -3,
                    "content": "{\"username\": \"108-username\"}",
                    "create_time": "2024-04-24T08:08:04Z",
                    "id": "ba29532f-fed3-447b-86b5-01851a202761",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "108-username accepted your friend request"
                }, {
                    "code": -3,
                    "content": "{\"username\": \"115-username\"}",
                    "create_time": "2024-04-24T08:08:15Z",
                    "id": "cb701f44-bf1f-475d-9f16-a7102853ae17",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "115-username accepted your friend request"
                }, {
                    "code": -3,
                    "content": "{\"username\": \"119-username\"}",
                    "create_time": "2024-04-24T08:08:21Z",
                    "id": "6b1a9811-35b4-4a38-9b13-3aeb6c53d463",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "119-username accepted your friend request"
                }, {
                    "code": -3,
                    "content": "{\"username\": \"126-username\"}",
                    "create_time": "2024-04-24T08:08:34Z",
                    "id": "3cc4ebb2-a641-4f86-8a9c-845e2ee030dd",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "126-username accepted your friend request"
                }, {
                    "code": -2,
                    "content": "{\"username\": \"133-username\"}",
                    "create_time": "2024-04-24T08:08:45Z",
                    "id": "25fc5bea-85d0-4e08-9dd4-03d07a2f0fee",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "133-username wants to add you as a friend"
                }, {
                    "code": -3,
                    "content": "{\"username\": \"135-username\"}",
                    "create_time": "2024-04-24T08:08:48Z",
                    "id": "ece123bc-4b45-443d-a132-8cb2b168b356",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "135-username accepted your friend request"
                }, {
                    "code": -3,
                    "content": "{\"username\": \"138-username\"}",
                    "create_time": "2024-04-24T08:08:52Z",
                    "id": "7fc2e2f1-8e92-47fd-8e41-af3b99991a53",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "138-username accepted your friend request"
                }, {
                    "code": -2,
                    "content": "{\"username\": \"139-username\"}",
                    "create_time": "2024-04-24T08:08:54Z",
                    "id": "8317e790-3ad3-48d9-b5f6-7af5d95ea1f6",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "139-username wants to add you as a friend"
                }, {
                    "code": -2,
                    "content": "{\"username\": \"152-username\"}",
                    "create_time": "2024-04-24T08:09:13Z",
                    "id": "63c3a2e6-4780-40bb-be61-8fc2d6d6942e",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "152-username wants to add you as a friend"
                }, {
                    "code": -3,
                    "content": "{\"username\": \"155-username\"}",
                    "create_time": "2024-04-24T08:09:18Z",
                    "id": "cff34c52-e40e-44ff-b8c9-e85e0ea7ea9a",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "155-username accepted your friend request"
                }, {
                    "code": -2,
                    "content": "{\"username\": \"157-username\"}",
                    "create_time": "2024-04-24T08:09:21Z",
                    "id": "1d9a0af7-d96b-4f8c-98df-7186704c04dc",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "157-username wants to add you as a friend"
                }, {
                    "code": -2,
                    "content": "{\"username\": \"160-username\"}",
                    "create_time": "2024-04-24T08:09:25Z",
                    "id": "d439c064-4d5f-4120-abb2-70811b0ac4c7",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "160-username wants to add you as a friend"
                }, {
                    "code": -2,
                    "content": "{\"username\": \"162-username\"}",
                    "create_time": "2024-04-24T08:09:28Z",
                    "id": "e38be443-076c-4927-b35e-49a9377b6434",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "162-username wants to add you as a friend"
                }, {
                    "code": -2,
                    "content": "{\"username\": \"163-username\"}",
                    "create_time": "2024-04-24T08:09:29Z",
                    "id": "b69da501-8578-430a-88fb-7ac02f295498",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "163-username wants to add you as a friend"
                }, {
                    "code": -3,
                    "content": "{\"username\": \"173-username\"}",
                    "create_time": "2024-04-24T08:09:44Z",
                    "id": "3d20ce9f-4505-4903-9ffa-bdab9195f488",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "173-username accepted your friend request"
                }, {
                    "code": -3,
                    "content": "{\"username\": \"175-username\"}",
                    "create_time": "2024-04-24T08:09:46Z",
                    "id": "bad698ce-4a88-427f-9a13-d0fd99eee0a2",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "175-username accepted your friend request"
                }, {
                    "code": -2,
                    "content": "{\"username\": \"176-username\"}",
                    "create_time": "2024-04-24T08:09:48Z",
                    "id": "4cd34237-f404-4a3b-afdc-489c83c95655",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "176-username wants to add you as a friend"
                }, {
                    "code": -2,
                    "content": "{\"username\": \"188-username\"}",
                    "create_time": "2024-04-24T08:10:05Z",
                    "id": "3fb6e725-8e01-4717-8f3b-68ea7030d93c",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "188-username wants to add you as a friend"
                }, {
                    "code": -2,
                    "content": "{\"username\": \"189-username\"}",
                    "create_time": "2024-04-24T08:10:07Z",
                    "id": "ebdffea1-8e23-452f-9b8a-eacebc00f24f",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "189-username wants to add you as a friend"
                }, {
                    "code": -3,
                    "content": "{\"username\": \"190-username\"}",
                    "create_time": "2024-04-24T08:10:08Z",
                    "id": "fba7dd8f-f6a5-4862-a6c5-35e2c2f2b3da",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "190-username accepted your friend request"
                }, {
                    "code": -2,
                    "content": "{\"username\": \"193-username\"}",
                    "create_time": "2024-04-24T08:10:13Z",
                    "id": "d093c90d-9a82-4871-a3b4-3e3745610fea",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "193-username wants to add you as a friend"
                }, {
                    "code": -3,
                    "content": "{\"username\": \"194-username\"}",
                    "create_time": "2024-04-24T08:10:14Z",
                    "id": "aead65a7-2f29-4a8d-a0a1-211ad19d392b",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "194-username accepted your friend request"
                }, {
                    "code": -3,
                    "content": "{\"username\": \"201-username\"}",
                    "create_time": "2024-04-24T08:10:24Z",
                    "id": "fa84c833-2450-45d5-afbc-1c82e61215e2",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "201-username accepted your friend request"
                }, {
                    "code": -3,
                    "content": "{\"username\": \"203-username\"}",
                    "create_time": "2024-04-24T08:10:27Z",
                    "id": "41c77d24-67cb-4022-b5c2-412bc9b3d3e3",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "203-username accepted your friend request"
                }, {
                    "code": -3,
                    "content": "{\"username\": \"208-username\"}",
                    "create_time": "2024-04-24T08:10:35Z",
                    "id": "3b129183-52c3-4aa0-8424-6fe9c015ae3e",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "208-username accepted your friend request"
                }, {
                    "code": -2,
                    "content": "{\"username\": \"212-username\"}",
                    "create_time": "2024-04-24T08:10:40Z",
                    "id": "019b96e9-ef5f-42be-a588-f3fef2ee678b",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "212-username wants to add you as a friend"
                }, {
                    "code": -2,
                    "content": "{\"username\": \"215-username\"}",
                    "create_time": "2024-04-24T08:10:45Z",
                    "id": "4d7b46c9-1eee-4745-b8a3-7977fda0f87f",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "215-username wants to add you as a friend"
                }, {
                    "code": -2,
                    "content": "{\"username\": \"216-username\"}",
                    "create_time": "2024-04-24T08:10:46Z",
                    "id": "25336c14-3540-4293-acad-9155d42ca499",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "216-username wants to add you as a friend"
                }, {
                    "code": -3,
                    "content": "{\"username\": \"233-username\"}",
                    "create_time": "2024-04-24T08:11:12Z",
                    "id": "2d346aa9-ef60-42ba-850b-3d79d5828283",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "233-username accepted your friend request"
                }, {
                    "code": -3,
                    "content": "{\"username\": \"239-username\"}",
                    "create_time": "2024-04-24T08:11:21Z",
                    "id": "1150bee6-6f42-4645-9ab4-d75608998013",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "239-username accepted your friend request"
                }, {
                    "code": -3,
                    "content": "{\"username\": \"245-username\"}",
                    "create_time": "2024-04-24T08:11:30Z",
                    "id": "edd879e9-f13b-4916-80ac-c3140c093d53",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "245-username accepted your friend request"
                }, {
                    "code": -3,
                    "content": "{\"username\": \"252-username\"}",
                    "create_time": "2024-04-24T08:11:41Z",
                    "id": "676c3027-02f2-423b-99d7-76b6cad7ee9f",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "252-username accepted your friend request"
                }, {
                    "code": -2,
                    "content": "{\"username\": \"255-username\"}",
                    "create_time": "2024-04-24T08:11:46Z",
                    "id": "c0621df7-9cb5-41c4-a771-a2308bd38682",
                    "persistent": true,
                    "sender_id": "ac18e65d-abed-48fb-8dee-a7df11f709b6",
                    "subject": "255-username wants to <
                        message truncated >

```

---

<div class="post-metadata">

**Author:** ![sesposito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/sesposito/32/2594_2.png) [@sesposito](https://forum.heroiclabs.com/u/sesposito)\
**Post date:** [June 17, 2024, 1:48pm UTC](https://forum.heroiclabs.com/t/notification-function-is-lacking-features/5321/4 "2024-06-17T13:48:39Z")

</div>

@dhforever are you using the rest API or a runtime function? Could you provide the code please?

---

<div class="post-metadata">

**Author:** ![dhforever](https://avatars.discourse-cdn.com/v4/letter/d/ebca7d/32.png) [@dhforever](https://forum.heroiclabs.com/u/dhforever)\
**Post date:** [June 17, 2024, 2:16pm UTC](https://forum.heroiclabs.com/t/notification-function-is-lacking-features/5321/5 "2024-06-17T14:16:26Z")

</div>

Very clear.  
I think the SenderId should be the one sending the request. I can easily query by SenderId rather than using the other username.  
List notification is a system that automatically records the friend adding feature from the client.

```auto
public async void GetNotification(Action<List<NotificationData> > callback = null)
    {
        try
        {
            var limit = 100;
            var result = await _client.ListNotificationsAsync(_session, limit, cacheableCursor: null);

            var notifications = new List<NotificationData>();
            foreach (var notification in result.Notifications)
            {
                var notificationModel = new NotificationData
                {
                    Id = notification.Id,
                    Code = notification.Code,
                    Subject = notification.Subject,
                    Content = notification.Content,
                    SenderId = notification.SenderId,
                    UserName = UserContent(notification.Content).Username,
                    CreateTime = notification.CreateTime,
                    Persistent = notification.Persistent
                };
                notifications.Add(notificationModel);
            }
            
            Debug.LogFormat($"GetNotification: {notifications.Count}");
            
            Debug.Log($"Result: {result.ToJson()}");
            
            callback?.Invoke(notifications);
        }
        catch (ApiResponseException e)
        {
            Debug.LogFormat($"ApiResponseException: {e}");
        }
        catch (Exception e)
        {
            Debug.LogWarning("An error has occured while retrieving notifications: " + e.Message);
        }
    }

```

---

<div class="post-metadata">

**Author:** ![sesposito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/sesposito/32/2594_2.png) [@sesposito](https://forum.heroiclabs.com/u/sesposito)\
**Post date:** [June 17, 2024, 2:48pm UTC](https://forum.heroiclabs.com/t/notification-function-is-lacking-features/5321/6 "2024-06-17T14:48:23Z")

</div>

Sorry, I meant to call `AddFriends`, not listing the notifications.

---

<div class="post-metadata">

**Author:** ![dhforever](https://avatars.discourse-cdn.com/v4/letter/d/ebca7d/32.png) [@dhforever](https://forum.heroiclabs.com/u/dhforever)\
**Post date:** [June 17, 2024, 3:41pm UTC](https://forum.heroiclabs.com/t/notification-function-is-lacking-features/5321/7 "2024-06-17T15:41:38Z")

</div>

I created an addfriend demo on the java client side.

```auto
private void addFriendTest(String userId) {
        try {
            client.addFriends(session, new String[]{userId}).get();
            System.out.println("Friend added: " + userId);
        } catch (Exception ex) {
            System.err.println("An error has occurred while adding friend: " + ex);
        }
    }

```

---

<div class="post-metadata">

**Author:** ![sesposito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/sesposito/32/2594_2.png) [@sesposito](https://forum.heroiclabs.com/u/sesposito)\
**Post date:** [June 17, 2024, 6:55pm UTC](https://forum.heroiclabs.com/t/notification-function-is-lacking-features/5321/8 "2024-06-17T18:55:40Z")

</div>

This test passes: [nakama-dotnet/Nakama.Tests/FriendTest.cs at spe/improve-friend-tests · heroiclabs/nakama-dotnet · GitHub](https://github.com/heroiclabs/nakama-dotnet/blob/spe/improve-friend-tests/Nakama.Tests/FriendTest.cs#L58) against the latest Nakama release.

Could the issue lie elsewhere?

---

<div class="post-metadata">

**Author:** ![dhforever](https://avatars.discourse-cdn.com/v4/letter/d/ebca7d/32.png) [@dhforever](https://forum.heroiclabs.com/u/dhforever)\
**Post date:** [June 18, 2024, 10:34am UTC](https://forum.heroiclabs.com/t/notification-function-is-lacking-features/5321/9 "2024-06-18T10:34:47Z")

</div>

Hello, do you know the changes between Nakama server runtime version 3.20 and 3.22?  
I am using 3.20 normally and when switching to 3.22,  
I get a module runtime error.  
It gives an error when I use index.js from version 3.20 and it still works fine

{“level”:“info”,“ts”:“2024-06-18T10:15:55.292Z”,“caller”:“server/runtime\_javascript.go:636”,“msg”:“Initialising JavaScript runtime provider” ,“path”:“data/modules”,“entrypoint”:“”}  
{“level”:“error”,“ts”:“2024-06-18T10:15:55.308Z”,“caller”:“server/runtime\_javascript.go:1701”,“msg”:“Failed to eval JavaScript modules .”,“error”:“GoError: function "beforeAuthenticateCustom" not registered in the global object scope\n\tat [github.com/heroiclabs/nakama/v3/server.(\*RuntimeJavascriptInitModule).mappings.(\*RuntimeJavascriptInitModule)](http://github.com/heroiclabs/nakama/v3/server.(*RuntimeJavascriptInitModule).mappings.(*RuntimeJavascriptInitModule)) .registerBeforeAuthenticateCustom.(\*RuntimeJavascriptInitModule).registerHook.func24 (native)\n\tat InitModule (index.js:5:49(4))\n”}  
{“level”:“error”,“ts”:“2024-06-18T10:15:55.309Z”,“caller”:“server/runtime.go:669”,“msg”:"Error initialising JavaScript runtime provider ",“error”:“GoError: function "beforeAuthenticateCustom" not registered in the global object scope\n\tat [github.com/heroiclabs/nakama/v3/server.(\*RuntimeJavascriptInitModule).mappings.(\*RuntimeJavascriptInitModule)](http://github.com/heroiclabs/nakama/v3/server.(*RuntimeJavascriptInitModule).mappings.(*RuntimeJavascriptInitModule)). registerBeforeAuthenticateCustom.(\*RuntimeJavascriptInitModule).registerHook.func24 (native)\n\tat InitModule (index.js:5:49(4))\n”}  
{“level”:“fatal”,“ts”:“2024-06-18T10:15:55.309Z”,“caller”:“v3/main.go:191”,“msg”:“Failed initializing runtime modules” ,“error”:“GoError: function "beforeAuthenticateCustom" not registered in the global object scope\n\tat [github.com/heroiclabs/nakama/v3/server.(\*RuntimeJavascriptInitModule).mappings.(\*RuntimeJavascriptInitModule).registerBeforeAuthenticateCustom](http://github.com/heroiclabs/nakama/v3/server.(*RuntimeJavascriptInitModule).mappings.(*RuntimeJavascriptInitModule).registerBeforeAuthenticateCustom) .(\*RuntimeJavascriptInitModule).registerHook.func24 (native)\n\tat InitModule (index.js:5:49(4))\n”}  
edumi\_dev@instance-edumi:~$ nakama --config config.yml

---

<div class="post-metadata">

**Author:** ![sesposito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/sesposito/32/2594_2.png) [@sesposito](https://forum.heroiclabs.com/u/sesposito)\
**Post date:** [June 18, 2024, 10:44am UTC](https://forum.heroiclabs.com/t/notification-function-is-lacking-features/5321/10 "2024-06-18T10:44:02Z")

</div>

If the module isn’t loaded the server shouldn’t be working, the error is that the function you’re trying to register doesn’t seem to be a named function in the global JS scope.

---

<div class="post-metadata">

**Author:** ![dhforever](https://avatars.discourse-cdn.com/v4/letter/d/ebca7d/32.png) [@dhforever](https://forum.heroiclabs.com/u/dhforever)\
**Post date:** [June 18, 2024, 10:47am UTC](https://forum.heroiclabs.com/t/notification-function-is-lacking-features/5321/11 "2024-06-18T10:47:23Z")

</div>

But it still works on version 3.20 3.21. until 3.22 it gives an error. Sir

---

<div class="post-metadata">

**Author:** ![sesposito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/sesposito/32/2594_2.png) [@sesposito](https://forum.heroiclabs.com/u/sesposito)\
**Post date:** [June 18, 2024, 11:01am UTC](https://forum.heroiclabs.com/t/notification-function-is-lacking-features/5321/12 "2024-06-18T11:01:33Z")

</div>

Extra startup checks were implemented in `3.22.0` on the JS startup flow, were the registered functions working correctly before? If yes, please provide a code snippet of how you were registering a function and how the function itself was declared.

Either way it shouldn’t be difficult to move the function declaration to the global scope, this is the recommended way.

---

<div class="post-metadata">

**Author:** ![dhforever](https://avatars.discourse-cdn.com/v4/letter/d/ebca7d/32.png) [@dhforever](https://forum.heroiclabs.com/u/dhforever)\
**Post date:** [June 18, 2024, 11:09am UTC](https://forum.heroiclabs.com/t/notification-function-is-lacking-features/5321/13 "2024-06-18T11:09:05Z")

</div>

Thank you. I done 😃
