# Notifications List by UserId

**URL:** <https://forum.heroiclabs.com/t/notifications-list-by-userid/5589>\
**Category:** Runtime Framework\
**Tags:** server-framework, lua\
**Created:** [August 29, 2024, 1:16pm UTC](https://forum.heroiclabs.com/t/notifications-list-by-userid/5589 "2024-08-29T13:16:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![yusuf](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/yusuf/32/1520_2.png) [@yusuf](https://forum.heroiclabs.com/u/yusuf)\
**Post date:** [August 29, 2024, 1:16pm UTC](https://forum.heroiclabs.com/t/notifications-list-by-userid/5589/1 "2024-08-29T13:16:41Z")

</div>

I’m sharing the notification listing function for Lua on the server.

1. Versions: Nakama {3.23}
2. Server Framework Runtime language {Lua}

```auto
local function GetUserNotifications(user_id, limit, offset)
    local query = [[
      SELECT id, subject, content, code, sender_id, create_time 
      FROM notification 
      WHERE user_id = $1 
      ORDER BY create_time DESC
      LIMIT $2 OFFSET $3;
    ]]

    local notifications = nk.sql_query(query, {user_id, limit, offset})
    return notifications
end

```

I could not find the notification listing function with the user\_id parameter. I have written it by myself. So people can see this topic from Google search 😃

I hope this code helps people like me. Have a nice day everyone 👋
