Anyway to get friend info for an account other than the current session in Lua Module

Here’s what we’re trying to do - when a user links their facebook account with the current nakama account, we check and see if they have already linked it with another nakama account, and then give them the option to switch to that one. We’d like to display information about that account to the user so they have more information to decide with. One of the stats we’d like to show is friends count. I’m looking at the nakama db using pgAdmin and actually don’t see any friends table, and the runtime documentation doesn’t indicate any api to get friend info, and the account object doesn’t appear to include this. Anyway to do this? Thanks in advance.

Is it the case that friends data for the session is only created when a user signs in with facebook? So it’s not persistent outside of the session? If so then what we’re trying to do is impossible.

Friend relationships are stored in the database (the user_edge table) and connected to user accounts, not sessions. If you log in on a new device your friends list is not lost.

If you detect and give the user the option to switch to another Nakama user account, then you must have a session token for both in the client. You should be able to check their friends lists directly from the client for both accounts, right?

Thanks Andrew, my plan is to call an rpc, pass the facebook id, look up the account, get the nakama id, and then pull the friends count from the user_edge table with sql. Missed the friends in that table so thanks for that. We have other custom values we need to pull so the module is the way to go for us.

oh I just noticed there’s a column in the users table called edge_count, that would be the number of friends right?

Yes, edge_count is the number of friends. :+1: