Is it possible to get the notification id after notificationSend in server side by JS runtime?

nk.notificationSend(receiverId, subject, content, code, senderId, persistent);

current the function return void. but i can see the source code of this function:

so is there any way to get this id after send from the server side with js runtime? If not what the best way to get this id in server side?

Hello @mengxin,

Can you elaborate on what’s the use case that requires you to fetch the notification id?

I’m currently working on building a mailbox system based on notifications. Our aim is to include company data along with notifications on the server side.
For instance:

  1. We will introduce a new Mailbox type for notifications.
  2. When the server sends a mailbox-type notification to a player, the server will also create accompanying data such as:
    {
    notificationId: xxx,
    sendTime: xxx,
    isRead: false,
    isClaimed: false
    }
    This data will be sent to the player.
  3. The client will also synchronize this data to keep track of the mailbox.

Additionally, if we can’t retrieve the ID on the server side, we will need to delay the next RPC (Remote Procedure Call) from the server for updating the status. Currently, this isn’t an issue since all the fields have default values of empty or false. We can use these default values to generate the data on the client side and build it on the server during the next update RPC, such as when a player reads a notification. However, if there’s data that needs to be built based on server configuration, we may encounter difficulties, especially if there’s no way to link the notification ID with the data.

I’m currently working on building a mailbox system based on notifications. Our aim is to include company data along with notifications on the server side.
For instance:

  1. We will introduce a new Mailbox type for notifications.
  2. When the server sends a mailbox-type notification to a player, the server will also create accompanying data such as:
    {
    notificationId: xxx,
    sendTime: xxx,
    isRead: false,
    isClaimed: false
    }
    This data will be sent to the player.
  3. The client will also synchronize this data to keep track of the mailbox.

Additionally, if we can’t retrieve the ID on the server side, we will need to delay the next RPC (Remote Procedure Call) from the server for updating the status. Currently, this isn’t an issue since all the fields have default values of empty or false. We can use these default values to generate the data on the client side and build it on the server during the next update RPC, such as when a player reads a notification. However, if there’s data that needs to be built based on server configuration, we may encounter difficulties, especially if there’s no way to link the notification ID with the data.